diff --git a/src/belvuApp/belvu.cpp b/src/belvuApp/belvu.cpp
index c71cbe6deb8023ff80d72044b86f3bd5d3d02af0..72533eeea6bb7b69b51354fa6859a3179fbc12df 100644
--- a/src/belvuApp/belvu.cpp
+++ b/src/belvuApp/belvu.cpp
@@ -1,5 +1,6 @@
 /*  File: belvu.c
  *  Author: Erik Sonnhammer
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -34,7 +35,7 @@
 
 
 
-/* 
+/*
 
     Pending:
 
@@ -48,7 +49,7 @@
 	        Traverse bootstrap and original tree
 	Rationale for group bootstrapping:
 		   For each sequence, store array of sequences in merging order in bootstrap tree.
-		   For each node in original tree, check if group of sequences 
+		   For each node in original tree, check if group of sequences
 		   corresponds to the first n sequences in bootstraptree array.
 	Rationale for exact bootstrapping:
 		   Traverse bootstrap tree from leaf to root:
@@ -69,7 +70,7 @@
 
 	read in other trees with bootstraps
 	use confidence cutoff in find orthologs
-	
+
         make alignment collapsing easier to use, see above.
 
         Keyboard edit of one sequence.  How to find the right place ? !!
@@ -102,7 +103,7 @@
 
     for each residue i {
         for each residue j {
-	    if (i == j) 
+	    if (i == j)
 	        score(i) += (count(i)-1)*count(j)*matrix(i,j)
 	    else
 	        score(i) += count(i)*count(j)*matrix(i,j)
@@ -111,15 +112,15 @@
 
 	if (ignore gaps)
 	    n = nresidues(pos)
-	else 
+	else
 	    n = nsequences
-		    
+
 	if (n == 1)
 	    id = 0.0
 	else
 	    id = score/(n*(n-1))
     }
-		
+
 */
 
 
@@ -159,7 +160,7 @@
 
   Note: to use with a2b[], always subtract 1 from the values !!!!
 
-  A   R   N   D   C   Q   E   G   H   I   L   K   M   F   P   S   T   W   Y   V   B   Z   X  \* */ 
+  A   R   N   D   C   Q   E   G   H   I   L   K   M   F   P   S   T   W   Y   V   B   Z   X  \* */
 static int BLOSUM62[24][24] = {
   {4, -1, -2, -2,  0, -1, -1,  0, -2, -1, -1, -1, -1, -2, -1,  1,  0, -3, -2,  0, -2, -1,  0, -4},
   {-1,  5,  0, -2, -3,  1,  0, -2,  0, -3, -2,  2, -1, -3, -2, -1, -1, -3, -2, -3, -1,  0, -1, -4},
@@ -192,7 +193,7 @@ static int BLOSUM62[24][24] = {
  *  This converts an ascii char to a 1-based index that can be used in
  *  the BLOSUM matrix - note that you need to subtract 1 from the values
  *  to get a 0-based index for use in BLOSUM62.
- *  
+ *
  *  It specifies a 1-based index for the 20 standard amino acids. For any
  *  character that is not a residue, NA is returned.
  *
@@ -220,7 +221,7 @@ static int a2b[] =
     NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
     NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
     NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
-    NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA 
+    NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
   };
 
 
@@ -257,7 +258,7 @@ static int n2b[] =
 
 #ifdef OLD_BELVU_CODE
 
-/* Note: this treecpy does not reallocate any strings, assuming they will 
+/* Note: this treecpy does not reallocate any strings, assuming they will
    always exist and never change.  Serious problems await if this is
    not true
 */
@@ -270,7 +271,7 @@ static treeNode *treecpy(treeNode *node)
     newnode = g_malloc(sizeof(treeNode));
 
     newnode->dist      = node->dist;
-    newnode->branchlen = node->branchlen;	
+    newnode->branchlen = node->branchlen;
     newnode->boot      = node->boot;
     newnode->name      = node->name;
     newnode->organism  = node->organism;
@@ -299,7 +300,7 @@ static void treeBalanceTreeRecurse(treeNode *node, double *bestbal, treeNode **b
 	lweight = treeSize3way(node, node->left) - node->branchlen;
 	rweight = treeSize3way(node->left, node) - node->left->branchlen;
 	newbal = fabsf(lweight - rweight);
-	
+
 	/*
 	printf("Subtree weights = %.1f  %.1f\n", lweight, rweight);
 	printf("oldbal = %.1f   newbal = %.1f\n", *bestbal, newbal);
@@ -308,10 +309,10 @@ static void treeBalanceTreeRecurse(treeNode *node, double *bestbal, treeNode **b
 	if (newbal < *bestbal) { /* better balance */
 
 	    g_message("Better balance: %.1f (oldbest = %.1f)\n", newbal, *bestbal);
-	    
+
 	    *bestbal = newbal;
 	    *bestNode = node;
-	    
+
 	    treeBalanceTreeRecurse(node->right, bestbal, bestNode);
 	}
     }
@@ -321,19 +322,19 @@ static void treeBalanceTreeRecurse(treeNode *node, double *bestbal, treeNode **b
 	lweight = treeSize3way(node, node->right) - node->branchlen;
 	rweight = treeSize3way(node->right, node) - node->right->branchlen;
 	newbal = fabsf(lweight - rweight);
-	
+
 	/*
 	printf("Subtree weights = %.1f  %.1f\n", lweight, rweight);
 	printf("oldbal = %.1f   newbal = %.1f\n", *bestbal, newbal);
 	*/
-	
+
 	if (newbal < *bestbal) { /* better balance */
-	    
+
 	    g_message("Better bal: %f\n", newbal);
-	    
+
 	    *bestbal = newbal;
 	    *bestNode = node;
-	    
+
 	    treeBalanceTreeRecurse(node->right, bestbal, bestNode);
 	}
     }
@@ -344,7 +345,7 @@ static void treeBalanceTreeRecurse(treeNode *node, double *bestbal, treeNode **b
 
 
 /* These values define the defaults for the thresholds when coloring by
- * conservation; the first three are when coloring by %ID and the last 
+ * conservation; the first three are when coloring by %ID and the last
  * three when coloring by similarity (i.e. BLOSUM62) */
 #define DEFAULT_LOW_ID_CUTOFF           0.4
 #define DEFAULT_MID_ID_CUTOFF           0.6
@@ -359,49 +360,49 @@ static void treeBalanceTreeRecurse(treeNode *node, double *bestbal, treeNode **b
 #define DEFAULT_LOW_FG_COLOR            BLACK
 #define DEFAULT_MAX_BG_COLOR            CYAN
 #define DEFAULT_MID_BG_COLOR            MIDBLUE
-#define DEFAULT_LOW_BG_COLOR            LIGHTGRAY  
+#define DEFAULT_LOW_BG_COLOR            LIGHTGRAY
 #define DEFAULT_MAX_FG_PRINT_COLOR      WHITE
 #define DEFAULT_MID_FG_PRINT_COLOR      BLACK
 #define DEFAULT_LOW_FG_PRINT_COLOR      BLACK
 #define DEFAULT_MAX_BG_PRINT_COLOR      BLACK
 #define DEFAULT_MID_BG_PRINT_COLOR      GRAY
-#define DEFAULT_LOW_BG_PRINT_COLOR      LIGHTGRAY  
+#define DEFAULT_LOW_BG_PRINT_COLOR      LIGHTGRAY
 
 /* Global variables */
 
 /* Color names (must be in same order as Color enum) */
 static const char *colorNames[NUM_TRUECOLORS] = {
-"WHITE", 
-"BLACK", 
-"LIGHTGRAY", 
+"WHITE",
+"BLACK",
+"LIGHTGRAY",
 "DARKGRAY",
-"RED", 
-"GREEN", 
+"RED",
+"GREEN",
 "BLUE",
-"YELLOW", 
-"CYAN", 
+"YELLOW",
+"CYAN",
 "MAGENTA",
-"LIGHTRED", 
-"LIGHTGREEN", 
+"LIGHTRED",
+"LIGHTGREEN",
 "LIGHTBLUE",
-"DARKRED", 
-"DARKGREEN", 
+"DARKRED",
+"DARKGREEN",
 "DARKBLUE",
-"PALERED", 
-"PALEGREEN", 
+"PALERED",
+"PALEGREEN",
 "PALEBLUE",
-"PALEYELLOW", 
-"PALECYAN", 
+"PALEYELLOW",
+"PALECYAN",
 "PALEMAGENTA",
-"BROWN", 
-"ORANGE", 
+"BROWN",
+"ORANGE",
 "PALEORANGE",
-"PURPLE", 
-"VIOLET", 
+"PURPLE",
+"VIOLET",
 "PALEVIOLET",
-"GRAY", 
+"GRAY",
 "PALEGRAY",
-"CERISE", 
+"CERISE",
 "MIDBLUE"
 };
 
@@ -424,7 +425,7 @@ static const char* colorTable[NUM_TRUECOLORS]= {
 "#af0000", 	   /* DARKRED         */
 "#00af00",	   /* DARKGREEN       */
 "#0000af",         /* DARKBLUE        */
-"#ffe6d2",	   /* PALERED         */ 
+"#ffe6d2",	   /* PALERED         */
 "#d2ffd2", 	   /* PALEGREEN       */
 "#d2ebff",	   /* PALEBLUE        */
 "#ffffc8",	   /* PALEYELLOW      */
@@ -542,7 +543,7 @@ static int a2b_sean[] =
   };
 
 
- 
+
 
 /* Local function declarations */
 static double		   score(char *s1, char *s2, const gboolean penalize_gaps);
@@ -564,7 +565,7 @@ gint alphaorder(gconstpointer xIn, gconstpointer yIn)
   const ALN *y = *((const ALN**)yIn);
 
   int retval=0;
-  
+
   if (!(retval = strcmp(x->name, y->name)))
     {
       if (x->start == y->start)
@@ -579,10 +580,10 @@ gint alphaorder(gconstpointer xIn, gconstpointer yIn)
       else if (x->start > y->start)
 	retval = 1;
     }
-  
-  /* printf("Comparing %10s %4d %4d with %10s %4d %4d = %d\n", 
+
+  /* printf("Comparing %10s %4d %4d with %10s %4d %4d = %d\n",
    x->name, x->start, x->end, y->name, y->start, y->end, retval); */
-  
+
   return retval;
 }
 
@@ -611,14 +612,14 @@ gint organismorder(gconstpointer xIn, gconstpointer yIn)
   const ALN *y = *((const ALN**)yIn);
 
   int retval=0;
-  const char *p1 = strchr(x->name, '_'), 
+  const char *p1 = strchr(x->name, '_'),
              *p2 = strchr(y->name, '_');
 
   if (!p1 && !p2) return alphaorder(xIn, yIn);
   if (!p1) return 1;
   if (!p2) return -1;
-  
-  if (!(retval = strcmp(p1, p2))) 
+
+  if (!(retval = strcmp(p1, p2)))
     return alphaorder(xIn, yIn);
 
   return retval;
@@ -667,14 +668,14 @@ gint nrorder(gconstpointer xIn, gconstpointer yIn)
 
 void scoreSort(BelvuContext *bc)
 {
-  if (!bc->displayScores) 
-    { 
+  if (!bc->displayScores)
+    {
       g_critical("No scores available.\n");
       return;
     }
 
   g_array_sort(bc->alignArr, scoreorder);
-    
+
   arrayOrder(bc->alignArr);
 }
 
@@ -695,30 +696,30 @@ static void organismSort(BelvuContext *bc)
 
 void highlightScoreSort(char mode, BelvuContext *bc)
 {
-  if (!bc->selectedAln) 
+  if (!bc->selectedAln)
     {
       g_critical("Please highlight a sequence first\n");
       return;
     }
-  
-  if (bc->selectedAln->markup) 
+
+  if (bc->selectedAln->markup)
     {
       g_critical("Please do not highlight a markup line\n");
       return;
     }
-  
+
   separateMarkupLines(bc);
-  
+
   /* if (displayScores) {
    if (!(graphQuery("This will erase the current scores, do you want to continue?")))
    return;
    }*/
-  
+
   bc->displayScores = TRUE;
-  
+
   /* Calculate score relative to highlighted sequence */
   int i = 0;
-  
+
   for (i = 0; i < (int)bc->alignArr->len; ++i)
     {
       ALN *curAln = g_array_index(bc->alignArr, ALN*, i);
@@ -731,23 +732,23 @@ void highlightScoreSort(char mode, BelvuContext *bc)
 	{
 	  curAln->score = percentIdentity(alnGetSeq(bc->selectedAln), alnGetSeq(curAln), bc->penalize_gaps);
 	}
-      
+
       char *scoreStr = g_strdup_printf("%.1f", curAln->score);
       int len = strlen(scoreStr);
-      
+
       if (len > bc->maxScoreLen)
 	bc->maxScoreLen = len;
-      
+
       g_free(scoreStr);
     }
-  
+
   g_array_sort(bc->alignArr, scoreorderRev);
   arrayOrder(bc->alignArr);
-  
+
   reInsertMarkupLines(bc);
-  
+
   bc->alignYStart = 0;
-  
+
   if (bc->belvuAlignment)
     {
       updateHeaderColumnsSize(bc->belvuAlignment);
@@ -764,8 +765,8 @@ void highlightScoreSort(char mode, BelvuContext *bc)
 void doSort(BelvuContext *bc, const BelvuSortType sortType, const gboolean showTree)
 {
   g_array_sort(bc->alignArr, nrorder);
-  
-  switch(sortType) 
+
+  switch(sortType)
   {
     case BELVU_SORT_ALPHA :	      alphaSort(bc);                        break;
     case BELVU_SORT_ORGANISM :        organismSort(bc);                     break;
@@ -775,8 +776,8 @@ void doSort(BelvuContext *bc, const BelvuSortType sortType, const gboolean showT
     case BELVU_SORT_SIM :             highlightScoreSort('P', bc);          break;
     case BELVU_SORT_ID :              highlightScoreSort('I', bc);          break;
     case BELVU_UNSORTED : break;
-    
-    default: 
+
+    default:
       g_warning("Initial sort order '%d' not recognised.\n", sortType);
       break;
   }
@@ -786,7 +787,7 @@ void doSort(BelvuContext *bc, const BelvuSortType sortType, const gboolean showT
  *		          Trees				   *
  ***********************************************************/
 
-void setTreeScaleCorr(BelvuContext *bc, const int treeMethod) 
+void setTreeScaleCorr(BelvuContext *bc, const int treeMethod)
 {
   if (treeMethod == UPGMA)
       bc->treeScale = 1.0;
@@ -795,24 +796,24 @@ void setTreeScaleCorr(BelvuContext *bc, const int treeMethod)
 }
 
 
-void setTreeScale(BelvuContext *bc, const double newScale) 
+void setTreeScale(BelvuContext *bc, const double newScale)
 {
   bc->treeScale = newScale;
 }
 
 
-static int treeOrder(TreeNode *node, const int treeOrderNrIn) 
+static int treeOrder(TreeNode *node, const int treeOrderNrIn)
 {
   int treeOrderNr = treeOrderNrIn;
-  
-  if (node) 
+
+  if (node)
     {
       treeOrderNr = treeOrder(node->left, treeOrderNr);
-      
+
       if (node->aln)
         node->aln->nr = treeOrderNr++;
-      
-      treeOrderNr = treeOrder(node->right, treeOrderNr);    
+
+      treeOrderNr = treeOrder(node->right, treeOrderNr);
     }
 
   return treeOrderNr;
@@ -822,26 +823,26 @@ static int treeOrder(TreeNode *node, const int treeOrderNrIn)
 void treeSortBatch(BelvuContext *bc)
 {
   separateMarkupLines(bc);
-  
+
   if (!bc->mainTree || !bc->mainTree->head)
     {
       Tree *tree = treeMake(bc, FALSE, TRUE);
       belvuContextSetTree(bc, &tree);
     }
-  
+
   treeOrder(bc->mainTree->head, 1); /* Set nr field according to tree order */
-  
+
   g_array_sort(bc->alignArr, nrorder);
-  
+
   reInsertMarkupLines(bc);
 }
 
 
-void treeTraverse(BelvuContext *bc, TreeNode *node, void (*func)(BelvuContext *bc, TreeNode *treeNode)) 
+void treeTraverse(BelvuContext *bc, TreeNode *node, void (*func)(BelvuContext *bc, TreeNode *treeNode))
 {
-  if (!node) 
+  if (!node)
     return;
-  
+
   treeTraverse(bc, node->left, func);
   func(bc, node);
   treeTraverse(bc, node->right, func);
@@ -851,7 +852,7 @@ void treeTraverse(BelvuContext *bc, TreeNode *node, void (*func)(BelvuContext *b
 /* General purpose routine to convert a string to ALN struct.
    Note: only fields Name, Start, End are filled!
  */
-void str2aln(BelvuContext *bc, char *src, ALN *alnp) 
+void str2aln(BelvuContext *bc, char *src, ALN *alnp)
 {
   char *tmp = g_strdup(src);
   stripCoordTokens(tmp, bc);
@@ -861,10 +862,10 @@ void str2aln(BelvuContext *bc, char *src, ALN *alnp)
       g_critical("Name to field conversion failed for %s (%s).\n", src, tmp);
       return;
     }
-  
+
   if (strlen(alnp->name) > MAXNAMESIZE)
     g_error("buffer overrun in %s !!!!!!!!!\n", "str2aln") ;
-  
+
   g_free(tmp);
 }
 
@@ -874,7 +875,7 @@ void str2aln(BelvuContext *bc, char *src, ALN *alnp)
 void treeSort(BelvuContext *bc, const gboolean showTree)
 {
   treeSortBatch(bc);
-  
+
   if (showTree)
     {
       /* Show the tree window (create it if necessary) */
@@ -886,37 +887,37 @@ void treeSort(BelvuContext *bc, const gboolean showTree)
 }
 
 
-static void treeTraverseLRfirst(BelvuContext *bc, TreeNode *node, void (*func)(BelvuContext *bc, TreeNode *node)) 
+static void treeTraverseLRfirst(BelvuContext *bc, TreeNode *node, void (*func)(BelvuContext *bc, TreeNode *node))
 {
-  if (!node) 
+  if (!node)
     return;
-  
+
   treeTraverseLRfirst(bc, node->left, func);
   treeTraverseLRfirst(bc, node->right, func);
   func(bc, node);
 }
 
 
-static void subfamilyTrav(BelvuContext *bc, TreeNode *node) 
+static void subfamilyTrav(BelvuContext *bc, TreeNode *node)
 {
   static double dist = 0.0;
-  static int 
+  static int
   newgroup = 1,
   groupnr = 0;
-  
-  if (!node) 
+
+  if (!node)
     return;
-  
-  if (node->name) 
+
+  if (node->name)
     {
       dist = node->branchlen;
-    
-      if (newgroup) 
+
+      if (newgroup)
         {
           g_message("\nGroup nr %d:\n", ++groupnr);
           newgroup = 0;
         }
-      
+
       g_message("%s\n", node->name);
     }
   else
@@ -924,12 +925,12 @@ static void subfamilyTrav(BelvuContext *bc, TreeNode *node)
       /* internal node */
       dist += node->branchlen;
     }
-  
+
   if ( bc->mksubfamilies_cutoff > (100.0-dist) )
-    { 
-      newgroup = 1; 
+    {
+      newgroup = 1;
     }
-  
+
   /* printf("abs=%.1f  branch=%.1f\n", dist, node->branchlen); */
 }
 
@@ -937,12 +938,12 @@ static void subfamilyTrav(BelvuContext *bc, TreeNode *node)
 void mksubfamilies(BelvuContext *bc, double cutoff)
 {
   separateMarkupLines(bc);
-  
+
   strcpy(bc->treeMethodString, UPGMAstr);
   bc->treeMethod = UPGMA;
-  
+
   Tree *tree = treeMake(bc, FALSE, TRUE);
-  
+
   treeTraverseLRfirst(bc, tree->head, subfamilyTrav);
 }
 
@@ -958,9 +959,9 @@ void mksubfamilies(BelvuContext *bc, double cutoff)
  * maintaining a pointer to it. */
 static void readFastaAlnFinalise(BelvuContext *bc, ALN *aln)
 {
-  if (bc->maxLen) 
+  if (bc->maxLen)
     {
-      if (alnGetSeqLen(aln) != bc->maxLen) 
+      if (alnGetSeqLen(aln) != bc->maxLen)
         g_error("Differing sequence lengths: %d %d\n", bc->maxLen, alnGetSeqLen(aln));
     }
   else
@@ -971,9 +972,9 @@ static void readFastaAlnFinalise(BelvuContext *bc, ALN *aln)
   int ip = 0;
   if (alnArrayFind(bc->alignArr, &aln, &ip, alphaorder))
     {
-      g_error("Sequence name occurs more than once: %s%c%d-%d\n", 
+      g_error("Sequence name occurs more than once: %s%c%d-%d\n",
               aln->name, bc->saveSeparator, aln->start, aln->end);
-      
+
       g_string_free(aln->sequenceStr, TRUE);
       g_free(aln);
     }
@@ -1000,7 +1001,7 @@ void initAln(ALN *alnp)
   alnp->markup = 0;
   alnp->hide = FALSE;
   alnp->nocolor = FALSE;
-  alnp->organism = NULL; 
+  alnp->organism = NULL;
   alnp->startColIdx = 0;
 }
 
@@ -1022,12 +1023,12 @@ static void readFastaAln(BelvuContext *bc, FILE *pipe)
   ALN *currentAln = NULL;
 
   while (!feof (pipe))
-    { 
+    {
       if (!fgets (line, MAXLENGTH, pipe))
 	break;
 
       char *cp = strchr(line, '\n');
-      
+
       /* Cut off the newline char at the end, if it has one */
       if (cp)
 	*cp = 0;
@@ -1044,7 +1045,7 @@ static void readFastaAln(BelvuContext *bc, FILE *pipe)
           /* Create a new sequence */
           currentAln = createEmptyAln();
           currentAln->sequenceStr = g_string_new(NULL);
-          
+
           /* Parse the new line. Note that this resets the ALN struct for us. */
           parseMulLine(bc, line + 1, currentAln);
         }
@@ -1054,14 +1055,14 @@ static void readFastaAln(BelvuContext *bc, FILE *pipe)
           g_string_append(currentAln->sequenceStr, line);
         }
     }
-  
+
   if (currentAln)
     {
       readFastaAlnFinalise(bc, currentAln);
     }
 
   bc->saveFormat = BELVU_FILE_ALIGNED_FASTA;
-  
+
   return ;
 }
 
@@ -1075,7 +1076,7 @@ void alncpy(ALN *dest, ALN *src)
   dest->end = src->end;
   /* dest->sequenceStr = src->sequenceStr ? g_string_new(src->sequenceStr->str) : NULL; */
   dest->sequenceStr = src->sequenceStr;
-  dest->nr = src->nr;			
+  dest->nr = src->nr;
   strncpy(dest->fetch, src->fetch, MAXNAMESIZE+10);
   dest->score = src->score;
   dest->color = src->color;
@@ -1093,15 +1094,15 @@ void alncpy(ALN *dest, ALN *src)
 
 /* Convenience routine for converting "name/start-end" to "name start end".
  Used by parsing routines.
- 
+
  Return 1 if both tokens were found, otherwise 0.
  */
 static int stripCoordTokens(char *cp, BelvuContext *bc)
 {
   char *end = cp;
-  
+
   while (*end && !isspace(*end)) end++;
-  
+
   if ((cp = strchr(cp, bc->saveSeparator)) && cp < end) {
     *cp = ' ';
     if ((cp = strchr(cp, '-')) && cp < end) {
@@ -1118,55 +1119,55 @@ static int stripCoordTokens(char *cp, BelvuContext *bc)
 
 /*
  Parse name, start and end of a Mul format line
- 
+
  Convenience routine, part of readMul and other parsers
  */
 void parseMulLine(BelvuContext *bc, char *line, ALN *aln)
 {
   char line2[MAXLENGTH+1], *cp=line2, *cq, GRfeat[MAXNAMESIZE+1];
   GRfeat[0] = 0;
-  
+
   strncpy(cp, line, MAXLENGTH);
-  
+
   if (!strncmp(cp, "#=GC", 4))
     {
       aln->markup = GC;
       cp += 5;
     }
 
-  if (!strncmp(cp, "#=RF", 4)) 
+  if (!strncmp(cp, "#=RF", 4))
     {
       aln->markup = GC;
-    } 
+    }
 
-  if (!strncmp(cp, "#=GR", 4)) 
+  if (!strncmp(cp, "#=GR", 4))
     {
       aln->markup = GR;
       cp += 5;
     }
-  
-  if (bc->stripCoordTokensOn) 
+
+  if (bc->stripCoordTokensOn)
     stripCoordTokens(cp, bc);
-  
+
   /* Name */
   strncpy(aln->name, cp, MAXNAMESIZE);
   aln->name[MAXNAMESIZE] = 0;
 
-  if ((cq = strchr(aln->name, ' '))) 
+  if ((cq = strchr(aln->name, ' ')))
     *cq = 0;
-  
+
   /* Add Start and End coords */
   if (bc->stripCoordTokensOn && (bc->IN_FORMAT != RAW) )
     sscanf(strchr(cp, ' ') + 1, "%d%d", &aln->start, &aln->end);
-  
-  if (aln->markup == GR) 
+
+  if (aln->markup == GR)
     {
-      /* Add GR markup names to name 
-       
+      /* Add GR markup names to name
+
          #=GR O83071 192 246 SA 999887756453524252..55152525....36463774777.....948472782969685958
          ->name = O83071_SA
       */
-      if (bc->IN_FORMAT == MUL) 
+      if (bc->IN_FORMAT == MUL)
         {
           sscanf(cp + strlen(aln->name), "%d%d%s", &aln->start, &aln->end, GRfeat);
         }
@@ -1174,13 +1175,13 @@ void parseMulLine(BelvuContext *bc, char *line, ALN *aln)
         {
           sscanf(cp + strlen(aln->name), "%s", GRfeat);
         }
-      
+
       if (strlen(aln->name)+strlen(GRfeat)+2 > MAXNAMESIZE)
         g_critical("Too long name or/and feature name\n");
 
       strcat(aln->name, " ");
       strncat(aln->name, GRfeat, MAXNAMESIZE-strlen(aln->name));
-      
+
       /* printf("%s, %d chars\n", aln->name, strlen(aln->name)); fflush(stdout); */
     }
 }
@@ -1191,35 +1192,35 @@ void parseMulLine(BelvuContext *bc, char *line, ALN *aln)
  ***********************************************************/
 
 /* Set the default colors of organisms to something somewhat intelligent */
-void setOrganismColors(GArray *organismArr) 
+void setOrganismColors(GArray *organismArr)
 {
     static int treeColors[16] = {
-      RED, 
+      RED,
       BLUE,
-      DARKGREEN, 
-      ORANGE, 
+      DARKGREEN,
+      ORANGE,
       MAGENTA,
-      BROWN, 
-      PURPLE, 
-      CYAN, 
-      VIOLET, 
+      BROWN,
+      PURPLE,
+      CYAN,
+      VIOLET,
       MIDBLUE,
-      CERISE, 
+      CERISE,
       LIGHTBLUE,
-      DARKRED, 
-      GREEN, 
+      DARKRED,
+      GREEN,
       DARKBLUE,
       GRAY
   };
-  
+
   int i = 0;
   int color = 0;
-  
-  for (i = 0; i < (int)organismArr->len; ++i) 
+
+  for (i = 0; i < (int)organismArr->len; ++i)
     {
       color = treeColors[i % 16];
       /*if (i > 15) color = treeColors[15];*/
-     
+
       g_array_index(organismArr, ALN*, i)->color = color;
     }
 }
@@ -1268,10 +1269,10 @@ int* getMarkupColorArray()
 static const char* convertColorNumToStr(const int colorNum)
 {
   const char *result = colorTable[WHITE];
-  
+
   if (colorNum >= 0 && colorNum < NUM_TRUECOLORS)
     result = colorTable[colorNum];
-  
+
   return result;
 }
 
@@ -1281,7 +1282,7 @@ void convertColorNumToGdkColor(const int colorNum, const gboolean isSelected, Gd
 {
   const char *colorStr = convertColorNumToStr(colorNum);
   getColorFromString(colorStr, result, NULL);
-  
+
   /* If an item is selected, we use a slightly different shade of the same color. */
   if (isSelected)
     getSelectionColor(result, result);
@@ -1291,11 +1292,11 @@ void convertColorNumToGdkColor(const int colorNum, const gboolean isSelected, Gd
 //static void colorCons(BelvuContext *bc)
 //{
 //  setConsSchemeColors(bc);
-//  
+//
 //  //  menuSetFlags(menuItem(colorMenu, thresholdStr), MENUFLAG_DISABLED);
 //  //  menuUnsetFlags(menuItem(colorMenu, printColorsStr), MENUFLAG_DISABLED);
 //  //  menuUnsetFlags(menuItem(colorMenu, ignoreGapsStr), MENUFLAG_DISABLED);
-//  
+//
 //  bc->colorByResIdOn = FALSE;
 //  //  belvuRedraw();
 //}
@@ -1395,7 +1396,7 @@ void initCustomColors()
 static void colorSchemeCGP(BelvuContext *bc)
 {
   clearResidueColors(bc);
-  
+
   color[(unsigned char)'C'] = color[(unsigned char)'c'] = CYAN;
   color[(unsigned char)'G'] = color[(unsigned char)'g'] = RED;
   color[(unsigned char)'P'] = color[(unsigned char)'p'] = GREEN;
@@ -1405,7 +1406,7 @@ static void colorSchemeCGP(BelvuContext *bc)
 static void colorSchemeCGPH(BelvuContext *bc)
 {
   clearResidueColors(bc);
-  
+
   color[(unsigned char)'C'] = color[(unsigned char)'c'] = CYAN;
   color[(unsigned char)'G'] = color[(unsigned char)'g'] = RED;
   color[(unsigned char)'P'] = color[(unsigned char)'p'] = GREEN;
@@ -1422,14 +1423,14 @@ static void colorSchemeEmpty(BelvuContext *bc)
 static void colorSchemeErik(BelvuContext *bc)
 {
   /* Erik's favorite colours:
-   
+
    C        - MIDBLUE
    GP       - CYAN
    HKR      - GREEN
    AFILMVWY - YELLOW
    BDENQSTZ - LIGHTRED
    */
-  
+
   color[(unsigned char)'A'] = color[(unsigned char)'a'] = YELLOW;
   color[(unsigned char)'B'] = color[(unsigned char)'b'] = NOCOLOR;
   color[(unsigned char)'C'] = color[(unsigned char)'c'] = MIDBLUE;
@@ -1458,12 +1459,12 @@ static void colorSchemeErik(BelvuContext *bc)
 static void colorSchemeGibson(BelvuContext *bc)
 {
   /* Colour scheme by Gibson et. al (1994) TIBS 19:349-353
-   
+
    Listed in Figure 1:
-   
-   
+
+
    Gibson      AA        Here
-   
+
    orange      G         ORANGE (16-colours: LIGHTRED)
    yellow      P         YELLOW
    blue        ACFILMVW  MIDBLUE
@@ -1473,7 +1474,7 @@ static void colorSchemeGibson(BelvuContext *bc)
    red         RK        RED
    pink        H         LIGHTRED (16-colours: DARKRED)
    */
-  
+
   color[(unsigned char)'A'] = color[(unsigned char)'a'] = MIDBLUE;
   color[(unsigned char)'B'] = color[(unsigned char)'b'] = NOCOLOR;
   color[(unsigned char)'C'] = color[(unsigned char)'c'] = MIDBLUE;
@@ -1503,7 +1504,7 @@ static void colorSchemeGibson(BelvuContext *bc)
 void saveCustomColors(BelvuContext *bc)
 {
   bc->haveCustomColors = TRUE;
-  
+
   customColor[(unsigned char)'A'] = customColor[(unsigned char)'a'] = color[(unsigned char)'a'];
   customColor[(unsigned char)'B'] = customColor[(unsigned char)'b'] = color[(unsigned char)'b'];
   customColor[(unsigned char)'C'] = customColor[(unsigned char)'c'] = color[(unsigned char)'c'];
@@ -1526,7 +1527,7 @@ void saveCustomColors(BelvuContext *bc)
   customColor[(unsigned char)'W'] = customColor[(unsigned char)'w'] = color[(unsigned char)'w'];
   customColor[(unsigned char)'Y'] = customColor[(unsigned char)'y'] = color[(unsigned char)'y'];
   customColor[(unsigned char)'Z'] = customColor[(unsigned char)'z'] = color[(unsigned char)'z'];
-  
+
 }
 
 
@@ -1570,8 +1571,8 @@ void setResidueSchemeColors(BelvuContext *bc)
       case BELVU_SCHEME_CGPH:     colorSchemeCGPH(bc);	    break;
       case BELVU_SCHEME_NONE:     colorSchemeEmpty(bc);	    break;
       case BELVU_SCHEME_CUSTOM:   colorSchemeCustom(bc);    break;
-      
-      default: 
+
+      default:
 	g_warning("Program error: unrecognised color scheme '%d'.\n", bc->residueScheme);
 	break;
     }
@@ -1582,7 +1583,7 @@ void setResidueSchemeColors(BelvuContext *bc)
  * colors according to the active scheme. */
 void updateSchemeColors(BelvuContext *bc)
 {
-  /* Set the color scheme if coloring by conservation or if applying a 
+  /* Set the color scheme if coloring by conservation or if applying a
    * threshold when coloring by residue */
   if (colorByConservation(bc) || colorByResId(bc))
     setConsSchemeColors(bc);
@@ -1590,32 +1591,32 @@ void updateSchemeColors(BelvuContext *bc)
 
 
 /* Return 1 if c1 has priority over c2, 0 otherwise */
-static int colorPriority(BelvuContext *bc, int c1, int c2) 
+static int colorPriority(BelvuContext *bc, int c1, int c2)
 {
-  if (c2 == WHITE) 
+  if (c2 == WHITE)
     return 1;
-  
+
   if (c2 == *getConsColor(bc, CONS_LEVEL_MAX, FALSE))
     return 0;
-  
-  if (c2 == *getConsColor(bc, CONS_LEVEL_LOW, FALSE)) 
+
+  if (c2 == *getConsColor(bc, CONS_LEVEL_LOW, FALSE))
     {
-      if (c1 ==*getConsColor(bc, CONS_LEVEL_LOW, FALSE)) 
+      if (c1 ==*getConsColor(bc, CONS_LEVEL_LOW, FALSE))
         return 0;
-      else 
+      else
         return 1;
     }
-  
-  if (c2 == *getConsColor(bc, CONS_LEVEL_MID, FALSE)) 
+
+  if (c2 == *getConsColor(bc, CONS_LEVEL_MID, FALSE))
     {
-      if (c1 == *getConsColor(bc, CONS_LEVEL_MAX, FALSE)) 
+      if (c1 == *getConsColor(bc, CONS_LEVEL_MAX, FALSE))
         return 1;
       else
         return 0;
     }
-  
+
   g_critical("Program error: invalid background colour '%s' when calculating color priority.\n", colorNames[c2]);
-  
+
   return 0 ;
 }
 
@@ -1626,12 +1627,12 @@ void setConsSchemeColors(BelvuContext *bc)
 {
   int i, j, k, l, colornr, simCount, n;
   double id, maxid;
-  
-  if (!bc->conservCount) 
+
+  if (!bc->conservCount)
     initConservMtx(bc);
-  
+
   int totalNumSeqs = countResidueFreqs(bc);
-  
+
   for (i = 0; i < bc->maxLen; ++i)
     {
       for (k = 1; k < 21; ++k)
@@ -1639,24 +1640,24 @@ void setConsSchemeColors(BelvuContext *bc)
 	  bc->colorMap[k][i] = WHITE;
 	}
     }
-  
-  for (i = 0; i < bc->maxLen; ++i) 
+
+  for (i = 0; i < bc->maxLen; ++i)
     {
       maxid = -100.0;
-    
-      for (k = 1; k < 21; k++) 
+
+      for (k = 1; k < 21; k++)
 	{
-	  if (colorBySimilarity(bc)) 
+	  if (colorBySimilarity(bc))
 	    {
               /* Convert counts to similarity counts */
               simCount = 0;
-              for (j = 1; j < 21; j++) 
+              for (j = 1; j < 21; j++)
                 {
                   /* Get the blosum comparison score of the two residues */
                   int score_k_vs_j = BLOSUM62[j-1][k-1];
-                  
+
                   /* This comparison score applies for each occurance of k vs
-                   * each occurance of j, e.g. if there are 3 occurances of k 
+                   * each occurance of j, e.g. if there are 3 occurances of k
                    * and 2 occurances of j, we have:
                    *   k1 vs j1 = score_k_vs_j
                    *   k1 vs j2 = score_k_vs_j
@@ -1664,7 +1665,7 @@ void setConsSchemeColors(BelvuContext *bc)
                    *   k2 vs j2 = score_k_vs_j
                    *   k3 vs j1 = score_k_vs_j
                    *   k4 vs j2 = score_k_vs_j
-                   * 
+                   *
                    * i.e. score_k_vs_j occurs (count_k * count_j) times.
                    */
                   int count_k = bc->conservCount[k][i];
@@ -1672,65 +1673,65 @@ void setConsSchemeColors(BelvuContext *bc)
 
                   /* Don't compare the same amino acid against itself, i.e. if
                    * there are three occurances of k then we compare:
-                   *   k1 vs k2 
-                   *   k1 vs k3 
-                   * 
+                   *   k1 vs k2
+                   *   k1 vs k3
+                   *
                    * but NOT
                    *   k1 vs k1
                    *
                    * so in this case score_k_vs_j occurs (count_k * (count_k - 1)) times.
                    */
-                  if (j == k) 
+                  if (j == k)
                     --count_k;
 
                   simCount += count_k * count_j * score_k_vs_j;
                 }
-	    
-              if (bc->ignoreGapsOn) 
+
+              if (bc->ignoreGapsOn)
                 n = bc->conservResidues[i]; /* total number of residues in this column */
-              else 
+              else
                 n = totalNumSeqs;  /* total number of sequences */
-              
+
               if (n < 2)
                 {
                   id = 0.0;
                 }
-              else 
+              else
                 {
-                  /* Divide the similarity count by the total number of comparisons 
+                  /* Divide the similarity count by the total number of comparisons
                    * made for each column; we made n * (n - 1) comparisons because
                    * we compared each of the n residues in the column to each other
                    * residue in the column except itself. */
                   id = (double)simCount / (n * (n-1));
                 }
-              
+
               /* printf("%d, %c:  simCount= %d, id= %.2f\n", i, b2a[k], simCount, id); */
-	    
+
               /* Colour this residue if it is above the %ID threshold */
-              if (id > bc->lowSimCutoff) 
+              if (id > bc->lowSimCutoff)
                 {
                   /* Choose the colour based on the 3 specified levels */
-                  if (id > bc->maxSimCutoff) 
+                  if (id > bc->maxSimCutoff)
                     colornr = *getConsColor(bc, CONS_LEVEL_MAX, FALSE);
-                  else if (id > bc->midSimCutoff) 
+                  else if (id > bc->midSimCutoff)
                     colornr = *getConsColor(bc, CONS_LEVEL_MID, FALSE);
                   else
                     colornr = *getConsColor(bc, CONS_LEVEL_LOW, FALSE);
-                  
+
                   /* Set the colour for this residue, unless it has already been
                    * given a colour with a higher priority than this one (i.e. it
                    * has already been marked as more conserved) */
                   if (colorPriority(bc, colornr, bc->colorMap[k][i]))
                     bc->colorMap[k][i] = colornr;
-	      
+
                   /* Color all similar residues too; that is, any residue that has
                    * a positive blosum score when compared to the current residue
-                   * should be coloured with same level of conservation in this 
-                   * column; again, we only set the colour if it doesn't already 
+                   * should be coloured with same level of conservation in this
+                   * column; again, we only set the colour if it doesn't already
                    * have a higher priority colour set on it. */
-                  for (l = 1; l < 21; l++) 
+                  for (l = 1; l < 21; l++)
                     {
-                      if (BLOSUM62[k-1][l-1] > 0 && colorPriority(bc, colornr, bc->colorMap[l][i])) 
+                      if (BLOSUM62[k-1][l-1] > 0 && colorPriority(bc, colornr, bc->colorMap[l][i]))
                         {
                           /*printf("%d: %c -> %c\n", i, b2a[k], b2a[l]);*/
                           bc->colorMap[l][i] = colornr;
@@ -1738,13 +1739,13 @@ void setConsSchemeColors(BelvuContext *bc)
                     }
                 }
 	    }
-	  else 
+	  else
 	    {
               /* We are colouring by %ID */
-              
+
               /* First, get the %ID; this is the count of this residue divided
                * by the total number of residues (or the total number of sequences,
-               * if we are including gaps). 
+               * if we are including gaps).
                * If ignoring gaps but there is only one residue in this column
                * then the ID takes into account the total number of sequences;
                * I'm not sure why - perhaps because there are no other residues
@@ -1753,8 +1754,8 @@ void setConsSchemeColors(BelvuContext *bc)
                 id = (double)bc->conservCount[k][i]/bc->conservResidues[i];
               else
                 id = (double)bc->conservCount[k][i]/totalNumSeqs;
-              
-              if (colorByResId(bc)) 
+
+              if (colorByResId(bc))
                 {
                   /* We're colouring by residue type, but only colouring the residues
                    * if their %ID is above the set threshold */
@@ -1763,33 +1764,33 @@ void setConsSchemeColors(BelvuContext *bc)
                   else
                     bc->colorMap[k][i] = WHITE;
                 }
-              else if (id > bc->lowIdCutoff) 
+              else if (id > bc->lowIdCutoff)
                 {
                   /* We're colouring by conservation, using the %ID to determine
                    * the colour according to the three thresholds: */
-                  if (id > bc->maxIdCutoff) 
+                  if (id > bc->maxIdCutoff)
                     colornr = *getConsColor(bc, CONS_LEVEL_MAX, FALSE);
-                  else if (id > bc->midIdCutoff) 
+                  else if (id > bc->midIdCutoff)
                     colornr = *getConsColor(bc, CONS_LEVEL_MID, FALSE);
                   else
                     colornr = *getConsColor(bc, CONS_LEVEL_LOW, FALSE);
-                  
-                  /* Set the colour in the array (to do: should this use 
+
+                  /* Set the colour in the array (to do: should this use
                    * colorPriority to check if it's already been set? At the moment
-                   * it overrides any previous (possibly better) colour set 
+                   * it overrides any previous (possibly better) colour set
                    * from a similar residue's result)  */
                   bc->colorMap[k][i] = colornr;
-                  
-                  if (bc->consScheme == BELVU_SCHEME_ID_BLOSUM) 
+
+                  if (bc->consScheme == BELVU_SCHEME_ID_BLOSUM)
                     {
                       /* Colour all similar residues too; that is, any residues
-                       * that have a positive blosum score when compared to the 
+                       * that have a positive blosum score when compared to the
                        * current residue should be given the same colour in this
                        * column (unless a higher priority colour has already been
                        * set). */
-                      for (l = 1; l < 21; l++) 
+                      for (l = 1; l < 21; l++)
                         {
-                          if (BLOSUM62[k-1][l-1] > 0 && colorPriority(bc, colornr, bc->colorMap[l][i])) 
+                          if (BLOSUM62[k-1][l-1] > 0 && colorPriority(bc, colornr, bc->colorMap[l][i]))
                             {
                               /*printf("%d: %c -> %c\n", i, b2a[k], b2a[l]);*/
                               bc->colorMap[l][i] = colornr;
@@ -1798,13 +1799,13 @@ void setConsSchemeColors(BelvuContext *bc)
                     }
                 }
 	    }
-	
-	  if (id > maxid) 
+
+	  if (id > maxid)
 	    {
 	      maxid = id;
 	    }
 	}
-      
+
       bc->conservation[i] = maxid;
     }
 }
@@ -1854,110 +1855,110 @@ void initMarkupColors(void)
 /* Save the current color-by-residue color scheme */
 void saveResidueColorScheme(BelvuContext *bc, FILE *fil)
 {
-  if (!fil) 
+  if (!fil)
     return;
-  
+
   int i = 1;
   for (i = 1; i < 21; i++)
     {
       fprintf(fil, "%c %s\n", b2a[i], colorNames[color[(unsigned char)(b2a[i])]]);
     }
-  
+
   fclose(fil);
 }
 
 
 /* This reads in residue colors from the given file and places them into
  * the given array, which is typically one of the active color scheme arrays
- * 'color' or 'markupColor'. 
+ * 'color' or 'markupColor'.
  * If storeCustomColors is true, then it also saves the colors to the 'customColor'
  * array so that they can be retrieved later (because 'color' gets overwritten
  * with the current colors every time the user toggles between different color
  * schemes). */
 void readResidueColorScheme(BelvuContext *bc, FILE *fil, int *colorarr, const gboolean storeCustomColors)
 {
-  if (!fil) 
+  if (!fil)
     return;
 
   char *cp=NULL, line[MAXLINE+1], setColor[MAXLINE+1];
   unsigned char c ;
   int i=0, colornr=0;
-  
-  while (!feof(fil)) 
+
+  while (!feof(fil))
     {
-      if (!fgets (line, MAXLINE, fil)) 
+      if (!fgets (line, MAXLINE, fil))
 	break;
-    
+
       /* remove newline */
-      if ((cp = strchr(line, '\n'))) 
+      if ((cp = strchr(line, '\n')))
         *cp = 0 ;
-    
-      /* Parse color of organism in tree 
+
+      /* Parse color of organism in tree
          Format:  #=OS BLUE D. melanogaster*/
-      if (!strncmp(line, "#=OS ", 5)) 
+      if (!strncmp(line, "#=OS ", 5))
         {
           cp = line+5;
           sscanf(cp, "%s", setColor);
-          
+
           for (colornr = -1, i = 0; i < NUM_TRUECOLORS; i++)
             {
-              if (!strcasecmp(colorNames[i], setColor)) 
+              if (!strcasecmp(colorNames[i], setColor))
                 colornr = i;
             }
-          
-          if (colornr == -1) 
+
+          if (colornr == -1)
             {
               g_warning("Unrecognized color: %s, using black instead.\n", setColor);
               colornr = BLACK;
             }
-          
+
           while(*cp == ' ') cp++;
           while(*cp != ' ') cp++;
           while(*cp == ' ') cp++;
-          
+
           /* Find organism and set its colour */
           ALN aln;
           initAln(&aln);
           aln.organism = cp;
-          
+
           int ip = 0;
           if (!alnArrayFind(bc->organismArr, &aln, &ip, organism_order))
             g_critical("Cannot find organism \"%s\", specified in color code file. Hope that's ok\n", aln.organism);
           else
             g_array_index(bc->organismArr, ALN*, ip)->color = colornr;
         }
-      
+
       /* Ignore comments */
-      if (*line == '#') 
+      if (*line == '#')
         continue;
-      
+
       /* Parse character colours */
-      if (sscanf(line, "%c%s", &c, setColor) == 2) 
+      if (sscanf(line, "%c%s", &c, setColor) == 2)
         {
           c = toupper(c);
           for (colornr = -1, i = 0; i < NUM_TRUECOLORS; i++)
             {
-              if (!strcasecmp(colorNames[i], setColor)) 
+              if (!strcasecmp(colorNames[i], setColor))
                 colornr = i;
             }
-          
-          if (colornr == -1) 
+
+          if (colornr == -1)
             {
               g_warning("Unrecognized color: %s\n", setColor);
               colornr = 0;
             }
-          
+
           colorarr[(unsigned char)(c)] = colornr;
-          
+
           if (c > 64 && c <= 96)
             colorarr[(unsigned char)(c+32)] = colorarr[(unsigned char)(c)];
           else if (c > 96 && c <= 128)
             colorarr[(unsigned char)(c-32)] = colorarr[(unsigned char)(c)];
         }
     }
-  
+
   fclose(fil);
-  
+
   /* Store the custom colors */
   saveCustomColors(bc);
 }
@@ -1987,11 +1988,11 @@ int* getConsPrintColor(BelvuContext *bc, const BelvuConsLevel consLevel, const g
       case CONS_LEVEL_MAX:
         result = foreground ? &bc->maxfgPrintColor : &bc->maxbgPrintColor;
         break;
-        
+
       case CONS_LEVEL_MID:
         result = foreground ? &bc->midfgPrintColor : &bc->midbgPrintColor;
         break;
-        
+
       case CONS_LEVEL_LOW:
         result = foreground ? &bc->lowfgPrintColor : &bc->lowbgPrintColor;
         break;
@@ -2019,11 +2020,11 @@ int* getConsColor(BelvuContext *bc, const BelvuConsLevel consLevel, const gboole
       case CONS_LEVEL_MAX:
         result = foreground ? &bc->maxfgColor : &bc->maxbgColor;
         break;
-        
+
       case CONS_LEVEL_MID:
         result = foreground ? &bc->midfgColor : &bc->midbgColor;
         break;
-        
+
       case CONS_LEVEL_LOW:
         result = foreground ? &bc->lowfgColor : &bc->lowbgColor;
         break;
@@ -2041,40 +2042,40 @@ int* getConsColor(BelvuContext *bc, const BelvuConsLevel consLevel, const gboole
  * from the conservation colours calculations */
 void setExcludeFromConsCalc(BelvuContext *bc, const gboolean exclude)
 {
-  if (!bc->selectedAln) 
+  if (!bc->selectedAln)
     {
       g_critical("Please select a sequence first.\n");
       return;
   }
-  
+
   if ((exclude && bc->selectedAln->nocolor) ||
      (!exclude && !bc->selectedAln->nocolor))
     {
       /* Nothing to do */
       return;
     }
-  
+
   /* Store orignal state in the nocolor field:
    1 = normal sequence
    2 = markup line
-   
+
    This is needed to restore markup lines (nocolor lines are always markups)
    */
-  
-  if (exclude) 
+
+  if (exclude)
     {
       if (bc->selectedAln->markup)
         bc->selectedAln->nocolor = 2;
       else
         bc->selectedAln->nocolor = 1;
-      
+
       bc->selectedAln->markup = 1;
     }
-  else 
+  else
     {
-      if (bc->selectedAln->nocolor == 1) 
+      if (bc->selectedAln->nocolor == 1)
         bc->selectedAln->markup = 0;
-      
+
       bc->selectedAln->nocolor = 0;
     }
 }
@@ -2094,14 +2095,14 @@ gboolean alnArrayFind(GArray *a, void *s, int *ip, int (* orderFunc)(gconstpoint
   int i = 0 , j = a->len, k;
 
   if (!j || (ord = orderFunc(&s, &g_array_index(a, ALN*, 0))) < 0)
-    { 
+    {
       if (ip)
-	*ip = -1; 
+	*ip = -1;
       return FALSE;
     }   /* not found */
 
   if (ord == 0)
-    { 
+    {
       if (ip)
 	*ip = 0;
       return TRUE;
@@ -2110,40 +2111,40 @@ gboolean alnArrayFind(GArray *a, void *s, int *ip, int (* orderFunc)(gconstpoint
   if ((ord = orderFunc(&s, &g_array_index(a, ALN*, --j))) > 0)
     {
       if (ip)
-	*ip = j; 
+	*ip = j;
       return FALSE;
     }
-  
+
   if (ord == 0)
-    { 
+    {
       if (ip)
 	*ip = j;
       return TRUE;
     }
 
   while (TRUE)
-    { 
+    {
       k = i + ((j-i) >> 1) ; /* midpoint */
 
       if ((ord = orderFunc(&s, &g_array_index(a, ALN*, k))) == 0)
-	{ 
+	{
           if (ip)
-	    *ip = k; 
+	    *ip = k;
 	  return TRUE;
 	}
-      
-      if (ord > 0) 
+
+      if (ord > 0)
 	(i = k);
       else
 	(j = k) ;
-      
+
       if (i == (j-1) )
         break;
     }
-  
+
   if (ip)
     *ip = i ;
-  
+
   return FALSE;
 }
 
@@ -2153,71 +2154,71 @@ gboolean bsArrayFind(GArray *a, void *s, int *ip, int (* orderFunc)(gconstpointe
 {
   int ord;
   int i = 0 , j = a->len, k;
-  
+
   if (!j || (ord = orderFunc(&s, &g_array_index(a, BootstrapGroup*, 0))) < 0)
-    { 
+    {
       if (ip)
-	*ip = -1; 
+	*ip = -1;
       return FALSE;
     }   /* not found */
-  
+
   if (ord == 0)
-    { 
+    {
       if (ip)
 	*ip = 0;
       return TRUE;
     }
-  
+
   if ((ord = orderFunc(&s, &g_array_index(a, BootstrapGroup*, --j))) > 0)
     {
       if (ip)
-	*ip = j; 
+	*ip = j;
       return FALSE;
     }
-  
+
   if (ord == 0)
-    { 
+    {
       if (ip)
 	*ip = j;
       return TRUE;
     }
-  
+
   while (TRUE)
-    { 
+    {
       k = i + ((j-i) >> 1) ; /* midpoint */
-      
+
       if ((ord = orderFunc(&s, &g_array_index(a, BootstrapGroup*, k))) == 0)
-	{ 
+	{
           if (ip)
-	    *ip = k; 
+	    *ip = k;
 	  return TRUE;
 	}
-      
-      if (ord > 0) 
+
+      if (ord > 0)
 	(i = k);
       else
 	(j = k) ;
-      
+
       if (i == (j-1) )
         break;
     }
-  
+
   if (ip)
     *ip = i ;
-  
+
   return FALSE;
 }
 
 
 /* Linear search for an exact matching sequence name and coordinates,
- typically to find back highlighted row after sorting 
+ typically to find back highlighted row after sorting
  */
 gboolean alignFind(GArray *alignArr, ALN *obj, int *idx)
 {
-  for (*idx = 0; *idx < (int)alignArr->len; (*idx)++) 
+  for (*idx = 0; *idx < (int)alignArr->len; (*idx)++)
     {
       ALN *currentAln = g_array_index(alignArr, ALN*, *idx);
-      
+
       if (alphaorder(&currentAln, &obj) == 0)
         return TRUE;
     }
@@ -2230,8 +2231,8 @@ gboolean alignFind(GArray *alignArr, ALN *obj, int *idx)
 void arrayOrder(GArray *alignArr)
 {
   int i = 0;
-  
-  for (i = 0; i < (int)alignArr->len; ++i) 
+
+  for (i = 0; i < (int)alignArr->len; ++i)
     {
       ALN *alnp = g_array_index(alignArr, ALN*, i);
       alnp->nr = i + 1;
@@ -2246,7 +2247,7 @@ void arrayOrder(GArray *alignArr)
 //{
 //  int i;
 //
-//  for (i = 0; i < alignArr->len; ++i) 
+//  for (i = 0; i < alignArr->len; ++i)
 //    g_array_index(alignArr, ALN*, i)->nr = (i+1)*10;
 //}
 
@@ -2257,15 +2258,15 @@ void arrayOrder(GArray *alignArr)
 void separateMarkupLines(BelvuContext *bc)
 {
   bc->markupAlignArr = g_array_sized_new(FALSE, FALSE, sizeof(ALN*), 100);
-  
+
   arrayOrder(bc->alignArr);
-  
+
   int i = 0;
-  for (i = 0; i < (int)bc->alignArr->len; ) 
+  for (i = 0; i < (int)bc->alignArr->len; )
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
-      
-      if (alnp->markup) 
+
+      if (alnp->markup)
         {
           /* printf ("Moving line %d, %s/%d-%d, nseq=%d\n", i, alnp->name, alnp->start, alnp->end, nseq);*/
           g_array_append_val(bc->markupAlignArr, alnp);
@@ -2277,7 +2278,7 @@ void separateMarkupLines(BelvuContext *bc)
           ++i;
         }
     }
-  
+
   arrayOrder(bc->alignArr);
 }
 
@@ -2287,7 +2288,7 @@ void reInsertMarkupLines(BelvuContext *bc)
 {
   int i, j;
   char tmpname[MAXNAMESIZE+1], *cp;
-  
+
   g_array_sort(bc->alignArr, nrorder); /* to do: can we move this out of the loop ? */
 
   for (i = bc->markupAlignArr->len - 1; i >=0 ; --i)
@@ -2298,10 +2299,10 @@ void reInsertMarkupLines(BelvuContext *bc)
        * minus the postfix (after a space); or at the end of the array if none
        * exists. */
       strcpy(tmpname, alnp->name);
-      
+
       if ((cp = strchr(tmpname, ' ')))
         *cp = 0;
-      
+
       for (j = 0; j < (int)bc->alignArr->len; ++j)
         {
           if (!strcmp(tmpname, g_array_index(bc->alignArr, ALN*, j)->name))
@@ -2322,7 +2323,7 @@ int strcmp_(gconstpointer xIn, gconstpointer yIn)
 {
   const char *x = *((const char**)xIn);
   const char *y = *((const char**)yIn);
-  
+
   int retval = strcmp(x, y);
   return retval;
 }
@@ -2331,14 +2332,14 @@ int strcmp_(gconstpointer xIn, gconstpointer yIn)
 GArray *copyAlignArray(GArray *inputArr)
 {
   GArray *result = g_array_sized_new(FALSE, FALSE, sizeof(char*), inputArr->len);
-  
+
   int i = 0;
   for ( ; i < (int)inputArr->len; ++i)
     {
       ALN *inputAln = g_array_index(inputArr, ALN*, i);
       ALN *destAln = createEmptyAln();
       alncpy(destAln, inputAln); /* shallow copy; doesn't copy sequence string */
-      
+
       g_array_append_val(result, destAln);
 
       /* Duplicate the sequence string, if not null */
@@ -2347,7 +2348,7 @@ GArray *copyAlignArray(GArray *inputArr)
       else
         destAln->sequenceStr = NULL;
     }
-  
+
   return result;
 }
 
@@ -2355,7 +2356,7 @@ GArray *copyAlignArray(GArray *inputArr)
 void columnCopy(GArray *alignArrDest, int destIdx, GArray *alignArrSrc, int srcIdx)
 {
   int i;
-  
+
   for (i = 0; i < (int)alignArrSrc->len; ++i)
     {
       ALN *srcAln = g_array_index(alignArrSrc, ALN*, i);
@@ -2363,7 +2364,7 @@ void columnCopy(GArray *alignArrDest, int destIdx, GArray *alignArrSrc, int srcI
 
       char *srcSeq = alnGetSeq(srcAln);
       char *destSeq = alnGetSeq(destAln);
-      
+
       if (srcSeq && destSeq && destIdx < alnGetSeqLen(destAln) && srcIdx < alnGetSeqLen(srcAln))
         destSeq[destIdx] = srcSeq[srcIdx];
     }
@@ -2381,7 +2382,7 @@ void createBelvuColors(BelvuContext *bc)
   /* Initialise the array with empty BlxColor structs */
   bc->defaultColors = g_array_sized_new(FALSE, FALSE, sizeof(BlxColor), BELCOLOR_NUM_COLORS);
   int i = BELCOLOR_MIN + 1;
-  
+
   for ( ; i < BELCOLOR_NUM_COLORS; ++i)
     {
       BlxColor *blxColor = new BlxColor;
@@ -2389,17 +2390,17 @@ void createBelvuColors(BelvuContext *bc)
       blxColor->desc = NULL;
       g_array_append_val(bc->defaultColors, *blxColor);
     }
-  
+
   createBlxColor(bc->defaultColors, BELCOLOR_BACKGROUND, "Background", "Background color", BLX_WHITE, BLX_WHITE, "#bdbdbd", NULL);
   createBlxColor(bc->defaultColors, BELCOLOR_ALIGN_TEXT, "Text color for alignments", "Text color for alignments", BLX_BLACK, BLX_BLACK, NULL, NULL);
   createBlxColor(bc->defaultColors, BELCOLOR_COLUMN_HIGHLIGHT, "Highlight color for selected column", "Highlight color for selected column",  "#dddddd", BLX_BLACK, NULL, NULL);
-  
+
   /* Trees */
   createBlxColor(bc->defaultColors, BELCOLOR_TREE_BACKGROUND, "Tree background", "Tree background color", BLX_WHITE, BLX_WHITE, NULL, NULL);
   createBlxColor(bc->defaultColors, BELCOLOR_TREE_LINE, "Default tree line color", "Default tree line color", BLX_BLACK, BLX_BLACK, NULL, NULL);
   createBlxColor(bc->defaultColors, BELCOLOR_TREE_TEXT, "Default tree text color", "Default tree text color", BLX_BLACK, BLX_BLACK, NULL, NULL);
   createBlxColor(bc->defaultColors, BELCOLOR_TREE_BOOTSTRAP, "Tree boostrap line color", "Tree boostrap line color", BLX_BLUE, BLX_BLUE, NULL, NULL);
-  
+
   /* Conservation plot */
   createBlxColor(bc->defaultColors, BELCOLOR_CONS_PLOT, "Line color of the conservation plot", "Line color of the conservation plot", BLX_BLACK, BLX_BLACK, NULL, NULL);
   createBlxColor(bc->defaultColors, BELCOLOR_CONS_PLOT_AVG, "Average-conservation line color on the conservation profile", "Average-conservation line color on the conservation profile", BLX_RED, BLX_GREY, NULL, NULL);
@@ -2411,46 +2412,46 @@ void createBelvuColors(BelvuContext *bc)
 BelvuContext* createBelvuContext()
 {
   BelvuContext *bc = new BelvuContext;
-  
+
   bc->belvuWindow = NULL;
   bc->spawnedWindows = NULL;
   bc->belvuTree = NULL;
   bc->belvuAlignment = NULL;
   bc->consPlot = NULL;
   bc->orgsWindow = NULL;
-  
+
   bc->defaultCursor = NULL; /* get from gdkwindow once it is shown */
   bc->removeSeqsCursor = NULL ;
   bc->busyCursor = NULL ;
 
   bc->defaultColors = NULL;
-  
+
   bc->alignArr = g_array_sized_new(FALSE, FALSE, sizeof(ALN*), 100);
   bc->organismArr = g_array_sized_new(FALSE, FALSE, sizeof(ALN*), 100);
   bc->markupAlignArr = NULL;
   bc->bootstrapGroups = NULL;
-  
+
   bc->selectedAln = NULL;
   bc->highlightedAlns = NULL;
-  
+
   bc->mainTree = NULL;
   bc->treeBestBalancedNode = NULL;
-  
+
   bc->treeReadDistancesPipe = NULL;
-  
+
   bc->IN_FORMAT = MUL;
   bc->maxScoreLen = 0;
   bc->alignYStart = 0;
-  bc->treebootstraps = 0; 
+  bc->treebootstraps = 0;
   bc->maxLen = 0;
   bc->maxTreeWidth = 0;
-  bc->maxNameLen = 0;   
-  bc->maxStartLen = 0; 
-  bc->maxEndLen = 0; 
-  bc->maxScoreLen = 0; 
+  bc->maxNameLen = 0;
+  bc->maxStartLen = 0;
+  bc->maxEndLen = 0;
+  bc->maxScoreLen = 0;
   bc->selectedCol = 0;
   bc->highlightedCol = 0;
-  
+
   bc->maxfgColor = DEFAULT_MAX_FG_COLOR;
   bc->midfgColor = DEFAULT_MID_FG_COLOR,
   bc->lowfgColor = DEFAULT_LOW_FG_COLOR;
@@ -2463,19 +2464,19 @@ BelvuContext* createBelvuContext()
   bc->maxbgPrintColor = DEFAULT_MAX_BG_PRINT_COLOR;
   bc->midbgPrintColor = DEFAULT_MID_BG_PRINT_COLOR;
   bc->lowbgPrintColor = DEFAULT_LOW_BG_PRINT_COLOR;
-  
+
   bc->schemeType = BELVU_SCHEME_TYPE_CONS;
   bc->residueScheme = BELVU_SCHEME_ERIK;
   bc->consScheme = BELVU_SCHEME_BLOSUM;
-  
+
   bc->treeMethod = NJ;
   bc->treeDistCorr = SCOREDIST;
   bc->treePickMode = NODESWAP;
-  
+
   bc->sortType = BELVU_UNSORTED;
-  
+
   bc->annotationList = NULL;
-  
+
   bc->treeBestBalance = 0.0;
   bc->treeBestBalance_subtrees = 0.0;
   bc->tree_y = 0.3;
@@ -2489,7 +2490,7 @@ BelvuContext* createBelvuContext()
   bc->mksubfamilies_cutoff = 0.0;
   bc->treeScale = DEFAULT_TREE_SCALE_CORR;
   bc->treeLineWidth = 0.3;
-  
+
   bc->gapChar = '.';
   bc->saveSeparator = '/';
   strcpy(bc->treeDistString, SCOREDISTstr);
@@ -2499,14 +2500,14 @@ BelvuContext* createBelvuContext()
   bc->fileName = NULL;
   bc->dirName = NULL;
   bc->organismLabel[0] = 'O';
-  bc->organismLabel[1] = 'S';   
-  bc->organismLabel[2] = '\0'; 
-  
+  bc->organismLabel[1] = 'S';
+  bc->organismLabel[2] = '\0';
+
   bc->conservCount = NULL;
   bc->colorMap = NULL;
   bc->conservResidues = NULL;
   bc->conservation = NULL;
-  
+
   bc->treeCoordsOn = TRUE;
   bc->treeReadDistancesOn = FALSE;
   bc->treePrintDistances = FALSE;
@@ -2533,14 +2534,14 @@ BelvuContext* createBelvuContext()
   bc->useWWWFetch = FALSE;
   bc->initTree = FALSE;
   bc->onlyTree = FALSE;
-  
+
   /* Null out all the entries in the dialogs list */
   int dialogId = 0;
   for ( ; dialogId < BELDIALOG_NUM_DIALOGS; ++dialogId)
     {
       bc->dialogList[dialogId] = NULL;
     }
-  
+
   return bc;
 }
 
@@ -2552,16 +2553,16 @@ void destroyBelvuContext(BelvuContext **bc)
     {
     if ((*bc)->alignArr)
       g_array_unref((*bc)->alignArr);
-    
+
     if ((*bc)->organismArr)
       g_array_unref((*bc)->organismArr);
-    
+
     if ((*bc)->markupAlignArr)
       g_array_unref((*bc)->markupAlignArr);
-    
+
     if ((*bc)->bootstrapGroups)
       g_array_unref((*bc)->bootstrapGroups);
-    
+
     delete *bc;
     *bc = NULL;
     }
@@ -2600,15 +2601,15 @@ const char *belvuGetWebSiteString(void)
  * functions, this one allocates a new string which must be free'd by the caller */
 const char *belvuGetCommentsString(void)
 {
-  char *result = g_strdup_printf("%s\n%s\n%s %s\n\n%s\n", 
-                                 BELVU_TITLE_STRING, 
+  char *result = g_strdup_printf("%s\n%s\n%s %s\n\n%s\n",
+                                 BELVU_TITLE_STRING,
                                  gbtools::UtilsGetVersionTitle(),
-                                 UT_COMPILE_PHRASE, 
-                                 UT_MAKE_COMPILE_DATE(), 
+                                 UT_COMPILE_PHRASE,
+                                 UT_MAKE_COMPILE_DATE(),
                                  AUTHOR_TEXT);
 
   return result;
-  
+
 }
 
 /* Returns a license string for the belvu application. */
@@ -2649,30 +2650,30 @@ char b2aIndex(const int idx)
 void drawText(GtkWidget *widget, GdkDrawable *drawable, GdkGC *gc, const int x, const int y, const char *text, int *textWidth, int *textHeight)
 {
   PangoLayout *layout = gtk_widget_create_pango_layout(widget, text);
-  
+
   if (drawable)
     gdk_draw_layout(drawable, gc, x, y, layout);
-  
+
   /* Return the width and height of the layout, if requested */
   pango_layout_get_size(layout, textWidth, textHeight);
-  
+
   if (textWidth)
     *textWidth /= PANGO_SCALE;
-  
+
   if (textHeight)
     *textHeight /= PANGO_SCALE;
-  
+
   g_object_unref(layout);
 }
 
 
-/* Utility to draw the given integer as text. The text is right-aligned, so 
+/* Utility to draw the given integer as text. The text is right-aligned, so
  * the input x coord must be the RIGHTMOST EDGE of where you want the text. */
-void drawIntAsText(GtkWidget *widget, 
-                   GdkDrawable *drawable, 
-                   GdkGC *gc, 
-                   const int x, 
-                   const int y, 
+void drawIntAsText(GtkWidget *widget,
+                   GdkDrawable *drawable,
+                   GdkGC *gc,
+                   const int x,
+                   const int y,
                    const int value)
 {
   char *tmpStr = g_strdup_printf("%d", value);
@@ -2687,22 +2688,22 @@ void drawIntAsText(GtkWidget *widget,
 }
 
 
-/* Utility to draw the given double as text. The text is right-aligned, so 
+/* Utility to draw the given double as text. The text is right-aligned, so
  * the input x coord must be the RIGHTMOST EDGE of where you want the text. */
-void drawDoubleAsText(GtkWidget *widget, 
-                      GdkDrawable *drawable, 
-                      GdkGC *gc, 
-                      const int x, 
-                      const int y, 
+void drawDoubleAsText(GtkWidget *widget,
+                      GdkDrawable *drawable,
+                      GdkGC *gc,
+                      const int x,
+                      const int y,
                       const double value)
 {
   char *tmpStr = g_strdup_printf("%.1f", value);
   PangoLayout *layout = gtk_widget_create_pango_layout(widget, tmpStr);
   g_free(tmpStr);
-  
+
   int textWidth;
   pango_layout_get_pixel_size(layout, &textWidth, NULL);
-  
+
   gdk_draw_layout(drawable, gc, x - textWidth, y, layout);
   g_object_unref(layout);
 }
@@ -2713,19 +2714,19 @@ double percentIdentity(char *s1, char *s2, const gboolean penalize_gaps)
 {
     int n, id;
 
-    for (n = id = 0; *s1 && *s2; s1++, s2++) 
+    for (n = id = 0; *s1 && *s2; s1++, s2++)
       {
-	if (isGap(*s1) && isGap(*s2)) 
+	if (isGap(*s1) && isGap(*s2))
           continue;
-        
+
 	if (isGap(*s1) || isGap(*s2))
           {
-	    if (!penalize_gaps) 
+	    if (!penalize_gaps)
               continue;
           }
-        
+
 	n++;
-	if (toupper(*s1) == toupper(*s2)) 
+	if (toupper(*s1) == toupper(*s2))
           id++;
       }
 
@@ -2741,13 +2742,13 @@ static double score(char *s1, char *s2, const gboolean penalize_gaps)
 {
     double sc=0.0;
 
-    for (;*s1 && *s2; s1++, s2++) 
+    for (;*s1 && *s2; s1++, s2++)
       {
-	if (isGap(*s1) && isGap(*s2)) 
+	if (isGap(*s1) && isGap(*s2))
           {
 	    continue;
           }
-	else if (isGap(*s1) || isGap(*s2)) 
+	else if (isGap(*s1) || isGap(*s2))
           {
 	    if (penalize_gaps) sc -= 0.6;
           }
@@ -2755,20 +2756,20 @@ static double score(char *s1, char *s2, const gboolean penalize_gaps)
           {
             int val1 = a2b[(unsigned char)(*s1)];
             int val2 = a2b[(unsigned char)(*s2)];
-            
+
             if (val1 > 0 && val2 > 0)
               sc += (double) BLOSUM62[val1 - 1][val2 - 1];
           }
       }
-    
+
     return sc;
 }
 
 
-gboolean isGap(char c) 
+gboolean isGap(char c)
 {
   if (c == '.' || c == '-' ||
-      c == '[' || c == ']' /* Collapse-control chars */ ) 
+      c == '[' || c == ']' /* Collapse-control chars */ )
     return TRUE;
   else
     return FALSE;
@@ -2779,43 +2780,43 @@ static gboolean isAlign(char c)
 {
   if (isalpha(c) || isGap(c) || c == '*')
     return TRUE;
-  else 
+  else
     return FALSE;
 }
 
 
 int GCGchecksum(BelvuContext *bc, char *seq)
 {
-  int  
-  check = 0, 
-  count = 0, 
+  int
+  check = 0,
+  count = 0,
   i=0;
-  
-  for (i = 0; i < bc->maxLen; ++i) 
+
+  for (i = 0; i < bc->maxLen; ++i)
     {
     ++count;
     check += count * toupper((int) seq[i]);
-    
-    if (count == 57) 
+
+    if (count == 57)
       count = 0;
     }
-  
+
   return (check % 10000);
 }
 
 
 int GCGgrandchecksum(BelvuContext *bc)
 {
-  int 
+  int
   i=0,
   grand_checksum=0;
-  
+
   for(i=0; i < (int)bc->alignArr->len; ++i)
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
       grand_checksum += GCGchecksum(bc, alnGetSeq(alnp));
     }
-  
+
   return (grand_checksum % 10000);
 }
 
@@ -2826,25 +2827,25 @@ void readLabels(BelvuContext *bc, FILE *fil)
   char *labelseq = (char*)g_malloc(bc->maxLen + 1); /* The raw sequence of labels */
   char *label = (char*)g_malloc(bc->maxLen + 1);    /* The mapped sequence of labels, 1-maxlen */
   char line[MAXLENGTH+1];
-  
+
   /* read file */
   char *cq = labelseq;
-  while (!feof (fil)) 
+  while (!feof (fil))
     {
-      if (!fgets (line, MAXLENGTH, fil)) 
+      if (!fgets (line, MAXLENGTH, fil))
         break;
-      
+
       char *cp = line;
-      while (*cp) 
+      while (*cp)
         {
-          if (isalpha(*cp)) 
+          if (isalpha(*cp))
             *cq++ = *cp;
           cp++;
         }
     }
 
   fclose(fil);
-  
+
   /* Warn if seq too long, return if too short */
   int seqlen = bc->selectedAln->end - bc->selectedAln->start + 1;
   if ((int)strlen(labelseq) > seqlen)
@@ -2852,40 +2853,40 @@ void readLabels(BelvuContext *bc, FILE *fil)
       g_critical("The sequence of labels is longer (%d) than the sequence (%d).\nHope that's ok\n",
 		 (int)strlen(labelseq), seqlen);
     }
-  else if ((int)strlen(labelseq) < seqlen) 
+  else if ((int)strlen(labelseq) < seqlen)
     {
       g_critical("The sequence of labels is shorter (%d) than the sequence (%d).\nAborting\n",
 		 (int)strlen(labelseq), seqlen);
       return;
     }
-  
+
   /* map labels to alignment */
   int col = 0;
   int seqpos = 0;
-  
-  for (col = 0, seqpos = 0; col < bc->maxLen; col++) 
+
+  for (col = 0, seqpos = 0; col < bc->maxLen; col++)
     {
       label[col] = labelseq[seqpos];
       const char *selectedSeq = alnGetSeq(bc->selectedAln);
-      
-      if (selectedSeq && isalpha(selectedSeq[col]) && labelseq[seqpos+1]) 
+
+      if (selectedSeq && isalpha(selectedSeq[col]) && labelseq[seqpos+1])
         seqpos++;
     }
-  
+
   int row = 0;
-  for (row = 0; row < (int)bc->alignArr->len; ++row) 
+  for (row = 0; row < (int)bc->alignArr->len; ++row)
     {
       ALN *alnrow = g_array_index(bc->alignArr, ALN*, row);
-      
+
       for (col = 0; col < bc->maxLen; col++)
         {
           char *rowSeq = alnGetSeq(alnrow);
-          
+
           if (rowSeq && isalpha(rowSeq[col]))
             rowSeq[col] = label[col];
         }
     }
-  
+
   g_free(labelseq);
 }
 
@@ -2903,26 +2904,26 @@ static void makeSegList(BelvuContext *bc, SEG **SegList, char *line)
   linecopy = (char*)g_malloc(strlen(line)+1);
   strcpy(linecopy, line);
   n = 0;
-  
-  if (atoi(strtok(linecopy, " "))) 
+
+  if (atoi(strtok(linecopy, " ")))
     n++;;
-  
-  while ( (p = strtok(0, " ")) && atoi(p) ) 
+
+  while ( (p = strtok(0, " ")) && atoi(p) )
     n++;
-  
+
   g_free(linecopy);
-    
-  if (!n || n % 4) 
+
+  if (!n || n % 4)
     g_error("Segments not multiple of 4 ints (%s)\n", line);
 
-  for (i = 0; i < n/4; i++) 
+  for (i = 0; i < n/4; i++)
     {
       seg = (SEG *)g_malloc(sizeof(SEG));
-      if (prevseg) 
+      if (prevseg)
         prevseg->next = seg;
       else
         *SegList = seg;
-      
+
       prevseg = seg;
 
       seg->qstart = atoi(i ? strtok(0, " ") : strtok(line, " "));
@@ -2932,7 +2933,7 @@ static void makeSegList(BelvuContext *bc, SEG **SegList, char *line)
       seg->next = NULL;
     }
 
-  for (seg = *SegList; seg; seg = seg->next) 
+  for (seg = *SegList; seg; seg = seg->next)
     {
       DEBUG_OUT("%d %d %d %d\n", seg->qstart, seg->qend, seg->start, seg->end);
 
@@ -2958,43 +2959,43 @@ static void makeSegList(BelvuContext *bc, SEG **SegList, char *line)
 
 static int countInserts(SEG *seg)
 {
-  int   
+  int
     Align_gap, Query_gap, gap, insert_counter=0;
 
   if (!seg)
     return insert_counter ;
 
-  while (seg->next) 
+  while (seg->next)
     {
       Align_gap = seg->next->start - seg->end - 1;
-      if (Align_gap < 0) 
+      if (Align_gap < 0)
         g_error("Negative Align_gap: %d (%d-%d)\n", Align_gap, seg->start, seg->next->end );
-		
+
       Query_gap = seg->next->qstart - seg->qend - 1;
-      if (Query_gap < 0) 
+      if (Query_gap < 0)
         g_error("Negative Query_gap: %d (%d-%d)\n", Query_gap, seg->qstart, seg->next->qend );
 
       gap = Query_gap - Align_gap;
-      if (gap > 0) 
+      if (gap > 0)
         {
           insert_counter += gap;
 	}
-      
+
       seg = seg->next;
     }
-  
+
   return insert_counter;
 }
 
 
-/* Inserts n gap columns after position p, in sequence coordinate, 1...maxLen 
+/* Inserts n gap columns after position p, in sequence coordinate, 1...maxLen
  */
 static void insertColumns(BelvuContext *bc, int p, int n)
 {
   int
     i, j;
 
-  ALN 
+  ALN
     *alni;
   char
     *dest, *src, *seq;
@@ -3003,24 +3004,24 @@ static void insertColumns(BelvuContext *bc, int p, int n)
 
   bc->maxLen += n;
 
-  for (i = 0; i < (int)bc->alignArr->len; ++i) 
+  for (i = 0; i < (int)bc->alignArr->len; ++i)
     {
       alni = g_array_index(bc->alignArr, ALN*, i);
-	
+
       seq = (char*)g_malloc(bc->maxLen + 1);
 
       dest = seq;
       src = alnGetSeq(alni);
 
-      for (j = 0; j < p;  j++) 
+      for (j = 0; j < p;  j++)
         {
           *dest++ = *src++;
 	}
-      for (; j < p+n;  j++) 
+      for (; j < p+n;  j++)
         {
           *dest++ = '.';
 	}
-      for (; j < bc->maxLen;  j++) 
+      for (; j < bc->maxLen;  j++)
         {
           *dest++ = *src++;
 	}
@@ -3046,8 +3047,8 @@ static void insertColumns(BelvuContext *bc, int p, int n)
 
    - Should matches be displayed on separate lines or in the middle of the alignment?
      On top would be nice, but would require a lot of extra programming (status bar etc).
-     Instead add to alignment (SEED usually fits on one screen) 
-     Draw names with red background.  
+     Instead add to alignment (SEED usually fits on one screen)
+     Draw names with red background.
      Add on top.
 
 
@@ -3066,7 +3067,7 @@ static void insertColumns(BelvuContext *bc, int p, int n)
 void readMatch(BelvuContext *bc, FILE *fil)
 {
   /* Format:
-       
+
   Using segments is more difficult than residues, but is
   necessary to display in ACEDB Pepmap.
 
@@ -3082,7 +3083,7 @@ void readMatch(BelvuContext *bc, FILE *fil)
   char *cp, *seq, *rawseq = NULL, *seqp;
   SEG	*SegList = NULL, *seg;
   char line[MAXLENGTH+1];
-  
+
   while (!done_one)
     {
       if (!fgets(line, MAXLENGTH, fil))
@@ -3106,7 +3107,7 @@ void readMatch(BelvuContext *bc, FILE *fil)
 
 	  strncpy(aln->name, line, MAXNAMESIZE);
 	  aln->name[MAXNAMESIZE] = 0;
-          
+
 	  if ((cp = strchr(aln->name, ' ')))
 	    *cp = 0;
 
@@ -3114,38 +3115,38 @@ void readMatch(BelvuContext *bc, FILE *fil)
 	    bc->maxNameLen = strlen(aln->name);
 
 	  /* Start & End */
-	  if (!(cp = strtok(0, "-"))) 
+	  if (!(cp = strtok(0, "-")))
             g_error("Bad start: %s\n", cp);
 
 	  aln->start = atoi(cp);
-          
+
 	  if ((len=strlen(cp)) > bc->maxStartLen)
 	    bc->maxStartLen = len;
-          
+
           char *tmpStr = g_strdup_printf("%d", aln->start);
 
 	  if (bc->maxStartLen < (tmp = strlen(tmpStr)))
 	    bc->maxStartLen = tmp;
-                                   
+
           g_free(tmpStr);
           tmpStr = NULL;
 
 	  if (!(cp = strtok(0, " ")))
 	    g_error("Bad end: %s\n", cp);
-          
+
 	  aln->end = atoi(cp);
-          
+
 	  if ((len=strlen(cp)) > bc->maxEndLen)
 	    bc->maxEndLen = len;
-          
+
           tmpStr = g_strdup_printf("%d", aln->end);
-          
+
 	  if (bc->maxEndLen < (tmp = strlen(tmpStr)))
 	    bc->maxEndLen = tmp;
-    
+
           g_free(tmpStr);
           tmpStr = NULL;
-          
+
           int ip = 0;
 	  if (alignFind(bc->alignArr, aln, &ip))
 	    {
@@ -3159,12 +3160,12 @@ void readMatch(BelvuContext *bc, FILE *fil)
 	    g_error("Bad score: %s\n", cp);
 
 	  aln->score = atof(cp);
-          
+
           tmpStr = g_strdup_printf("%.1f", aln->score);
-          
+
 	  if ((len=strlen(tmpStr)) > bc->maxScoreLen)
 	    bc->maxScoreLen = len;
-          
+
           g_free(tmpStr);
           tmpStr = NULL;
 
@@ -3176,12 +3177,12 @@ void readMatch(BelvuContext *bc, FILE *fil)
 
 	  if ((cp = strchr(line, '\n')))
 	    *cp = 0 ;
-          
+
 	  rawseq = (char*)g_malloc(strlen(line)+1);
 	  strcpy(rawseq, line);
 
 	  /* Matching segments */
-          
+
 	  if (!fgets(line, MAXLENGTH, fil))
 	    break;
 
@@ -3193,7 +3194,7 @@ void readMatch(BelvuContext *bc, FILE *fil)
 	  inserts = countInserts(SegList);
 	  seq = (char*)g_malloc(bc->maxLen + inserts + 1);
 	  memset(seq, '.', bc->maxLen + inserts);
-	    
+
 	  orig_maxLen = bc->maxLen;
 
 	  /* Add first segment */
@@ -3202,7 +3203,7 @@ void readMatch(BelvuContext *bc, FILE *fil)
 	  seqp = seq + seg->start-1;
 	  seglen = seg->end - seg->start+1;
 	  strncpy(seqp, rawseq, seglen);
-	  seqp += seglen; 
+	  seqp += seglen;
 
 	  /* Add subsequent segments */
 	  insert_counter = 0;
@@ -3213,9 +3214,9 @@ void readMatch(BelvuContext *bc, FILE *fil)
 
 
 	      if (Query_gap > 0)
-		{ 
+		{
 		  strncpy(seqp, rawseq + seg->qend, Query_gap);
-		  seqp += Query_gap; 
+		  seqp += Query_gap;
 		}
 
 	      gap = Query_gap - Align_gap;
@@ -3243,12 +3244,12 @@ void readMatch(BelvuContext *bc, FILE *fil)
 
 	  aln->sequenceStr = g_string_new(seq);
           g_free(seq);
-          
+
 	  aln->color = RED;
 	  aln->nr = 0;
 
           g_array_append_val(bc->alignArr, aln);
-          
+
 	  done_one = 1;
 
 	} /* End of this matchSeq */
@@ -3271,32 +3272,32 @@ void checkAlignment(BelvuContext *bc)
 
   bc->maxNameLen = bc->maxStartLen = bc->maxEndLen = 0;
 
-  for (i = 0; i < (int)bc->alignArr->len; ++i) 
+  for (i = 0; i < (int)bc->alignArr->len; ++i)
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
 
-      if (!alnp->markup) 
+      if (!alnp->markup)
         {
           char *alnSeq = alnGetSeq(alnp);
-          
+
           /* Count residues */
-          for (cres = g = 0; g < bc->maxLen; g++) 
+          for (cres = g = 0; g < bc->maxLen; g++)
             {
-              if (alnSeq && isAlign(alnSeq[g]) && !isGap(alnSeq[g])) 
+              if (alnSeq && isAlign(alnSeq[g]) && !isGap(alnSeq[g]))
                 cres++;
 	    }
-	    
-          if (!alnp->start) 
+
+          if (!alnp->start)
             {
               /* No coords provided - reconstruct them */
               alnp->start = 1;
               alnp->end = cres;
 	    }
-          else 
+          else
             {
               /* Check if provided coordinates are correct */
               nres = abs(alnp->end - alnp->start) + 1;
-              
+
               if ( nres != cres)
                 {
                   g_warning("Found wrong number of residues in %s/%d-%d: %d instead of %d\n",
@@ -3312,8 +3313,8 @@ void checkAlignment(BelvuContext *bc)
         bc->maxNameLen = strlen(alnp->name);
 
       char *tmpStr = g_strdup_printf("%d", alnp->start);
-      
-      if (bc->maxStartLen < (tmp = strlen(tmpStr))) 
+
+      if (bc->maxStartLen < (tmp = strlen(tmpStr)))
         bc->maxStartLen = tmp;
 
       g_free(tmpStr);
@@ -3321,10 +3322,10 @@ void checkAlignment(BelvuContext *bc)
 
       tmpStr= g_strdup_printf("%d", alnp->end);
 
-      if (bc->maxEndLen   < (tmp = strlen(tmpStr))) 
+      if (bc->maxEndLen   < (tmp = strlen(tmpStr)))
         bc->maxEndLen = tmp;
     }
-}    
+}
 
 
 static void initConservMtx(BelvuContext *bc)
@@ -3333,8 +3334,8 @@ static void initConservMtx(BelvuContext *bc)
 
   bc->conservCount = (int **)g_malloc(21*sizeof(int *));
   bc->colorMap = (int **)g_malloc(21*sizeof(int *));
-    
-  for (i = 0; i < 21; ++i) 
+
+  for (i = 0; i < 21; ++i)
     {
       bc->conservCount[i] = (int *)g_malloc(bc->maxLen*sizeof(int));
       bc->colorMap[i] = (int *)g_malloc(bc->maxLen*sizeof(int));
@@ -3342,18 +3343,18 @@ static void initConservMtx(BelvuContext *bc)
 
   bc->conservResidues = (int*)g_malloc(bc->maxLen*sizeof(int));
   bc->conservation = (double*)g_malloc(bc->maxLen*sizeof(double));
-}	
+}
 
 
 /* This populates conservCount (the count of how many of each residue there is
  * in each column) and conservResidues (the count of how many residues in total
- * there are in each column). 
+ * there are in each column).
  * Returns: the total number of sequences (excluding markup lines) */
 static int countResidueFreqs(BelvuContext *bc)
 {
   int   i, j, totalNumSeqs=0;
 
-  if (!bc->conservCount) 
+  if (!bc->conservCount)
     initConservMtx(bc);
 
     /* Must reset since this routine may be called many times */
@@ -3364,14 +3365,14 @@ static int countResidueFreqs(BelvuContext *bc)
           bc->conservCount[j][i] = 0;
           bc->colorMap[j][i] = 0;
         }
-      
+
       bc->conservResidues[i] = 0;
     }
-    
+
   for (j = 0; j < (int)bc->alignArr->len; ++j)
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, j);
-      
+
       if (alnp->markup)
         continue;
 
@@ -3393,7 +3394,7 @@ static int countResidueFreqs(BelvuContext *bc)
 }
 
 
-/* Calculate overhang between two aligned sequences 
+/* Calculate overhang between two aligned sequences
    Return nr of residues at the ends unique to s1 (overhanging s2).
 */
 static int alnOverhang(char *s1, char *s2)
@@ -3403,21 +3404,21 @@ static int alnOverhang(char *s1, char *s2)
     s2started = 0;
   char *s1save = s1, *s2save = s2;
 
-  for (; *s1 && *s2; s1++, s2++) 
+  for (; *s1 && *s2; s1++, s2++)
     {
       if (!isGap(*s1)) s1started = 1;
       if (!isGap(*s2)) s2started = 1;
       if (s1started && !s2started) overhang++;
-    }	
-  
+    }
+
   s1--; s2--;
   s1started = s2started = 0;
-  for (; s1>=s1save && s2>=s2save; s1--, s2--) 
+  for (; s1>=s1save && s2>=s2save; s1--, s2--)
     {
       if (!isGap(*s1)) s1started = 1;
       if (!isGap(*s2)) s2started = 1;
       if (s1started && !s2started) overhang++;
-    }	
+    }
 
   /* printf ("%s\n%s\nOverhang=%d\n", s1save, s2save, overhang);*/
 
@@ -3441,41 +3442,41 @@ void rmColumn(BelvuContext *bc, const int from, const int to)
 {
   int
     i=0, j=0, len = to - from + 1;
-  ALN 
+  ALN
     *alni=NULL;
-  
+
   g_message_info("Removing Columns %d-%d.\n", from, to);
 
-  for (i = 0; i < (int)bc->alignArr->len; i++) 
+  for (i = 0; i < (int)bc->alignArr->len; i++)
     {
       alni = g_array_index(bc->alignArr, ALN*, i);
       char *alnSeq = alnGetSeq(alni);
 
       /* If N or C terminal trim, change the coordinates */
       if (from == 1)
-        for (j = from; j <= to;  j++) 
+        for (j = from; j <= to;  j++)
           {
             /* Only count real residues */
-            
+
             if (!isGap(alnSeq[j-1]))
-              (alni->start < alni->end ? alni->start++ : alni->start--); 
+              (alni->start < alni->end ? alni->start++ : alni->start--);
           }
 
       if (to == bc->maxLen)
-        for (j = from; j <= to;  j++) 
+        for (j = from; j <= to;  j++)
           {
             /* Only count real residues */
             if (!isGap(alnSeq[j-1]))
-              (alni->start < alni->end ? alni->end-- : alni->end++); 
+              (alni->start < alni->end ? alni->end-- : alni->end++);
           }
-	
+
       /* Remove the columns */
-      for (j = 0; j < bc->maxLen-to+1 /* Including terminator 0 */;  j++) 
+      for (j = 0; j < bc->maxLen-to+1 /* Including terminator 0 */;  j++)
         {
           alnSeq[from+j-1] = alnSeq[to+j];
 	}
       j--;
-      
+
       if (alnSeq[from+j-1] || alnSeq[to+j])
         g_warning("Still a bug in rmColumn(): End=%c, Oldend=%c\n", alnSeq[from+j-1], alnSeq[to+j]);
     }
@@ -3489,42 +3490,42 @@ void rmColumn(BelvuContext *bc, const int from, const int to)
 /* Remove columns whose conservation is below the given cutoff */
 void rmColumnCutoff(BelvuContext *bc, const double from, const double to)
 {
-  int 
+  int
     i, j, max, removed=0, oldmaxLen=bc->maxLen;
   static double cons ;
-  
-  
-  for (i = bc->maxLen-1; i >= 0; i--) 
+
+
+  for (i = bc->maxLen-1; i >= 0; i--)
     {
-      if (colorBySimilarity(bc)) 
+      if (colorBySimilarity(bc))
         {
           cons = bc->conservation[i];
         }
-      else 
+      else
         {
           max = 0;
           for (j = 1; j < 21; j++)
             {
-              if (bc->conservCount[j][i] > max) 
+              if (bc->conservCount[j][i] > max)
                 {
                   max = bc->conservCount[j][i];
                 }
-            }	
+            }
           cons = (double)max / bc->alignArr->len;
         }
-      
-      if (cons > from && cons <= to) 
+
+      if (cons > from && cons <= to)
         {
           g_message("removing %d, cons= %.2f\n", i+1, cons);
           rmColumn(bc, i+1, i+1);
-          if (++removed == oldmaxLen) 
+          if (++removed == oldmaxLen)
             {
               g_critical("You have removed all columns.  Prepare to exit Belvu\n");
               exit(EXIT_SUCCESS);
             }
         }
     }
-  
+
   bc->saved = FALSE;
   rmFinaliseColumnRemoval(bc);
 }
@@ -3534,36 +3535,36 @@ void rmEmptyColumns(BelvuContext *bc, double cutoff)
 {
   int
     i=0, j=0, gaps=0, totseq=0, removed=0, oldmaxLen=bc->maxLen;
-  ALN 
+  ALN
     *alni=NULL;
   char
     c='\0';
 
-  for (totseq = i = 0; i < (int)bc->alignArr->len; ++i) 
+  for (totseq = i = 0; i < (int)bc->alignArr->len; ++i)
     {
       alni = g_array_index(bc->alignArr, ALN*, i);
-      
-      if (!alni->markup) 
+
+      if (!alni->markup)
         totseq++;
     }
 
-  for (j = bc->maxLen-1; j >= 0; j--) 
+  for (j = bc->maxLen-1; j >= 0; j--)
     {
-      for (gaps = i = 0; i < (int)bc->alignArr->len; i++) 
+      for (gaps = i = 0; i < (int)bc->alignArr->len; i++)
         {
           alni = g_array_index(bc->alignArr, ALN*, i);
           char *alnSeq = alnGetSeq(alni);
-          
-          if (!alni->markup) 
+
+          if (!alni->markup)
             {
               c = alnSeq[j];
-              
-              if (isGap(c) || c == ' ') 
+
+              if (isGap(c) || c == ' ')
                 gaps++;
 	    }
 	}
-      
-      if ((double)gaps/totseq >= cutoff - MACHINE_RES) 
+
+      if ((double)gaps/totseq >= cutoff - MACHINE_RES)
         {
           rmColumn(bc, j+1, j+1);
           if (++removed == oldmaxLen)
@@ -3581,26 +3582,26 @@ void greyOutInvalidActionsForGroup(BelvuContext *bc, GtkActionGroup *action_grou
 {
   if (!action_group)
     return;
-  
+
   enableMenuAction(action_group, "Output", bc->displayScores);
   enableMenuAction(action_group, "rmScore", bc->displayScores);
   enableMenuAction(action_group, "scoreSort", bc->displayScores);
-  
+
   enableMenuAction(action_group, "toggleColorByResId", !colorByConservation(bc));
   enableMenuAction(action_group, "colorByResId", !colorByConservation(bc));
   enableMenuAction(action_group, "saveColorScheme", !colorByConservation(bc));
   enableMenuAction(action_group, "loadColorScheme", !colorByConservation(bc));
-  
+
   enableMenuAction(action_group, "colorSchemeCustom", bc->haveCustomColors);
-  
+
   /* ignoreGaps used to be greyed out in old belvu when in color-by-residue
    * mode; it does affect the display when in that mode if using a %ID
-   * threshold, though, so it should probably be enabled (or alternatively the 
-   * logic should be adjusted so that it does not affect the residue colors, if 
+   * threshold, though, so it should probably be enabled (or alternatively the
+   * logic should be adjusted so that it does not affect the residue colors, if
    * that was the intent...) */
   /* enableMenuAction(action_group, "ignoreGaps", colorByConservation(bc)); */
   enableMenuAction(action_group, "printColors", colorByConservation(bc));
-  
+
   enableMenuAction(action_group, "excludeHighlighted", bc->selectedAln != NULL);
 }
 
@@ -3611,7 +3612,7 @@ void greyOutInvalidActions(BelvuContext *bc)
   /* Need to do the action groups for the main window and the tree (wrapped
    * windows currently don't have anything that gets greyed out but if they
    * do in future they will need updating here too) */
-  
+
   GtkActionGroup *actionGroup = belvuWindowGetActionGroup(bc->belvuWindow);
   greyOutInvalidActionsForGroup(bc, actionGroup);
 
@@ -3629,12 +3630,12 @@ void belvuContextSetTree(BelvuContext *bc, Tree **tree)
       /* We don't destroy the actual tree struct because there may be pointers
        * to it from other places; instead, we just replace its contents. */
       destroyTreeContents(bc->mainTree);
-      
+
       if (tree && *tree)
         {
           bc->mainTree->head = (*tree)->head;
           g_free(*tree);
-          
+
           /* Update input pointer so that it points to the tree that actually
            * got set. */
           *tree = bc->mainTree;
@@ -3648,25 +3649,25 @@ void belvuContextSetTree(BelvuContext *bc, Tree **tree)
     {
       bc->mainTree = NULL;
     }
-  
+
   /* Whether a tree exists affects whether some menu items are greyed out */
   greyOutInvalidActions(bc);
 }
 
 
 /* This function should be called after removing sequences or columns */
-static void rmFinalise(BelvuContext *bc) 
+static void rmFinalise(BelvuContext *bc)
 {
   /*    ruler[maxLen] = 0;*/
   checkAlignment(bc);
   setConsSchemeColors(bc);
-  
+
   /* Removing seqs/cols invalidates the tree, so set the tree head to NULL. */
   belvuContextSetTree(bc, NULL);
-  
+
   /* Removing seqs/cols invalidates the conservation plot, so recalculate it */
   belvuConsPlotRecalcAll(bc->consPlot);
-  
+
   /* Removing sequences can change the size of the columns in the alignment view,
    * so recalculate them */
   updateHeaderColumnsSize(bc->belvuAlignment);
@@ -3681,23 +3682,23 @@ void rmPartialSeqs(BelvuContext *bc)
   int i=0, n=0;
   ALN *alni = NULL;
 
-  for (i = 0; i < (int)bc->alignArr->len; ) 
+  for (i = 0; i < (int)bc->alignArr->len; )
     {
       alni = g_array_index(bc->alignArr, ALN*, i);
       char *alnSeq = alnGetSeq(alni);
-      
-      if (isGap(alnSeq[0]) || isGap(alnSeq[bc->maxLen-1])) 
+
+      if (isGap(alnSeq[0]) || isGap(alnSeq[bc->maxLen-1]))
         {
           /* Remove entry */
           n++;
 
-          if (bc->selectedAln == alni) 
+          if (bc->selectedAln == alni)
             bc->selectedAln = 0;
-          
+
           g_array_remove_index(bc->alignArr, i);
           bc->saved = 0;
 	}
-      else 
+      else
         {
           ++i;
         }
@@ -3717,27 +3718,27 @@ void rmGappySeqs(BelvuContext *bc, const double cutoff)
   int i=0, j=0, n=0, gaps;
   ALN *alni = NULL;
 
-  for (i = 0; i < (int)bc->alignArr->len; ) 
+  for (i = 0; i < (int)bc->alignArr->len; )
     {
       alni = g_array_index(bc->alignArr, ALN*, i);
       char *alnSeq = alnGetSeq(alni);
 
       for (gaps = j = 0; j < bc->maxLen; j++)
-        if (isGap(alnSeq[j])) 
+        if (isGap(alnSeq[j]))
           gaps++;
 
-      if ((double)gaps/bc->maxLen >= cutoff/100.0) 
+      if ((double)gaps/bc->maxLen >= cutoff/100.0)
         {
           /* Remove entry */
           n++;
-          
-          if (bc->selectedAln == alni) 
+
+          if (bc->selectedAln == alni)
             bc->selectedAln = 0;
-          
+
           g_array_remove_index(bc->alignArr, i);
           bc->saved = 0;
 	}
-      else 
+      else
 	{
 	  i++;
 	}
@@ -3753,14 +3754,14 @@ void rmGappySeqs(BelvuContext *bc, const double cutoff)
  * is enabled. */
 void rmFinaliseGapRemoval(BelvuContext *bc)
 {
-  if (bc->rmEmptyColumnsOn) 
+  if (bc->rmEmptyColumnsOn)
     rmEmptyColumns(bc, 1.0);
-  
+
   rmFinalise(bc);
 }
 
 
-/* Get rid of seqs that are more than x% identical with others. 
+/* Get rid of seqs that are more than x% identical with others.
  * Keep the  first one.
  */
 void mkNonRedundant(BelvuContext *bc, const double cutoff)
@@ -3769,19 +3770,19 @@ void mkNonRedundant(BelvuContext *bc, const double cutoff)
   ALN *alni=NULL, *alnj=NULL;
   double id = 0.0;
 
-  for (i = 0; i < (int)bc->alignArr->len; i++) 
+  for (i = 0; i < (int)bc->alignArr->len; i++)
     {
       alni = g_array_index(bc->alignArr, ALN*, i);
       char *alniSeq = alnGetSeq(alni);
 
-      for (j = 0; j < (int)bc->alignArr->len; j++) 
+      for (j = 0; j < (int)bc->alignArr->len; j++)
         {
-          if (i == j) 
+          if (i == j)
             continue;
 
           alnj = g_array_index(bc->alignArr, ALN*, j);
           char *alnjSeq = alnGetSeq(alnj);
-	    
+
           overhang = alnOverhang(alnjSeq, alniSeq);
           id = percentIdentity(alniSeq, alnjSeq, bc->penalize_gaps);
 
@@ -3792,17 +3793,17 @@ void mkNonRedundant(BelvuContext *bc, const double cutoff)
                              alni->name, alni->start, alni->end,
                              alnj->name, alnj->start, alnj->end,
                              id);
-		
+
               /* Remove entry j */
               n++;
-		
-              if (bc->selectedAln == alnj) 
+
+              if (bc->selectedAln == alnj)
                 bc->selectedAln = NULL;
-              
+
               g_array_remove_index(bc->alignArr, j);
               bc->saved = FALSE;
-              
-              if (j < i) 
+
+              if (j < i)
                 {
                   i--;
                   alni = g_array_index(bc->alignArr, ALN*, i);
@@ -3813,58 +3814,58 @@ void mkNonRedundant(BelvuContext *bc, const double cutoff)
     }
 
   g_message_info("%d sequences removed at the %.0f%% level.  %d seqs left.\n\n", n, cutoff, bc->alignArr->len);
-  
+
   arrayOrder(bc->alignArr);
   rmFinaliseGapRemoval(bc);
 }
 
 
-/* Get rid of seqs that are less than x% identical with any of the others. 
+/* Get rid of seqs that are less than x% identical with any of the others.
  */
 void rmOutliers(BelvuContext *bc, const double cutoff)
 {
   int i=0,j=0, n=0;
   ALN *alni=NULL, *alnj=NULL;
-  
-  for (i = 0; i < (int)bc->alignArr->len - 1; ) 
+
+  for (i = 0; i < (int)bc->alignArr->len - 1; )
     {
       alni = g_array_index(bc->alignArr, ALN*, i);
-    
+
       double maxid = 0;
-      for (maxid=0, j = 0; j < (int)bc->alignArr->len; ++j) 
+      for (maxid=0, j = 0; j < (int)bc->alignArr->len; ++j)
 	{
-	  if (i == j) 
+	  if (i == j)
 	    continue;
-	
+
 	  alnj = g_array_index(bc->alignArr, ALN*, j);
 	  double id = percentIdentity(alnGetSeq(alni), alnGetSeq(alnj), bc->penalize_gaps);
-	
-	  if (id > maxid) 
+
+	  if (id > maxid)
 	    maxid = id;
 	}
-    
-      if (maxid < cutoff) 
+
+      if (maxid < cutoff)
 	{
 	  g_message("%s/%d-%d was max %.1f%% identical to any other sequence and was removed.\n",
 		    alni->name, alni->start, alni->end, maxid);
-	
+
 	  /* Remove entry */
 	  n++;
-	
-	  if (bc->selectedAln == alni) 
+
+	  if (bc->selectedAln == alni)
 	    bc->selectedAln = NULL;
-	
+
 	  g_array_remove_index(bc->alignArr, i);
 	  bc->saved = FALSE;
 	}
-      else 
+      else
 	{
 	  i++;
 	}
     }
-  
+
   g_message("%d sequences removed at the %.0f%% level.  %d seqs left.\n\n", n, cutoff, bc->alignArr->len);
-  
+
   arrayOrder(bc->alignArr);
   rmFinaliseGapRemoval(bc);
 }
@@ -3874,31 +3875,31 @@ void rmOutliers(BelvuContext *bc, const double cutoff)
 void rmScore(BelvuContext *bc, const double cutoff)
 {
   scoreSort(bc);
-  
+
   /* Save bc->selectedAln */
   ALN aln;
   initAln(&aln);
-  
+
   if (bc->selectedAln)
     alncpy(&aln, bc->selectedAln);
-  
+
   int numRemoved = 0;
   int i = 0;
-  
-  for (i = 0; i < (int)bc->alignArr->len; ) 
+
+  for (i = 0; i < (int)bc->alignArr->len; )
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
-    
-      if (alnp->score < cutoff) 
-	{ 
+
+      if (alnp->score < cutoff)
+	{
 	  ++numRemoved;
-	  
+
 	  g_message_info("Removing %s/%d-%d (score %.1f)\n",
                          alnp->name, alnp->start, alnp->end, alnp->score);
-	
-	  if (bc->selectedAln == alnp) 
+
+	  if (bc->selectedAln == alnp)
 	    bc->selectedAln = NULL;
-	  
+
 	  g_array_remove_index(bc->alignArr, i);
 	  bc->saved = FALSE;
 	}
@@ -3907,19 +3908,19 @@ void rmScore(BelvuContext *bc, const double cutoff)
 	  i++;
 	}
     }
-  
+
   arrayOrder(bc->alignArr);
-  
+
   g_message_info("%d sequences with score < %.1f removed.  %d seqs left.\n\n", numRemoved, cutoff, bc->alignArr->len);
-  
+
   /* Find bc->selectedAln in new array */
-  if (bc->selectedAln) 
-    { 
+  if (bc->selectedAln)
+    {
       int ip = 0;
       ALN aln;
       initAln(&aln);
-      
-      if (!alnArrayFind(bc->alignArr, &aln, &ip, scoreorder)) 
+
+      if (!alnArrayFind(bc->alignArr, &aln, &ip, scoreorder))
 	{
 	  bc->selectedAln = NULL;
 	}
@@ -3928,9 +3929,9 @@ void rmScore(BelvuContext *bc, const double cutoff)
 	  bc->selectedAln = g_array_index(bc->alignArr, ALN*, ip);
 	}
   }
-  
+
   bc->alignYStart = 0;
-  
+
   rmFinaliseGapRemoval(bc);
 }
 
@@ -3942,17 +3943,17 @@ void rmScore(BelvuContext *bc, const double cutoff)
 /* Save the given tree to the given file in New Hampshire format */
 void saveTreeNH(Tree *tree, TreeNode *node, FILE *file)
 {
-  if (!node) 
+  if (!node)
     return;
-  
-  if (node->left && node->right) 
+
+  if (node->left && node->right)
     {
       fprintf(file, "(\n");
       saveTreeNH(tree, node->left, file);
       fprintf(file, ",\n");
       saveTreeNH(tree, node->right, file);
       fprintf(file, ")\n");
-      
+
       if (node != tree->head)	/* Not exactly sure why this is necessary, but njplot crashes otherwise */
         fprintf(file, "%.0f", node->boot+0.5);
     }
@@ -3960,7 +3961,7 @@ void saveTreeNH(Tree *tree, TreeNode *node, FILE *file)
     {
       fprintf(file, "%s", node->name);
     }
-  
+
   if (node != tree->head)	/* Not exactly sure why this is necessary, but njplot crashes otherwise */
     fprintf(file, ":%.3f", node->branchlen/100.0);
 }
@@ -3971,25 +3972,25 @@ void writeMSF(BelvuContext *bc, FILE *pipe) /* c = separator between name and co
   int i=0, j=0;
   int maxfullnamelen = bc->maxNameLen + 1 + bc->maxStartLen + 1 + bc->maxEndLen;
   int paragraph=0, alnstart=0, alnend=0, alnlen=0, linelen=50, blocklen=10;
-  
+
   if (bc->saveCoordsOn)
     maxfullnamelen = bc->maxNameLen + 1 + bc->maxStartLen + 1 + bc->maxEndLen;
   else
     maxfullnamelen = bc->maxNameLen;
-  
+
   /* Title */
   fprintf(pipe, "PileUp\n\n %s  MSF: %d  Type: X  Check: %d  ..\n\n",
           bc->Title, bc->maxLen, GCGgrandchecksum(bc));
 
   /* Names and checksums */
-  for(i=0; i < (int)bc->alignArr->len; ++i) 
+  for(i=0; i < (int)bc->alignArr->len; ++i)
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
-      
-      if (alnp->markup) 
+
+      if (alnp->markup)
         continue;
 
-      char *tmpStr = bc->saveCoordsOn 
+      char *tmpStr = bc->saveCoordsOn
         ? g_strdup_printf("%s%c%d-%d", alnp->name, bc->saveSeparator, alnp->start, alnp->end)
         : g_strdup_printf("%s", alnp->name);
 
@@ -4002,7 +4003,7 @@ void writeMSF(BelvuContext *bc, FILE *pipe) /* c = separator between name and co
 
       g_free(tmpStr);
     }
-  
+
   fprintf(pipe, "\n//\n\n");
 
   /* Alignment */
@@ -4010,42 +4011,42 @@ void writeMSF(BelvuContext *bc, FILE *pipe) /* c = separator between name and co
     {
       for (i = 0; i < (int)bc->alignArr->len; ++i)
 	{
-          alnstart = paragraph * linelen; 
+          alnstart = paragraph * linelen;
           alnlen = ( (paragraph+1)*linelen < bc->maxLen ? linelen : bc->maxLen - alnstart );
           alnend = alnstart + alnlen;
 
           ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
-          
-          if (alnp->markup) 
+
+          if (alnp->markup)
             continue;
 
-          char *tmpStr = bc->saveCoordsOn 
+          char *tmpStr = bc->saveCoordsOn
             ? g_strdup_printf("%s%c%d-%d", alnp->name, bc->saveSeparator, alnp->start, alnp->end)
             : g_strdup_printf("%s", alnp->name);
-          
+
           fprintf(pipe, "%-*s  ", maxfullnamelen, tmpStr);
           g_free(tmpStr);
-          
-          for (j = alnstart; j < alnend; ) 
+
+          for (j = alnstart; j < alnend; )
             {
               char *alnpSeq = alnGetSeq(alnp);
               fprintf(pipe, "%c", alnpSeq[j]);
               j++;
-              
-              if ( !((j-alnstart) % blocklen) ) 
+
+              if ( !((j-alnstart) % blocklen) )
                 fprintf(pipe, " ");
 	    }
-          
+
           fprintf(pipe, "\n");
 	}
-      
+
       fprintf(pipe, "\n");
       paragraph++;
     }
 
   fclose(pipe);
   fflush(pipe);
-  
+
   bc->saved = TRUE;
 }
 
@@ -4056,31 +4057,31 @@ static void readMSF(BelvuContext *bc, FILE *pipe)
   char line[MAXLENGTH + 1];
   line[0] = 0;
   seq[0] = 0;
-  
+
   g_message_info("\nDetected MSF format\n");
 
   /* Read sequence names */
   while (!feof (pipe))
-    { 
-      if (!fgets (line, MAXLENGTH, pipe)) 
+    {
+      if (!fgets (line, MAXLENGTH, pipe))
         break;
 
-      if (!strncmp(line, "//", 2)) 
+      if (!strncmp(line, "//", 2))
         {
           break;
         }
-      else if (strstr(line, "Name:") && (cp = strstr(line, "Len:")) && strstr(line, "Check:")) 
+      else if (strstr(line, "Name:") && (cp = strstr(line, "Len:")) && strstr(line, "Check:"))
 	{
           int len;
 
           sscanf(cp+4, "%d", &len);
 
-          if (bc->maxLen < len) 
+          if (bc->maxLen < len)
             bc->maxLen = len;
 
           cp = strstr(line, "Name:")+6;
-          
-          while (*cp && *cp == ' ') 
+
+          while (*cp && *cp == ' ')
             cp++;
 
           /* Read sequence name and coords */
@@ -4089,7 +4090,7 @@ static void readMSF(BelvuContext *bc, FILE *pipe)
 
           /* Create a string to contain the sequence data */
           aln->sequenceStr = g_string_new("");
-          
+
           /* Add to the array */
           aln->nr = bc->alignArr->len + 1;
 
@@ -4100,27 +4101,27 @@ static void readMSF(BelvuContext *bc, FILE *pipe)
 
   /* Read sequence alignment */
   while (!feof (pipe))
-    { 
-      if (!fgets (line, MAXLENGTH, pipe)) 
+    {
+      if (!fgets (line, MAXLENGTH, pipe))
         break;
 
       cp = line;
       cq = seq;
       while (*cp && *cp == ' ') cp++;
       while (*cp && *cp != ' ') cp++; /* Spin to sequence */
-      
-      while (*cp && cq-seq < 1000) 
+
+      while (*cp && cq-seq < 1000)
         {
           if (isAlign(*cp)) *cq++ = *cp;
           cp++;
 	}
-	
+
       *cq = 0;
 
-      if (*seq) 
+      if (*seq)
         {
           cp = line;
-          while (*cp && *cp == ' ') 
+          while (*cp && *cp == ' ')
             cp++;
 
           /* Get the name of the sequence  */
@@ -4142,7 +4143,7 @@ static void readMSF(BelvuContext *bc, FILE *pipe)
             }
 	}
     }
-  
+
   bc->saveFormat = BELVU_FILE_MSF;
 }
 
@@ -4158,54 +4159,54 @@ static void parseMulAnnotationLine(BelvuContext *bc, const char *seqLine)
     *labelp,		/* Label (OS) */
     *valuep;		/* Organism (c. elegans) */
 
-  
+
   /* Ignore anything that's not a 'GS' line */
   if (strncmp(cp, "#=GS", 4) != 0)
     return;
-      
+
   /* Copy the portion after  the '#=GS' into 'name' */
   strcpy(name, cp+4);
   namep = name;
-  
+
   /* Ignore leading whitespace */
-  while (*namep == ' ') 
+  while (*namep == ' ')
     namep++;
-      
+
   /* Find the end of the name */
   labelp = namep;
-  while (*labelp != ' ') 
+  while (*labelp != ' ')
     labelp++;
-  
+
   *labelp = 0;		/* Terminate namep */
   ++labelp;		/* Walk across terminator */
-  
+
   while (*labelp == ' ') /* Find the start of the label */
     ++labelp;
-      
+
   valuep = labelp;
   while (*valuep != ' ') valuep++; /* Find the end of the label */
   while (*valuep == ' ') valuep++; /* Find the start of the value */
-  
+
   if (strncasecmp(labelp, "LO", 2) == 0)
     {
       int i, colornr;
-      
+
       /* Check the value to see if it matches one of our colour names */
       for (colornr = -1, i = 0; i < NUM_TRUECOLORS; i++)
         {
-          if (strcasecmp(colorNames[i], valuep) == 0) 
+          if (strcasecmp(colorNames[i], valuep) == 0)
             {
               colornr = i;
               break;
             }
         }
-      
+
       if (colornr == -1)
         {
           g_message("Unrecognized color: %s\n", valuep);
           colornr = 0;
         }
-          
+
       /* Create an ALN struct from the name */
       ALN aln;
       initAln(&aln);
@@ -4217,16 +4218,16 @@ static void parseMulAnnotationLine(BelvuContext *bc, const char *seqLine)
           g_critical("Cannot find '%s' [%d %d] in alignment.\n", aln.name, aln.start, aln.end);
           return;
         }
-      
+
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
       alnp->color = colornr;
     }
   else if (strncasecmp(labelp, bc->organismLabel, 2) == 0)
     {
-      /* Add organism to table of organisms.  This is necessary to make all 
-         sequences of the same organism point to the same place and to make a 
+      /* Add organism to table of organisms.  This is necessary to make all
+         sequences of the same organism point to the same place and to make a
          non-redundant list of present organisms */
-      
+
       /* Find string in permanent stack */
       const char *valuepconst = strstr(cp, valuep);
 
@@ -4237,10 +4238,10 @@ static void parseMulAnnotationLine(BelvuContext *bc, const char *seqLine)
         }
 
       valuep = strdup(valuepconst);
-      
+
       /* Create an ALN struct from this organism */
       ALN *aln = createEmptyAln();
-      
+
       aln->organism = valuep; /* Find organism string in permanent stack */
 
       /* Add to organisms array, if not already there */
@@ -4249,47 +4250,47 @@ static void parseMulAnnotationLine(BelvuContext *bc, const char *seqLine)
         {
           g_array_append_val(bc->organismArr, aln);
           g_array_sort(bc->organismArr, organism_order);
-          
+
           /* Set the max organism name length */
           int organismLen = strlen(aln->organism);
 
           if (organismLen > bc->maxOrganismLen)
             bc->maxOrganismLen = organismLen ;
         }
- 
+
       if (strchr(cp, '/') && strchr(cp, '-'))
         {
           str2aln(bc, namep, aln);
-              
+
           /* Find the corresponding sequence */
           int ip = 0;
-          
-          if (!alnArrayFind(bc->alignArr, aln, &ip, alphaorder)) 
+
+          if (!alnArrayFind(bc->alignArr, aln, &ip, alphaorder))
             {
               g_critical("Cannot find '%s' [%d %d] in alignment.\n", aln->name, aln->start, aln->end);
               return;
             }
-             
+
           ALN *alnp = g_array_index(bc->alignArr, ALN*, ip);
-              
+
           /* Store pointer to unique organism in ALN struct */
           aln->organism = valuep;
           ip = 0;
-          
+
           alnArrayFind(bc->organismArr, aln, &ip, organism_order);
           alnp->organism = g_array_index(bc->organismArr, ALN*, ip)->organism;
         }
-      else 
+      else
         {
           /* Organism specified for entire sequences.
              Find all ALN instances of this sequences.
           */
           int i = 0;
-          for (i = 0; i < (int)bc->alignArr->len; ++i) 
+          for (i = 0; i < (int)bc->alignArr->len; ++i)
             {
               ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
 
-              if (strcmp(alnp->name, namep) == 0) 
+              if (strcmp(alnp->name, namep) == 0)
                 {
                   /* Store pointer to unique organism in ALN struct */
                   ALN aln;
@@ -4323,7 +4324,7 @@ static void appendSequenceDataToAln(BelvuContext *bc, char *line, const int alns
       /* Append this bit of sequence to the existing alignment */
       ALN *alnp = g_array_index(bc->alignArr, ALN*, ip);
       g_string_append(alnp->sequenceStr, line + alnstart);
-      
+
       /* Recalculate the max alignment length */
       if ((int)alnp->sequenceStr->len > bc->maxLen)
         bc->maxLen = alnp->sequenceStr->len;
@@ -4333,13 +4334,13 @@ static void appendSequenceDataToAln(BelvuContext *bc, char *line, const int alns
       /* Create a new alignment and add this bit of sequence */
       ALN *alnp = createEmptyAln();
       alncpy(alnp, &aln);
-      
+
       alnp->sequenceStr = g_string_new(line + alnstart);
       alnp->nr = bc->alignArr->len + 1;
-      
+
       g_array_append_val(bc->alignArr, alnp);
       g_array_sort(bc->alignArr, alphaorder);
-      
+
       /* Recalculate the max alignment length */
       if ((int)alnp->sequenceStr->len > bc->maxLen)
         bc->maxLen = alnp->sequenceStr->len;
@@ -4347,7 +4348,7 @@ static void appendSequenceDataToAln(BelvuContext *bc, char *line, const int alns
 }
 
 
-/* ReadMul 
+/* ReadMul
  * parses an alignment file in mul (stockholm) or selex format and puts it in the Align array
  *
  * Assumes header contains ' ' or '#'
@@ -4366,17 +4367,17 @@ static void readMul(BelvuContext *bc, FILE *pipe)
 
   /* Read raw alignment into stack
    *******************************/
-  
+
   int alnstart = MAXLENGTH;
   GSList *alnList = NULL;
-  
+
   while (!feof (pipe))
-    { 
+    {
       /* EOF checking to make acedb calling work */
-      if (!fgets (line, MAXLENGTH, pipe) || (unsigned char)*line == (unsigned char)EOF ) 
+      if (!fgets (line, MAXLENGTH, pipe) || (unsigned char)*line == (unsigned char)EOF )
         break;
-      
-      if (!strncmp(line, "PileUp", 6)) 
+
+      if (!strncmp(line, "PileUp", 6))
         {
           readMSF(bc, pipe);
           return;
@@ -4384,7 +4385,7 @@ static void readMul(BelvuContext *bc, FILE *pipe)
 
       /* Remove any trailing newline */
       char *cp = strchr(line, '\n');
-      if (cp) 
+      if (cp)
         *cp = 0;
 
       cp = strchr(line, '\r');
@@ -4397,18 +4398,18 @@ static void readMul(BelvuContext *bc, FILE *pipe)
 	{
           /* Sequence line */
           char *cq = strchr(line, ' ');
-          
-          if (!cq) 
+
+          if (!cq)
             g_error("Error reading selex file; no spacer between name and sequence in the following line:\n%s", line);
-          
+
           /* Find which column the alignment starts in */
           int i = 0;
           for (i = 0; line[i] && line[i] != ' '; ++i);
           for (; line[i] && !isAlign(line[i]); ++i);
-          
+
           /* Remember the leftmost start position of any alignment. We'll assume
            * all alignments start in the same column. */
-          if (i < alnstart) 
+          if (i < alnstart)
             alnstart = i;
 
           /* Remove optional accession number at end of alignment */
@@ -4420,39 +4421,39 @@ static void readMul(BelvuContext *bc, FILE *pipe)
           /* Store the line for processing later (once alnstart has been calculated) */
           alnList = g_slist_prepend(alnList, g_strdup(line));
 	}
-      else if (!strncmp(line, "#=GF ", 5) || 
-               !strncmp(line, "#=GS ", 5)) 
+      else if (!strncmp(line, "#=GF ", 5) ||
+               !strncmp(line, "#=GS ", 5))
         {
 	  /* Store all annotation lines in a list. Prepend the items because that
 	   * is more efficient, and then reverse the list at the end */
 	  bc->annotationList = g_slist_prepend(bc->annotationList, g_strdup(line));
         }
-      else if (!strncmp(line, "#=GC ", 5) || 
-               !strncmp(line, "#=GR ", 5) || 
-               !strncmp(line, "#=RF ", 5)) 
+      else if (!strncmp(line, "#=GC ", 5) ||
+               !strncmp(line, "#=GR ", 5) ||
+               !strncmp(line, "#=RF ", 5))
         {
           /* These are markup lines that are shown in the alignment list */
           alnList = g_slist_prepend(alnList, g_strdup(line));
         }
-      else if (!strncmp(line, "# matchFooter", 13)) 
+      else if (!strncmp(line, "# matchFooter", 13))
         {
           /* Match Footer  */
           bc->matchFooter = TRUE;
           break;
         }
     }
-  
+
   /* Reverse the lists, because we prepended items instead of appending them */
   bc->annotationList = g_slist_reverse(bc->annotationList);
   alnList = g_slist_reverse(alnList);
-  
+
   /* Loop through all of the alignment lines and extract the sequence string */
   GSList *alnItem = alnList;
   for ( ; alnItem; alnItem = alnItem->next)
     {
       char *alnStr = (char*)(alnItem->data);
       appendSequenceDataToAln(bc, alnStr, alnstart);
-      
+
       /* Free the line string, now we're done with it */
       g_free(alnStr);
       alnItem->data = NULL;
@@ -4468,45 +4469,45 @@ static void readMul(BelvuContext *bc, FILE *pipe)
       char *line = (char*)(annItem->data) ;
       parseMulAnnotationLine(bc, line);
     }
-  
+
 /* For debugging * /
    for (i = 0; i < nseq; i++) {
    alnp = arrp(Align, i, ALN);
-   printf("\n%-10s %4d %4d %s %d %s\n", 
-   alnp->name, alnp->start, alnp->end, alnp->seq, 
+   printf("\n%-10s %4d %4d %s %d %s\n",
+   alnp->name, alnp->start, alnp->end, alnp->seq,
    alnp->len, alnp->organism);
    }
-   for (i=0; i < arrayMax(organismArr); i++) 
+   for (i=0; i < arrayMax(organismArr); i++)
    printf("%s\n", arrp(organismArr, i, ALN)->organism);
    */
-  
-  if (bc->alignArr->len == 0 || bc->maxLen == 0) 
+
+  if (bc->alignArr->len == 0 || bc->maxLen == 0)
     g_error("Unable to read sequence data\n");
-  
+
   bc->saveFormat = BELVU_FILE_MUL;
 }
 
 
-/* 
- Format the name/start-end string 
- 
+/*
+ Format the name/start-end string
+
  For convenience, used by writeMul. Returns a newly allocated string
  which must be freed with g_free
  */
-static char *writeMulName(BelvuContext *bc, ALN *aln) 
-{  
+static char *writeMulName(BelvuContext *bc, ALN *aln)
+{
   char *name = NULL; /* result */
-  
+
   char *cp, *namep, GRname[MAXNAMESIZE*2+2], GRfeat[MAXNAMESIZE+1];
-  
-  if (aln->markup == GC) 
+
+  if (aln->markup == GC)
     {
       name = g_strdup_printf("#=GC %s", aln->name);
       return name;
     }
-  
+
   /* NOTE: GR lines have the feature concatenated in aln->name - must separate */
-  if (aln->markup == GR) 
+  if (aln->markup == GR)
     {
       namep = GRname;
       strncpy(namep, aln->name, 50);
@@ -4518,19 +4519,19 @@ static char *writeMulName(BelvuContext *bc, ALN *aln)
     {
       namep = aln->name;
     }
-  
-  if (!bc->saveCoordsOn) 
+
+  if (!bc->saveCoordsOn)
     {
       name = g_strdup_printf("%s", namep);
     }
-  else 
+  else
     {
       name = g_strdup_printf("%s%c%d-%d", namep, bc->saveSeparator, aln->start, aln->end);
     }
-  
+
   if (aln->markup == GR)
     name = g_strdup_printf("#=GR %s %s", name, GRfeat);
-  
+
   return name;
 }
 
@@ -4539,7 +4540,7 @@ void writeMul(BelvuContext *bc, FILE *fil)
 {
   /* Write Annotation */
   GSList *annotationItem = bc->annotationList;
-  
+
   for ( ; annotationItem; annotationItem = annotationItem->next)
     {
       const char *line = (const char*)(annotationItem->data);
@@ -4549,7 +4550,7 @@ void writeMul(BelvuContext *bc, FILE *fil)
   /* Find max width of name column */
   int i = 0;
   int maxWidth = 0;
-  
+
   for ( ; i < (int)bc->alignArr->len; ++i)
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
@@ -4557,25 +4558,25 @@ void writeMul(BelvuContext *bc, FILE *fil)
       char *mulName = writeMulName(bc, alnp);
       int curWidth = strlen(mulName);
       g_free(mulName);
-    
-      if ( curWidth > maxWidth) 
+
+      if ( curWidth > maxWidth)
 	maxWidth = curWidth;
     }
-    
+
   /* Write alignment */
   for (i = 0; i < (int)bc->alignArr->len; i++)
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
       char *mulName = writeMulName(bc, alnp);
       const char *alnpSeq = alnGetSeq(alnp);
-    
+
       fprintf(fil, "%-*s %s\n", maxWidth, mulName, (alnpSeq ? alnpSeq : ""));
-    
+
       g_free(mulName);
     }
-  
+
   fprintf(fil, "//\n");
-  
+
   fclose(fil);
   fflush(fil);
 
@@ -4583,8 +4584,8 @@ void writeMul(BelvuContext *bc, FILE *fil)
 }
 
 
-/* readFile 
- * Determines the format of the input file and calls the appropriate 
+/* readFile
+ * Determines the format of the input file and calls the appropriate
  * parser. Valid file formats are fasta, MSF, mul (stockholm) or selex.
  */
 void readFile(BelvuContext *bc, FILE *pipe)
@@ -4592,15 +4593,15 @@ void readFile(BelvuContext *bc, FILE *pipe)
   char   ch = '\0';
   char line[MAXLENGTH+1];
   line[0] = 0;
-  
+
   /* Parse header to check for MSF or Fasta format */
   while (!feof (pipe))
-    { 
+    {
       ch = fgetc(pipe);
-      
-      if (!isspace(ch)) 
+
+      if (!isspace(ch))
         {
-          if (ch == '>') 
+          if (ch == '>')
             {
               ungetc(ch, pipe);
               return readFastaAln(bc, pipe);
@@ -4612,16 +4613,16 @@ void readFile(BelvuContext *bc, FILE *pipe)
         }
       else if (ch == '\n')
         {
-          if (!fgets (line, MAXLENGTH, pipe)) 
+          if (!fgets (line, MAXLENGTH, pipe))
             break;
         }
-      
-      if (strstr(line, "MSF:") && strstr(line, "Type:") && strstr(line, "Check:")) 
+
+      if (strstr(line, "MSF:") && strstr(line, "Type:") && strstr(line, "Check:"))
         {
           return readMSF(bc, pipe);
         }
     }
-  
+
   if (!feof(pipe))
     ungetc(ch, pipe);
 
@@ -4634,18 +4635,18 @@ void writeFasta(BelvuContext *bc, FILE *pipe)
   int i=0, n=0;
   char *cp = NULL;
 
-  for (i = 0; i < (int)bc->alignArr->len; ++i) 
+  for (i = 0; i < (int)bc->alignArr->len; ++i)
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
-      
-      if (alnp->markup) 
+
+      if (alnp->markup)
         continue;
-	
+
       if (bc->saveCoordsOn)
         fprintf(pipe, ">%s%c%d-%d\n", alnp->name, bc->saveSeparator, alnp->start, alnp->end);
       else
         fprintf(pipe, ">%s\n", alnp->name);
-	
+
       for (n=0, cp = alnGetSeq(alnp); *cp; cp++)
         {
 	  if (bc->saveFormat == BELVU_FILE_ALIGNED_FASTA)
@@ -4655,27 +4656,27 @@ void writeFasta(BelvuContext *bc, FILE *pipe)
 	    }
           else
             {
-              if (!isGap(*cp)) 
+              if (!isGap(*cp))
                 {
                   fputc(*cp, pipe);
                   n++;
 		}
 	    }
-	    
-          if (n && !(n % 80) ) 
+
+          if (n && !(n % 80) )
             {
               fputc('\n', pipe);
               n = 0;
 	    }
 	}
-	
+
       if (n)
         fputc('\n', pipe);
     }
 
   fclose(pipe);
   fflush(pipe);
-  
+
   bc->saved = TRUE;
 }
 
@@ -4684,19 +4685,19 @@ static int getMatchStates(BelvuContext *bc)
 {
   int i=0, j=0, n=0, retval=0;
 
-  for (j = 0; j < bc->maxLen; ++j) 
+  for (j = 0; j < bc->maxLen; ++j)
     {
       n = 0;
-      for (i = 0; i < (int)bc->alignArr->len; ++i) 
+      for (i = 0; i < (int)bc->alignArr->len; ++i)
         {
           ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
           char *alnpSeq = alnGetSeq(alnp);
-          
-          if (isalpha(alnpSeq[j])) 
+
+          if (isalpha(alnpSeq[j]))
             n++;
 	}
-      
-      if (n > (int)bc->alignArr->len / 2) 
+
+      if (n > (int)bc->alignArr->len / 2)
         retval++;
     }
 
@@ -4720,10 +4721,10 @@ void outputProbs(BelvuContext *bc, FILE *fil)
      Asp (D) 5.29   His (H) 2.23   Phe (F) 4.06   Tyr (Y) 3.21
      Cys (C) 1.70   Ile (I) 5.72   Pro (P) 4.91   Val (V) 6.52
   */
-  
+
   double f_sean[21] = {
-    0.0, 
-    .08713, .03347, .04687, .04953, .03977, .08861, .03362, .03689, .08048, .08536, 
+    0.0,
+    .08713, .03347, .04687, .04953, .03977, .08861, .03362, .03689, .08048, .08536,
     .01475, .04043, .05068, .03826, .04090, .06958, .05854, .06472, .01049, .02992
   };
 
@@ -4731,7 +4732,7 @@ void outputProbs(BelvuContext *bc, FILE *fil)
   int i = 0, c[21], n=0, nmat = 0;
   char *cp = NULL;
 
-  for (i = 1; i <= 20; i++) 
+  for (i = 1; i <= 20; i++)
     c[i] = 0;
 
   for (i = 0; i < (int)bc->alignArr->len; ++i)
@@ -4752,22 +4753,22 @@ void outputProbs(BelvuContext *bc, FILE *fil)
   if (!n)
     g_error("No residues found\n");
 
-  if (0) 
+  if (0)
     {
       nmat = getMatchStates(bc);	/* Approximation, HMM may differ slightly */
 
-      if (!nmat) 
+      if (!nmat)
         g_error("No match state columns found\n");
-      
+
       g_message("Amino\n");
-      
-      for (i = 1; i <= 20; i++) 
+
+      for (i = 1; i <= 20; i++)
         {
           /* One way:  p = ((double)c[i]/nmat + 20*f_sean[i]) / (double)(n/nmat+20);*/
           /* Other way: */
           p = ((double)c[i] + 20*f_sean[i]) / (double)(n+20);
 
-          if (p < 0.000001) 
+          if (p < 0.000001)
             p = 0.000001; /* Must not be zero */
 
           g_message("%f ", p);
@@ -4777,16 +4778,16 @@ void outputProbs(BelvuContext *bc, FILE *fil)
   else
     {
       g_message("Amino\n");
-      for (i = 1; i <= 20; ++i) 
+      for (i = 1; i <= 20; ++i)
         {
           p = (double)c[i] / (double)n;
           if (p < 0.000001) p = 0.000001; /* Must not be zero */
           g_message("%f ", p);
 	}
     }
-    
+
   g_message("\n");
-  
+
   fclose(fil);
   fflush(fil);
 
@@ -4806,21 +4807,21 @@ void listIdentity(BelvuContext *bc)
   int i=0,j=0,n=0 ;
   double totsc=0, maxsc=0, minsc=1000000,
          totid=0.0, maxid=0.0, minid=100.0;
-  
-  for (i = n = 0; i < (int)bc->alignArr->len - 1; ++i) 
+
+  for (i = n = 0; i < (int)bc->alignArr->len - 1; ++i)
     {
       /* Update the display periodically, otherwise the busy cursor might not
-       * get updated (e.g. if we were outside the main window when we set the 
+       * get updated (e.g. if we were outside the main window when we set the
        * cursor and the user later enters the window). */
       while (gtk_events_pending())
         gtk_main_iteration();
 
       ALN *alni = g_array_index(bc->alignArr, ALN*, i);
-      
+
       if (alni->markup > 0) /* ignore markup lines */
         continue;
 
-      for (j = i+1; j < (int)bc->alignArr->len; ++j) 
+      for (j = i+1; j < (int)bc->alignArr->len; ++j)
         {
           ALN *alnj = g_array_index(bc->alignArr, ALN*, j);
 
@@ -4830,26 +4831,26 @@ void listIdentity(BelvuContext *bc)
           double id = percentIdentity(alnGetSeq(alni), alnGetSeq(alnj), bc->penalize_gaps);
           totid += id;
 
-          if (id > maxid) 
+          if (id > maxid)
             maxid = id;
-          
-          if (id < minid) 
+
+          if (id < minid)
             minid = id;
-      
+
           double sc = score(alnGetSeq(alni), alnGetSeq(alnj), bc->penalize_gaps);
           totsc += sc;
-          
-          if (sc > maxsc) 
+
+          if (sc > maxsc)
             maxsc = sc;
-          
-          if (sc < minsc) 
+
+          if (sc < minsc)
             minsc = sc;
-          
+
           g_message("%s/%d-%d and %s/%d-%d are %.1f%% identical, score=%f\n",
                     alni->name, alni->start, alni->end,
                     alnj->name, alnj->start, alnj->end,
                     id, sc);
-          
+
           ++n;
         }
       g_message("\n");
@@ -4884,7 +4885,7 @@ void fetchAln(BelvuContext *bc, ALN *alnp)
       /* Get the URL from the enviroment var (or use the hard-coded default
        * value) */
       char  *env, url[1025]="";
-      
+
       if ((env = getenv(FETCH_URL_ENV_VAR)) )
 	strcpy(url, env);
       else
@@ -4893,10 +4894,10 @@ void fetchAln(BelvuContext *bc, ALN *alnp)
       /* Add the sequence name to the url. The URL should be a format string
        * containing '%s' for the name. */
       char *cp = strchr(url, '%');
-      
+
       if (cp)
         ++cp;
-      
+
       if (!cp || *cp != 's')
         {
           g_critical("Invalid URL string %s.\nThe URL must contain the search string \"%%s\", which will be replaced with the sequence name.\n", url);
@@ -4904,24 +4905,24 @@ void fetchAln(BelvuContext *bc, ALN *alnp)
       else
         {
           char *link = g_strdup_printf(url, alnp->name);
-          
+
           g_message_info("Opening URL: %s\n", link);
           seqtoolsLaunchWebBrowser(link, &error);
-          
+
           g_free(link);
         }
     }
   else
     {
       char  *env, fetchProg[1025]="";
-      
+
       if ((env = getenv(FETCH_PROG_ENV_VAR)) )
         strcpy(fetchProg, env);
       else
         strcpy(fetchProg, DEFAULT_FETCH_PROG);
 
       char *path = g_find_program_in_path(fetchProg);
-      
+
       if (!path)
         {
           g_warning("Executable '%s' not found in path: %s\n", fetchProg, getenv("PATH"));
@@ -4929,26 +4930,26 @@ void fetchAln(BelvuContext *bc, ALN *alnp)
       else
         {
           g_free(path);
-          
+
           char *cmd = g_strdup_printf("%s '%s' &", fetchProg, alnp->name);
-      
+
           GtkWidget *pfetchWin = externalCommand(cmd, BELVU_TITLE, bc->belvuAlignment, &error);
-      
+
           if (pfetchWin)
             {
               const gchar *env = g_getenv(FONT_SIZE_ENV_VAR);
               if (env)
                 widgetSetFontSizeAndCheck(pfetchWin, convertStringToInt(env));
-              
+
               /* Add the window to our list of spawned windows */
               bc->spawnedWindows = g_slist_prepend(bc->spawnedWindows, pfetchWin);
               g_signal_connect(G_OBJECT(pfetchWin), "destroy", G_CALLBACK(onDestroySpawnedWindow), bc);
             }
-      
+
           g_free(cmd);
         }
     }
-  
+
   reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
 
 }
@@ -4994,4 +4995,3 @@ void setBusyCursor(BelvuContext *bc, const gboolean busy)
   while (gtk_events_pending())
     gtk_main_iteration();
 }
-
diff --git a/src/belvuApp/belvuAlignment.cpp b/src/belvuApp/belvuAlignment.cpp
index 9cf402f933cac007e038c618fde116f2d64e35d7..e434205ed098a79b2998b178a6e9807f0d91dd81 100644
--- a/src/belvuApp/belvuAlignment.cpp
+++ b/src/belvuApp/belvuAlignment.cpp
@@ -1,5 +1,6 @@
 /*  File: belvuAlignment.c
  *  Author: Gemma Barson, 2011-04-12
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -60,7 +61,7 @@ class BelvuAlignmentProperties
 public:
   GtkWidget *widget;
   BelvuContext *bc;                 /* The belvu context */
-  
+
   GtkWidget *columnsArea;           /* Drawing widget for the columns (i.e. name and coord columns) */
   GtkWidget *columnsHeader;         /* Drawing widget for the header for the the columns area */
   GtkWidget *seqArea;               /* Drawing widget for the actual sequence */
@@ -70,12 +71,12 @@ public:
   GdkRectangle seqHeaderRect;       /* Drawing area for the sequence header */
   GtkAdjustment *hAdjustment;       /* Controls horizontal scroll bar */
   GtkAdjustment *vAdjustment;       /* Controls vertical scroll bar */
-  
+
   int columnPadding;                /* Padding in between columns, in pixels */
   int nameColumnPadding;            /* Padding after name column, in pixels */
   char *title;                /* title to display at the top of the alignments */
   int wrapWidth;                    /* Number of characters after which to wrap (or UNSET_INT for no wrapping) */
-  
+
   gdouble charWidth;                /* The width of each character in the display */
   gdouble charHeight;               /* The height of each character in the display */
 };
@@ -101,7 +102,7 @@ static void onDestroyBelvuAlignment(GtkWidget *belvuAlignment)
           g_free(properties->title);
           properties->title = NULL;
         }
-      
+
       /* Free the properties struct itself */
       delete properties;
       properties = NULL;
@@ -111,7 +112,7 @@ static void onDestroyBelvuAlignment(GtkWidget *belvuAlignment)
 
 
 /* Create the properties struct and initialise all values. */
-static void belvuAlignmentCreateProperties(GtkWidget *belvuAlignment, 
+static void belvuAlignmentCreateProperties(GtkWidget *belvuAlignment,
                                            BelvuContext *bc,
                                            GtkWidget *columnsArea,
                                            GtkWidget *columnsHeader,
@@ -125,7 +126,7 @@ static void belvuAlignmentCreateProperties(GtkWidget *belvuAlignment,
   if (belvuAlignment)
     {
       BelvuAlignmentProperties *properties = new BelvuAlignmentProperties;
-      
+
       properties->widget = belvuAlignment;
       properties->bc = bc;
       properties->columnsArea = columnsArea;
@@ -137,7 +138,7 @@ static void belvuAlignmentCreateProperties(GtkWidget *belvuAlignment,
       properties->vAdjustment = vAdjustment;
       properties->title = g_strdup(title);
       properties->wrapWidth = wrapWidth;
-      
+
       properties->seqRect.x = 0;
       properties->seqRect.y = DEFAULT_YPAD;
       properties->seqHeaderRect.x = properties->seqRect.x;
@@ -170,14 +171,14 @@ void onBelvuAlignmentFontSizeChanged(GtkWidget *belvuAlignment)
     return;
 
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   if (!properties || !properties->seqArea)
     return;
-  
+
   getFontCharSize(properties->seqArea, properties->seqArea->style->font_desc, &properties->charWidth, &properties->charHeight, TRUE);
 
   /* Update the column padding, which is based on the character width. We use
-   * slightly different padding if the view is wrapped because we don't draw 
+   * slightly different padding if the view is wrapped because we don't draw
    * column separators */
   if (properties->wrapWidth != UNSET_INT) /* wrapped */
     {
@@ -189,8 +190,8 @@ void onBelvuAlignmentFontSizeChanged(GtkWidget *belvuAlignment)
       properties->columnPadding = (DEFAULT_PADDING_CHARS * properties->charWidth) / 2;
       properties->nameColumnPadding = 0;
     }
-  
-  
+
+
   /* The font size affects the height of the header line */
   properties->seqHeaderRect.height = properties->charHeight + DEFAULT_YPAD;
 
@@ -226,16 +227,16 @@ void belvuAlignmentRedrawAll(GtkWidget *belvuAlignment)
 
   if (properties->seqArea)
     widgetClearCachedDrawable(properties->seqArea, NULL);
-  
+
   if (properties->seqHeader)
     widgetClearCachedDrawable(properties->seqHeader, NULL);
-  
+
   if (properties->columnsArea)
     widgetClearCachedDrawable(properties->columnsArea, NULL);
 
   if (properties->columnsHeader)
     widgetClearCachedDrawable(properties->columnsHeader, NULL);
-  
+
   gtk_widget_queue_draw(belvuAlignment);
 }
 
@@ -244,26 +245,26 @@ void belvuAlignmentRedrawAll(GtkWidget *belvuAlignment)
 static void belvuAlignmentRedrawSequenceArea(GtkWidget *belvuAlignment)
 {
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   if (properties->seqArea)
     widgetClearCachedDrawable(properties->seqArea, NULL);
-  
+
   if (properties->seqHeader)
     widgetClearCachedDrawable(properties->seqHeader, NULL);
-  
+
   gtk_widget_queue_draw(belvuAlignment);
 }
 
 
 /* Find the background color of the given residue index i in the given alignment */
-static void findResidueBGcolor(BelvuContext *bc, ALN* alnp, int i, const gboolean isSelected, GdkColor *result) 
+static void findResidueBGcolor(BelvuContext *bc, ALN* alnp, int i, const gboolean isSelected, GdkColor *result)
 {
   int colorNum = 0;
   char *alnpSeq = alnGetSeq(alnp);
-  
+
   if (!alnpSeq || i >= alnGetSeqLen(alnp))
     colorNum = WHITE;
-  else if (bc->lowercaseOn && alnpSeq[i] >= 'a' && alnpSeq[i] <= 'z') 
+  else if (bc->lowercaseOn && alnpSeq[i] >= 'a' && alnpSeq[i] <= 'z')
     colorNum = ORANGE;
   else if (alnp->nocolor)
     colorNum = BOXCOLOR;
@@ -280,27 +281,27 @@ static void findResidueBGcolor(BelvuContext *bc, ALN* alnp, int i, const gboolea
 
 /* Draw a single row in the columns area */
 static void drawSingleColumn(GtkWidget *widget,
-                             GdkDrawable *drawable, 
+                             GdkDrawable *drawable,
                              BelvuAlignmentProperties *properties,
-                             ALN *alnp, 
+                             ALN *alnp,
                              const int lineNum)
 {
   int x = 0;
   const int y = properties->columnsRect.y + (properties->charHeight * lineNum);
-  
+
   const gboolean highlightAln = alignmentHighlighted(properties->bc, alnp);
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   if (highlightAln || alnp->color != WHITE)
     {
       /* Highlight the background */
       GdkColor bgColor;
       convertColorNumToGdkColor(alnp->color, highlightAln, &bgColor);
-      
+
       gdk_gc_set_foreground(gc, &bgColor);
       gdk_draw_rectangle(drawable, gc, TRUE, properties->columnsRect.x, y, properties->columnsRect.width, properties->charHeight);
     }
-  
+
   GdkColor *textColor = getGdkColor(BELCOLOR_ALIGN_TEXT, properties->bc->defaultColors, highlightAln, FALSE);
   gdk_gc_set_foreground(gc, textColor);
 
@@ -311,7 +312,7 @@ static void drawSingleColumn(GtkWidget *widget,
       drawText(widget, drawable, gc, x, y, alnp->name, NULL, NULL);
       x += (properties->bc->maxNameLen * properties->charWidth) + properties->columnPadding;
     }
-  
+
   /* Draw the coords (but only if this is not GC markup; note that we always
    * draw the column separator lines for the coords, though) */
   gdk_draw_line(drawable, gc, x, y, x, y + properties->charHeight);
@@ -319,10 +320,10 @@ static void drawSingleColumn(GtkWidget *widget,
 
   if (alnp->markup != GC)
     drawIntAsText(widget, drawable, gc, x, y, alnp->start);
-  
+
   x += properties->columnPadding;
   gdk_draw_line(drawable, gc, x, y, x, y + properties->charHeight);
-  
+
   x += properties->columnPadding + properties->bc->maxEndLen * properties->charWidth; /* right-aligned */
 
   if (alnp->markup != GC)
@@ -330,19 +331,19 @@ static void drawSingleColumn(GtkWidget *widget,
 
   x += properties->columnPadding;
   gdk_draw_line(drawable, gc, x, y, x, y + properties->charHeight);
-  
+
   /* Draw the score, if displaying scores (and if not a markup row) */
   if (properties->bc->displayScores)
     {
       x += (properties->bc->maxScoreLen * properties->charWidth) + properties->columnPadding;
-      
+
       if (!alnp->markup)
         drawDoubleAsText(widget, drawable, gc, x, y, alnp->score);
-      
+
       x += properties->columnPadding;
       gdk_draw_line(drawable, gc, x, y, x, y + properties->charHeight);
     }
-  
+
   g_object_unref(gc);
 }
 
@@ -356,14 +357,14 @@ static gboolean alignmentSelected(BelvuContext *bc, ALN *alnp)
 
 
 /* Draw a single character in the given sequence. In standard mode, fgColorsOnly
- * should be false and the function will draw the background color for the 
+ * should be false and the function will draw the background color for the
  * base (and will not draw any text). This is because drawing each character
  * separately is slow, so all text in the default color is drawn at once
  * by the calling function.
  * However, if fgColorsOnly is true then this function checks if the required
  * foreground color is different to the default and, if so, draws the character
  * in that color. (It does not draw background colors in this mode.) */
-static void drawSequenceChar(BelvuAlignmentProperties *properties, 
+static void drawSequenceChar(BelvuAlignmentProperties *properties,
                              ALN *alnp,
                              const int colIdx,
                              const gboolean rowHighlighted,
@@ -372,7 +373,7 @@ static void drawSequenceChar(BelvuAlignmentProperties *properties,
                              GdkGC *gc,
                              GdkColor *defaultFgColor,
                              const gboolean fgColorsOnly,
-                             const int x, 
+                             const int x,
                              const int y)
 {
   if (!fgColorsOnly)
@@ -381,34 +382,34 @@ static void drawSequenceChar(BelvuAlignmentProperties *properties,
       GdkColor bgColor;
       findResidueBGcolor(properties->bc, alnp, colIdx, rowHighlighted, &bgColor);
       gdk_gc_set_foreground(gc, &bgColor);
-      
+
       gdk_draw_rectangle(drawable, gc, TRUE, x, y, properties->charWidth, properties->charHeight);
     }
   else if (colIdx < alnGetSeqLen(alnp) && colorByConservation(properties->bc))
     {
       /* Draw the text if it is in a different color to the default. This is only
-       * possible in color by conservation mode. We get the text colour from the 
+       * possible in color by conservation mode. We get the text colour from the
        * background color */
       GdkColor fgColor, bgColor;
       findResidueBGcolor(properties->bc, alnp, colIdx, rowHighlighted, &bgColor);
       bg2fgColor(properties->bc, &bgColor, &fgColor);
-      
+
       if (!colorsEqual(&fgColor, defaultFgColor))
         {
           gdk_gc_set_foreground(gc, &fgColor);
-          
+
           char displayText[2];
           displayText[0] = alnGetSeq(alnp)[colIdx];
           displayText[1] = '\0';
           drawText(widget, drawable, gc, x, y, displayText, NULL, NULL);
         }
     }
-  
+
 }
 
 
 /* Draw a single line in the sequence area.
- * 
+ *
  * This is rather convoluted in an attempt to maximise speed.  Drawing of text in
  * GTK is particularly slow, and is best done a whole line at a time, rather than
  * drawing individual characters.  The characters may each have a different background
@@ -421,29 +422,29 @@ static void drawSequenceChar(BelvuAlignmentProperties *properties,
  * characters have a different foreground colour and just draw those over the top.
 */
 static void drawSingleSequence(GtkWidget *widget,
-                                GdkDrawable *drawable, 
+                                GdkDrawable *drawable,
                                 BelvuAlignmentProperties *properties,
-                                ALN *alnp, 
+                                ALN *alnp,
                                 const int lineNum)
 {
   if (!alnGetSeq(alnp))
     return;
-  
+
   const int startX = properties->seqRect.x;
   int x = startX;
   const int y = properties->seqRect.y + (properties->charHeight * lineNum);
-  
+
   GdkGC *gc = gdk_gc_new(drawable);
   GtkAdjustment *hAdjustment = properties->hAdjustment;
-  
+
   GdkColor *defaultFgColor = getGdkColor(BELCOLOR_ALIGN_TEXT, properties->bc->defaultColors, FALSE, FALSE);
-  
+
   /* Loop through each column in the current display range and color
    * the according to the relevant highlight color */
   int colIdx = hAdjustment->value;
   int iMax = min(properties->bc->maxLen, (int)hAdjustment->value + (int)hAdjustment->page_size);
   const gboolean rowHighlighted = alignmentSelected(properties->bc, alnp);
-  
+
   if (properties->bc->displayColors)
     {
       for ( ; colIdx < iMax; ++colIdx)
@@ -451,7 +452,7 @@ static void drawSingleSequence(GtkWidget *widget,
           drawSequenceChar(properties, alnp, colIdx, rowHighlighted, widget, drawable, gc, defaultFgColor, FALSE, x, y);
           x += properties->charWidth;
         }
-    }  
+    }
   else if (rowHighlighted)
     {
       /* We're not displaying colors for individual chars, but we still need to
@@ -459,36 +460,36 @@ static void drawSingleSequence(GtkWidget *widget,
       GdkColor color;
       convertColorNumToGdkColor(WHITE, TRUE, &color);
       gdk_gc_set_foreground(gc, &color);
-      
+
       gdk_draw_rectangle(drawable, gc, TRUE, startX, y, properties->seqRect.width, properties->charHeight);
     }
-  
-  
+
+
   /* Draw the sequence text (current display range only) */
   if (alnGetSeq(alnp))
     {
       GdkColor *textColor = getGdkColor(BELCOLOR_ALIGN_TEXT, properties->bc->defaultColors, FALSE, FALSE);
       gdk_gc_set_foreground(gc, textColor);
 
-      /* Start at the number of characters into the string where the horizontal 
+      /* Start at the number of characters into the string where the horizontal
        * scrollbar indicates we are (making sure that's not out of the end of the
        * string) */
       if ((int)hAdjustment->value < alnGetSeqLen(alnp))
         {
           char *cp = alnGetSeq(alnp) + (int)hAdjustment->value;
           char *displayText = g_strndup(cp, iMax - properties->hAdjustment->value);
-      
+
           drawText(widget, drawable, gc, startX, y, displayText, NULL, NULL);
-      
+
           g_free(displayText);
         }
     }
-  
+
   /* Loop again and draw any characters that are not in the default text color.
    * We don't draw every character individually because the pango layout calls
    * are expensive, but we can't really avoid it when some characters are in
    * difference colors.  (We could put markup in the pango layout instead, but
-   * generally the number of characters in a non-default color is small, so 
+   * generally the number of characters in a non-default color is small, so
    * this should be good enough for most cases.) */
   if (properties->bc->displayColors)
     {
@@ -497,23 +498,23 @@ static void drawSingleSequence(GtkWidget *widget,
           drawSequenceChar(properties, alnp, colIdx, rowHighlighted, widget, drawable, gc, defaultFgColor, TRUE, x, y);
           x += properties->charWidth;
         }
-    } 
-  
+    }
+
   g_object_unref(gc);
 }
 
 
 /* Return the foreground color selected for a given
-   background color in color-by-conservation mode 
+   background color in color-by-conservation mode
  */
 static void bg2fgColor(BelvuContext *bc, GdkColor *bgColor, GdkColor *result)
 {
   int fgColorNum = BLACK; /* default colour for uncoloured or markup */
-  
+
   /* See if the given bgcolor matches the max-conservation background colour */
   int testColor = *getConsColor(bc, CONS_LEVEL_MAX, FALSE);
   convertColorNumToGdkColor(testColor, FALSE, result);
-  
+
   if (colorsEqual(bgColor, result))
     {
       fgColorNum = *getConsColor(bc, CONS_LEVEL_MAX, TRUE);
@@ -523,7 +524,7 @@ static void bg2fgColor(BelvuContext *bc, GdkColor *bgColor, GdkColor *result)
       /* Try the mid-conservation colour */
       int testColor = *getConsColor(bc, CONS_LEVEL_MID, FALSE);
       convertColorNumToGdkColor(testColor, FALSE, result);
-      
+
       if (colorsEqual(bgColor, result))
         {
           fgColorNum = *getConsColor(bc, CONS_LEVEL_MID, TRUE);
@@ -533,7 +534,7 @@ static void bg2fgColor(BelvuContext *bc, GdkColor *bgColor, GdkColor *result)
           /* Lastly, try the low-conservation colour */
           int testColor = *getConsColor(bc, CONS_LEVEL_LOW, FALSE);
           convertColorNumToGdkColor(testColor, FALSE, result);
-          
+
           if (colorsEqual(bgColor, result))
             fgColorNum = *getConsColor(bc, CONS_LEVEL_LOW, TRUE);
         }
@@ -550,89 +551,89 @@ static void drawWrappedSequences(GtkWidget *widget, GdkDrawable *drawable, Belvu
    space, maxNameLen, 2xspace, maxEndLen, space, maxLen, maxEndLen
    i.e. 4 spaces
    */
-  
+
   int i, oldpos, collapseRes = 0, collapsePos = 0, collapseOn = 0;
   int numSpaces = WRAP_DISPLAY_PADDING_CHARS;
   char collapseStr[10],
   ch[2] = " ";
   static int *pos=0;                    /* Current residue position of sequence j */
-  
+
   GdkColor bgColor;
   GdkColor *pBgColor = &bgColor;
   GdkGC *gcText = gdk_gc_new(drawable);
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   BelvuContext *bc = properties->bc;
-  
-  
+
+
   /* Initialise the sequence and position array */
   char *seq = (char*)g_malloc(properties->wrapWidth + 1);
-  
-  if (!pos) 
+
+  if (!pos)
     pos = (int *)g_malloc(bc->alignArr->len * sizeof(int *));
-  
+
   int j = 0;
-  for (j = 0; j < (int)bc->alignArr->len; ++j) 
+  for (j = 0; j < (int)bc->alignArr->len; ++j)
     pos[j] = g_array_index(bc->alignArr, ALN*, j)->start;
-  
-  
+
+
   int paragraph = 0;
   int totCollapsed = 0;
   int line = 1; /* leave a blank line (line=0) at the top for spacing */
-  
+
   if (properties->title)
     {
       const int x = properties->columnPadding;
       const int y = line * properties->charHeight;
-      
+
       drawText(widget, drawable, gcText, x, y, properties->title, NULL, NULL);
       line += 2; /* increment, and also add another blank line for spacing */
     }
-  
+
   gboolean quit = FALSE;
   while (!quit && paragraph * properties->wrapWidth + totCollapsed < bc->maxLen)
     {
       gboolean emptyPara = TRUE;
-      
+
       for (j = 0; j < (int)bc->alignArr->len; ++j)
         {
           ALN *alnp = g_array_index(bc->alignArr, ALN*, j);
           char *alnpSeq = alnGetSeq(alnp);
-          
-          if (alnp->hide) 
+
+          if (alnp->hide)
             continue;
-          
-          int alnstart = paragraph*properties->wrapWidth +totCollapsed; 
+
+          int alnstart = paragraph*properties->wrapWidth +totCollapsed;
           int alnlen = ( (paragraph+1)*properties->wrapWidth +totCollapsed < bc->maxLen ? properties->wrapWidth : bc->maxLen - alnstart );
           int alnend = min(alnstart + alnlen, alnGetSeqLen(alnp));
-          
+
           gboolean emptyLine = TRUE;
-          for (i = alnstart; i < alnend; ++i) 
+          for (i = alnstart; i < alnend; ++i)
             {
-              if (alnpSeq && !isGap(alnpSeq[i]) && alnpSeq[i] != ' ') 
+              if (alnpSeq && !isGap(alnpSeq[i]) && alnpSeq[i] != ' ')
                 {
                   emptyLine = FALSE;
                   emptyPara = FALSE;
                   break;
                 }
             }
-          
-          if (!emptyLine) 
+
+          if (!emptyLine)
             {
               const int y = line * properties->charHeight;
-              
+
               if (y > properties->seqRect.y + properties->seqRect.height)
                 {
                   quit = TRUE;
                   break;
                 }
 
-              for (collapsePos = 0, oldpos = pos[j], i = alnstart; i < alnend; i++) 
-                {       
+              for (collapsePos = 0, oldpos = pos[j], i = alnstart; i < alnend; i++)
+                {
                   const int xpos = bc->maxNameLen + bc->maxEndLen + numSpaces + i - alnstart - collapsePos;
                   const int x = xpos * properties->charWidth;
-                  
-                  if (alnpSeq[i] == '[') 
+
+                  if (alnpSeq[i] == '[')
                     {
                       /* Experimental - collapse block: "[" -> Collapse start, "]" -> Collapse end, e.g.
                        1 S[..........]FKSJFE
@@ -643,8 +644,8 @@ static void drawWrappedSequences(GtkWidget *widget, GdkDrawable *drawable, Belvu
                        1 S[  0]FKSJFE
                        2 L[ 10]KDEJHF
                        3 P[  4]FKEJFJ
-                       
-                       Minimum collapse = 5 chars. The system depends on absolute coherence in format; 
+
+                       Minimum collapse = 5 chars. The system depends on absolute coherence in format;
                        very strange results will be generated otherwise. Edges need to be avoided manually.
                        */
                       collapseOn = 1;
@@ -652,23 +653,23 @@ static void drawWrappedSequences(GtkWidget *widget, GdkDrawable *drawable, Belvu
                       collapseRes = 0;
                       continue;
                     }
-                  
-                  if (alnpSeq[i] == ']') 
+
+                  if (alnpSeq[i] == ']')
                     {
                       collapseOn = 0;
                       collapsePos -= 4;
                       alnend -= 3;
-                      
+
                       sprintf(collapseStr, "[%3d]", collapseRes);
                       drawText(widget, drawable, gcText, x, y, collapseStr, NULL, NULL);
 
                       continue;
                     }
-                  
-                  if (collapseOn) 
+
+                  if (collapseOn)
                     {
                       collapsePos++;
-                      if (!isGap(alnpSeq[i])) 
+                      if (!isGap(alnpSeq[i]))
                         {
                           collapseRes++;
                           pos[j]++;
@@ -676,75 +677,75 @@ static void drawWrappedSequences(GtkWidget *widget, GdkDrawable *drawable, Belvu
                       alnend++;
                       continue;
                     }
-                  
-                  
-                  if (!isGap(alnpSeq[i]) && alnpSeq[i] != ' ') 
+
+
+                  if (!isGap(alnpSeq[i]) && alnpSeq[i] != ' ')
                     {
                       findResidueBGcolor(bc, alnp, i, FALSE, pBgColor);
                       gdk_gc_set_foreground(gc, pBgColor);
-                      
+
                       gdk_draw_rectangle(drawable, gc, TRUE, x, y, properties->charWidth, properties->charHeight);
-                      
+
                       pos[j]++;
                     }
-                  
+
                   /* Foreground color */
                   GdkColor fgColor;
                   if (colorByConservation(bc))
                     bg2fgColor(bc, pBgColor, &fgColor);
                   else
                     convertColorNumToGdkColor(BLACK, FALSE, &fgColor);
-                  
+
                   gdk_gc_set_foreground(gc, &fgColor);
 
                   *ch = alnpSeq[i];
                   drawText(widget, drawable, gc, x, y, ch, NULL, NULL);
                 }
-          
+
               drawText(widget, drawable, gcText, properties->charWidth, y, alnp->name, NULL, NULL);
-              
-              if (!alnp->markup) 
+
+              if (!alnp->markup)
                 {
                   char *tmpStr = g_strdup_printf("%*d", bc->maxEndLen, oldpos);
                   drawText(widget, drawable, gcText, (bc->maxNameLen + 3) * properties->charWidth, y, tmpStr, NULL, NULL);
                   g_free(tmpStr);
-                  
-                  if (alnend == bc->maxLen) 
+
+                  if (alnend == bc->maxLen)
                     {
                       char *tmpStr = g_strdup_printf("%-d", pos[j] - 1);
                       drawText(widget, drawable, gcText, (bc->maxNameLen + bc->maxEndLen + alnlen + 5) * properties->charWidth, y, tmpStr, NULL, NULL);
                       g_free(tmpStr);
                     }
                 }
-              
+
               line++;
             }
         }
 
       /* Move to next paragraph */
       paragraph++;
-      
+
       /* Add a blank line (unless nothing was drawn for this paragraph) */
       if (!emptyPara)
         line++;
-      
+
       totCollapsed += collapsePos;
     }
-  
+
   g_free(seq);
   g_object_unref(gc);
   g_object_unref(gcText);
 
   /* Set the layout size now we know how big it is */
   properties->seqRect.height = line * properties->charHeight;
-  
+
   gtk_layout_set_size(GTK_LAYOUT(properties->seqArea),
                       properties->seqRect.x + properties->seqRect.width,
                       properties->seqRect.y + properties->seqRect.height);
-  
+
   if (properties->hAdjustment)
     gtk_adjustment_changed(properties->hAdjustment); /* signal that the scroll range has changed */
-  
+
   if (properties->vAdjustment)
     gtk_adjustment_changed(properties->vAdjustment);
 }
@@ -759,18 +760,18 @@ static void drawBelvuColumnsHeader(GtkWidget *widget, GdkDrawable *drawable, Bel
   /* Draw the summary line, which shows the number of sequences & alignment length */
   int x = properties->columnPadding;
   int y = DEFAULT_YPAD;
-  
+
   char *tmpStr = g_strdup_printf("(%dx%d)", bc->alignArr->len, bc->maxLen);
-  
+
   drawText(widget, drawable, gc, x, y, tmpStr, NULL, NULL);
   y += properties->charHeight + DEFAULT_YPAD - 1;
-  
+
   g_free(tmpStr);
-  
+
   /* Draw a horizontal separator line */
   x = 0;
   gdk_draw_line(drawable, gc, x, y, x + properties->columnsRect.width, y);
-  
+
   g_object_unref(gc);
 }
 
@@ -782,15 +783,15 @@ static void drawBelvuColumns(GtkWidget *widget, GdkDrawable *drawable, BelvuAlig
 
   /* Draw each visible alignment */
   GtkAdjustment *vAdjustment = properties->vAdjustment;
-  
+
   int i = vAdjustment->value;
   int lineNum = 0;
   const int iMax = min((int)bc->alignArr->len, (int)vAdjustment->value + (int)vAdjustment->page_size);
-  
+
   for ( ; i < iMax; ++i)
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
-      
+
       if (alnp && !alnp->hide)
         {
           drawSingleColumn(widget, drawable, properties, alnp, lineNum);
@@ -806,8 +807,8 @@ static void drawBelvuSequenceHeader(GtkWidget *widget, GdkDrawable *drawable, Be
   /* The range starts at the current adjustment value (add one to make it a 1-based column number) */
   IntRange displayRange = {(int)(properties->hAdjustment->value + 1),
                            (int)min(properties->bc->maxLen, (int)properties->hAdjustment->value + (int)properties->hAdjustment->page_size)};
-  
-  drawHScale(widget, 
+
+  drawHScale(widget,
              drawable,
              &displayRange,
              &properties->seqHeaderRect,
@@ -824,13 +825,13 @@ static void drawBelvuSequenceHeader(GtkWidget *widget, GdkDrawable *drawable, Be
 static void drawSelectedColumn(GtkWidget *widget, GdkDrawable *drawable, BelvuAlignmentProperties *properties)
 {
   BelvuContext *bc = properties->bc;
-  
+
   /* Quit if there is no column selected */
   if (bc->highlightedCol < 1)
     return;
 
   GtkAdjustment *hAdjustment = properties->hAdjustment;
-  
+
   const int iMin = properties->hAdjustment->value + 1;
   const int iMax = min(bc->maxLen, (int)hAdjustment->value + (int)hAdjustment->page_size + 1);
 
@@ -838,12 +839,12 @@ static void drawSelectedColumn(GtkWidget *widget, GdkDrawable *drawable, BelvuAl
   if (bc->highlightedCol < iMin || bc->highlightedCol > iMax)
     return;
 
-  /* Get the column number as a zero-based index in the current range and 
+  /* Get the column number as a zero-based index in the current range and
    * convert this to a distance from the left edge, which will be our x coord.
    * Add half a char's width to get the x coord at the centre of the char. */
   const int colIdx = bc->highlightedCol - iMin;
   const int x = properties->seqRect.x + (colIdx * properties->charWidth) + (properties->charWidth / 2);
-  
+
 
   /* Draw a vertical line at this index */
   GdkGC *gc = gdk_gc_new(drawable);
@@ -852,9 +853,9 @@ static void drawSelectedColumn(GtkWidget *widget, GdkDrawable *drawable, BelvuAl
   gdk_gc_set_foreground(gc, color);
   gdk_gc_set_function(gc, GDK_INVERT);
   gdk_draw_line(drawable, gc, x, 0, x, properties->seqRect.height);
-  
+
   g_object_unref(gc);
-  
+
 //  /* Draw a transparent box at this index */
 //  cairo_t *cr = gdk_cairo_create(drawable);
 //  gdk_cairo_set_source_color(cr, color);
@@ -869,18 +870,18 @@ static void drawSelectedColumn(GtkWidget *widget, GdkDrawable *drawable, BelvuAl
 static void drawBelvuSequence(GtkWidget *widget, GdkDrawable *drawable, BelvuAlignmentProperties *properties)
 {
   BelvuContext *bc = properties->bc;
-  
+
   /* Draw each visible alignment */
   GtkAdjustment *vAdjustment = properties->vAdjustment;
-  
+
   int i = vAdjustment->value;
   int lineNum = 0;
   const int iMax = min((int)bc->alignArr->len, (int)vAdjustment->value + (int)vAdjustment->page_size);
-  
+
   for ( ; i < iMax; ++i)
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
-      
+
       if (alnp && !alnp->hide)
         {
           drawSingleSequence(widget, drawable, properties, alnp, lineNum);
@@ -900,14 +901,14 @@ static gboolean onExposeBelvuColumns(GtkWidget *widget, GdkEventExpose *event, g
     {
       GdkDrawable *bitmap = widgetGetDrawable(widget);
       BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-      
+
       if (!bitmap)
         {
           /* There isn't a bitmap yet. Create it now. */
           bitmap = createBlankSizedPixmap(widget, window, properties->columnsRect.width, properties->columnsRect.height);
           drawBelvuColumns(widget, bitmap, properties);
         }
-      
+
       if (bitmap)
         {
           /* Push the bitmap onto the window */
@@ -931,29 +932,29 @@ static gboolean onExposeBelvuSequence(GtkWidget *widget, GdkEventExpose *event,
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
 
   GdkDrawable *window = GTK_LAYOUT(widget)->bin_window;
-  
+
   if (window)
     {
       GdkDrawable *bitmap = widgetGetDrawable(widget);
-      
+
       if (!bitmap)
         {
           /* There isn't a bitmap yet. Create it now. */
           bitmap = createBlankSizedPixmap(widget, window, properties->seqRect.width, properties->seqRect.height);
-          
+
           if (properties->wrapWidth == UNSET_INT)
             drawBelvuSequence(widget, bitmap, properties);
           else
             drawWrappedSequences(widget, bitmap, properties);
         }
-      
+
       if (bitmap)
         {
           /* Push the bitmap onto the window */
           GdkGC *gc = gdk_gc_new(window);
           gdk_draw_drawable(window, gc, bitmap, 0, 0, 0, 0, -1, -1);
           g_object_unref(gc);
-          
+
           /* Draw the currently-selected column on top */
           drawSelectedColumn(widget, window, properties);
         }
@@ -962,7 +963,7 @@ static gboolean onExposeBelvuSequence(GtkWidget *widget, GdkEventExpose *event,
           g_warning("Failed to draw Belvu alignment [%p] - could not create bitmap.\n", widget);
         }
     }
-  
+
   return TRUE;
 }
 
@@ -977,7 +978,7 @@ static gboolean onExposeBelvuSequenceHeader(GtkWidget *widget, GdkEventExpose *e
   if (window)
     {
       GdkDrawable *bitmap = widgetGetDrawable(widget);
-      
+
       if (!bitmap)
         {
           /* There isn't a bitmap yet. Create it now. */
@@ -996,7 +997,7 @@ static gboolean onExposeBelvuSequenceHeader(GtkWidget *widget, GdkEventExpose *e
           g_warning("Failed to draw Belvu alignment header [%p] - could not create bitmap.\n", widget);
         }
     }
-  
+
   return TRUE;
 }
 
@@ -1007,18 +1008,18 @@ static gboolean onExposeBelvuColumnsHeader(GtkWidget *widget, GdkEventExpose *ev
   GtkWidget *belvuAlignment = GTK_WIDGET(data);
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
   GdkDrawable *window = widget->window;
-  
+
   if (window)
     {
       GdkDrawable *bitmap = widgetGetDrawable(widget);
-      
+
       if (!bitmap)
         {
           /* There isn't a bitmap yet. Create it now. */
           bitmap = createBlankSizedPixmap(widget, window, properties->seqRect.width, properties->seqRect.height);
           drawBelvuColumnsHeader(widget, bitmap, properties);
         }
-      
+
       if (bitmap)
         {
           /* Push the bitmap onto the window */
@@ -1031,7 +1032,7 @@ static gboolean onExposeBelvuColumnsHeader(GtkWidget *widget, GdkEventExpose *ev
           g_warning("Failed to draw Belvu columns header [%p] - could not create bitmap.\n", widget);
         }
     }
-  
+
   return TRUE;
 }
 
@@ -1044,7 +1045,7 @@ static void onHScrollPosChangedBelvuAlignment(GtkObject *object, gpointer data)
 {
   GtkWidget *belvuAlignment = GTK_WIDGET(data);
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   if (properties->wrapWidth == UNSET_INT)
     {
       /* We need to clear and re-draw the sequence area (unless we're displaying
@@ -1059,7 +1060,7 @@ static void onVScrollPosChangedBelvuAlignment(GtkObject *object, gpointer data)
 {
   GtkWidget *belvuAlignment = GTK_WIDGET(data);
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   if (properties->wrapWidth == UNSET_INT)
     {
       belvuAlignmentRedrawAll(belvuAlignment);
@@ -1094,16 +1095,16 @@ static void onVScrollRangeChangedBelvuAlignment(GtkObject *object, gpointer data
 {
   GtkWidget *belvuAlignment = GTK_WIDGET(data);
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   /* Set the horizontal adjustment page size to be the number of characters
    * that will fit in the width */
   properties->vAdjustment->page_size = (int)(properties->seqArea->allocation.height / properties->charHeight);
   properties->vAdjustment->page_increment = properties->vAdjustment->page_size;
-  
+
   /* Make sure the scroll position still lies within upper - page_size. */
   if (properties->vAdjustment->value > properties->vAdjustment->upper - properties->vAdjustment->page_size)
     properties->vAdjustment->value = properties->vAdjustment->upper - properties->vAdjustment->page_size;
-  
+
   /* Make sure we're still within the lower limit */
   if (properties->vAdjustment->value < properties->vAdjustment->lower)
     properties->vAdjustment->value = properties->vAdjustment->lower;
@@ -1115,13 +1116,13 @@ static void onVScrollRangeChangedBelvuAlignment(GtkObject *object, gpointer data
 static void updateOnAlignmentSizeChanged(GtkWidget *belvuAlignment)
 {
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   if (properties->vAdjustment)
     {
       properties->vAdjustment->upper = properties->bc->alignArr->len + 1;
       gtk_adjustment_changed(properties->vAdjustment);
     }
-  
+
   if (properties->hAdjustment)
     {
       properties->hAdjustment->upper = properties->bc->maxLen;
@@ -1138,7 +1139,7 @@ void updateOnVScrollSizeChaged(GtkWidget *belvuAlignment)
 {
   /* Recalculate the borders, because the max name length etc. may have changed */
   calculateDrawingSizes(belvuAlignment);
-  
+
   /* Update the scroll ranges because the number of rows and columns may have changed */
   updateOnAlignmentSizeChanged(belvuAlignment);
 }
@@ -1169,7 +1170,7 @@ int belvuAlignmentGetWidth(GtkWidget *belvuAlignment)
 static int getAlignmentDisplayWidth(BelvuAlignmentProperties *properties)
 {
   int result = 0;
-  
+
   if (properties->wrapWidth == UNSET_INT)
     {
       /* Drawing can be very slow if we draw the full alignment, so we only
@@ -1183,19 +1184,19 @@ static int getAlignmentDisplayWidth(BelvuAlignmentProperties *properties)
        * in case the user specifies a very large width because this can cause
        * a badalloc crash if too big.) */
       result =
-        properties->columnPadding + (properties->bc->maxNameLen * properties->charWidth) + 
+        properties->columnPadding + (properties->bc->maxNameLen * properties->charWidth) +
         properties->nameColumnPadding + (properties->bc->maxEndLen * properties->charWidth) +
-        properties->columnPadding + (properties->wrapWidth * properties->charWidth) + 
-        properties->columnPadding + (properties->bc->maxEndLen * properties->charWidth) + 
+        properties->columnPadding + (properties->wrapWidth * properties->charWidth) +
+        properties->columnPadding + (properties->bc->maxEndLen * properties->charWidth) +
         properties->columnPadding + (properties->bc->maxScoreLen * properties->charWidth);
-      
+
       if (result > MAX_PIXMAP_WIDTH)
         {
           result = MAX_PIXMAP_WIDTH;
           g_warning("The alignment window is too large and will be clipped.\n");
         }
     }
-  
+
   return result;
 }
 
@@ -1203,31 +1204,31 @@ static int getAlignmentDisplayWidth(BelvuAlignmentProperties *properties)
 static int getAlignmentDisplayHeight(BelvuAlignmentProperties *properties)
 {
   int result = 0;
-  
+
   if (properties->wrapWidth == UNSET_INT)
     {
       result = properties->seqArea->allocation.height - DEFAULT_YPAD;
-    }  
+    }
   else
     {
       /* Divide the full sequence length by the display width to give the number
        * of paragraphs we require */
       const int numParagraphs = ceil((double)properties->bc->maxLen / (double)properties->wrapWidth);
       const int paragraphHeight = (properties->bc->alignArr->len + 1) * properties->charHeight;
-    
+
       result = paragraphHeight * numParagraphs;
-      
+
       /* Add space for the title, if given (one line for the title and one as a spacer) */
       if (properties->title)
         result += properties->charHeight * 2;
-      
+
       if (result > MAX_PIXMAP_HEIGHT)
         {
           result = MAX_PIXMAP_HEIGHT;
           g_warning("The alignment window is too large and will be clipped.\n");
         }
     }
-  
+
   return result;
 }
 
@@ -1238,9 +1239,9 @@ void updateHeaderColumnsSize(GtkWidget *belvuAlignment)
 {
   if (!belvuAlignment)
     return;
-  
+
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   if (properties->columnsArea)
     {
       /* There is a separate drawing area for the columns that contain the row
@@ -1249,16 +1250,16 @@ void updateHeaderColumnsSize(GtkWidget *belvuAlignment)
                                       (properties->bc->maxStartLen * properties->charWidth) + (2 * properties->columnPadding) +
                                       (properties->bc->maxEndLen * properties->charWidth) + (2 * properties->columnPadding) +
                                       properties->columnPadding;
-      
+
       if (properties->bc->displayScores)
         properties->columnsRect.width += (properties->bc->maxScoreLen * properties->charWidth) + (2 * properties->columnPadding);
 
       /* Set the height of the header line to the the same as the sequence header line */
       gtk_widget_set_size_request(properties->columnsHeader, -1, properties->seqHeaderRect.y + properties->seqHeaderRect.height);
-      
+
       /* Set the height and width of the drawing area */
       gtk_layout_set_size(GTK_LAYOUT(properties->columnsArea), properties->columnsRect.width, properties->columnsRect.height);
-      
+
       /* Force the width of the drawing widget to be the width of the drawing area */
       if (properties->columnsRect.width != properties->columnsArea->allocation.width)
         gtk_widget_set_size_request(properties->columnsArea, properties->columnsRect.width, -1);
@@ -1267,7 +1268,7 @@ void updateHeaderColumnsSize(GtkWidget *belvuAlignment)
 
 
 /* This function calculates the size of the drawing area for sequences based
- * on either a) the current allocated size of the sequence area or b) for a 
+ * on either a) the current allocated size of the sequence area or b) for a
  * wrapped alignment, the full size required to draw everything.
  * It also updates the height of the columns area, if applicable, so that it is
  * the same height as the sequence area. */
@@ -1275,14 +1276,14 @@ void calculateDrawingSizes(GtkWidget *belvuAlignment)
 {
   if (!belvuAlignment)
     return;
-  
+
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
 
   /* Recalculate the size of the drawing area for the sequences (both height
    * and width may have changed on a size-allocate) */
   properties->seqRect.width = getAlignmentDisplayWidth(properties);
   properties->seqRect.height = getAlignmentDisplayHeight(properties);
-  
+
   /* Update the size of the drawing widget and signal that the scroll range
    * has changed (n/a for wrapped view because this gets done by the draw function. */
   if (properties->wrapWidth == UNSET_INT)
@@ -1291,11 +1292,11 @@ void calculateDrawingSizes(GtkWidget *belvuAlignment)
 
       if (properties->hAdjustment)
         gtk_adjustment_changed(properties->hAdjustment); /* signal that the scroll range has changed */
-      
+
       if (properties->vAdjustment)
         gtk_adjustment_changed(properties->vAdjustment);
     }
-  
+
   /* Keep the sequence-header area the same width as the sequence area */
   properties->seqHeaderRect.width = properties->seqRect.width;
 
@@ -1312,7 +1313,7 @@ void calculateDrawingSizes(GtkWidget *belvuAlignment)
 static void onSizeAllocateBelvuAlignment(GtkWidget *widget, GtkAllocation *allocation, gpointer data)
 {
   GtkWidget *belvuAlignment = GTK_WIDGET(data);
-  
+
   /* Update the size of the drawing areas */
   calculateDrawingSizes(belvuAlignment);
 }
@@ -1323,25 +1324,25 @@ static void onSizeAllocateBelvuAlignment(GtkWidget *widget, GtkAllocation *alloc
  ***********************************************************/
 
 void removeSelectedSequence(BelvuContext *bc, GtkWidget *belvuAlignment)
-{ 
-  if (!bc->selectedAln) 
+{
+  if (!bc->selectedAln)
     {
       g_critical("Please select a sequence to remove.\n");
       return;
     }
-  
+
   const int idx = bc->selectedAln->nr - 1;
   g_array_remove_index(bc->alignArr, idx);
   arrayOrder(bc->alignArr);
-  
+
   bc->saved = FALSE;
-  
+
   g_message("Removed %s/%d-%d.  %d sequences left.\n\n", bc->selectedAln->name, bc->selectedAln->start, bc->selectedAln->end, bc->alignArr->len);
-  
+
   bc->selectedAln = NULL;
-  
+
   rmFinaliseGapRemoval(bc);
-  updateOnVScrollSizeChaged(belvuAlignment);  
+  updateOnVScrollSizeChaged(belvuAlignment);
   onRowSelectionChanged(bc);
 }
 
@@ -1351,28 +1352,28 @@ void removeGappySeqs(BelvuContext *bc, GtkWidget *belvuAlignment, const double c
 {
   rmGappySeqs(bc, cutoff);
   rmFinaliseGapRemoval(bc);
-  updateOnVScrollSizeChaged(belvuAlignment);  
+  updateOnVScrollSizeChaged(belvuAlignment);
 }
 
 /* Get rid of partial seqs. */
 void removePartialSeqs(BelvuContext *bc, GtkWidget *belvuAlignment)
 {
   rmPartialSeqs(bc);
-  updateOnVScrollSizeChaged(belvuAlignment);  
+  updateOnVScrollSizeChaged(belvuAlignment);
 }
 
 /* Get rid of redundant seqs (those that are more than the given % identical). */
 void removeRedundantSeqs(BelvuContext *bc, GtkWidget *belvuAlignment, const double cutoff)
 {
   mkNonRedundant(bc, cutoff);
-  updateOnVScrollSizeChaged(belvuAlignment);  
+  updateOnVScrollSizeChaged(belvuAlignment);
 }
 
 /* Get rid of outlier seqs (those that are less than the given % identical to any other). */
 void removeOutliers(BelvuContext *bc, GtkWidget *belvuAlignment, const double cutoff)
 {
   rmOutliers(bc, cutoff);
-  updateOnVScrollSizeChaged(belvuAlignment);  
+  updateOnVScrollSizeChaged(belvuAlignment);
 }
 
 /* Get rid of seqs that have a score below the given value */
@@ -1388,11 +1389,11 @@ void removeByScore(BelvuContext *bc, GtkWidget *belvuAlignment, const double cut
  * highlighted sequence is visible */
 void centerHighlighted(BelvuContext *bc, GtkWidget *belvuAlignment)
 {
-  if (bc->selectedAln) 
+  if (bc->selectedAln)
     {
       BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
       GtkAdjustment *vAdjustment = properties->vAdjustment;
-      
+
       /* Create the range of y coords that we want to be in range */
       const int newIdx = bc->selectedAln->nr - 1;
       gtk_adjustment_clamp_page(vAdjustment, newIdx, newIdx + 1);
@@ -1409,7 +1410,7 @@ static void setAdjustmentValue(GtkAdjustment *adjustment, const int value)
   /* _set_value checks the lower limit, but we need to check the upper... */
   if (newValue > adjustment->upper - adjustment->page_size)
     newValue = adjustment->upper - adjustment->page_size;
-                     
+
   gtk_adjustment_set_value(adjustment, newValue);
 }
 
@@ -1491,19 +1492,19 @@ void hScrollLeftRight(GtkWidget *belvuAlignment, const gboolean left, const int
 static void selectRowAtCoord(BelvuAlignmentProperties *properties, const int y)
 {
   BelvuContext *bc = properties->bc;
-  
+
   const int rowIdx = properties->vAdjustment->value + ((y - properties->seqRect.y) / properties->charHeight);
-  
+
   /* Set the selected alignment. Note that some alignments are hidden so
    * we need to count how many visible alignments there are up to this row. */
   int i = 0;
   int count = -1;
   bc->selectedAln = NULL;
-  
+
   for ( i = 0; i < (int)bc->alignArr->len; ++i)
     {
       ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
-      
+
       if (!alnp->hide)
         {
           ++count;
@@ -1532,11 +1533,11 @@ static void selectColumnAtCoord(BelvuAlignmentProperties *properties, const int
   BelvuContext *bc = properties->bc;
 
   const int colIdx = getColumnAtCoord(properties, x);
-  
+
   if (colIdx >= 0 && colIdx < bc->maxLen)
     {
       bc->selectedCol = colIdx + properties->hAdjustment->value + 1;
-      
+
       if (highlightCol)
         bc->highlightedCol = bc->selectedCol;
       else
@@ -1549,10 +1550,10 @@ static void selectColumnAtCoord(BelvuAlignmentProperties *properties, const int
 static gboolean onButtonPressColumnsArea(GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   GtkWidget *belvuAlignment = GTK_WIDGET(data);
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   if (event->type == GDK_BUTTON_PRESS && event->button == 1)  /* single click left button */
     {
       /* Select the clicked row */
@@ -1567,13 +1568,13 @@ static gboolean onButtonPressColumnsArea(GtkWidget *widget, GdkEventButton *even
           /* Removed the clicked sequence (which will be the selected one) */
           removeSelectedSequence(properties->bc, belvuAlignment);
         }
-      else 
+      else
         {
           /* Fetch the clicked sequence (i.e. the currently selected one) */
           fetchAln(properties->bc, properties->bc->selectedAln);
         }
     }
-  
+
   return handled;
 }
 
@@ -1582,27 +1583,27 @@ static gboolean onButtonPressColumnsArea(GtkWidget *widget, GdkEventButton *even
 static gboolean onButtonPressSeqArea(GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   GtkWidget *belvuAlignment = GTK_WIDGET(data);
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   if (event->type == GDK_BUTTON_PRESS &&
       (event->button == 1 || event->button == 2))  /* single click left or middle buttons */
     {
       /* If the middle button was pressed, highlight the selected column */
       const gboolean highlightCol = (event->button == 2);
-      
+
       /* If the left button was pressed, select the clicked row */
       if (event->button == 1)
         {
           selectRowAtCoord(properties, event->y);
           onRowSelectionChanged(properties->bc);
         }
-      
+
       /* Select the clicked column */
       selectColumnAtCoord(properties, event->x, highlightCol);
       onColSelectionChanged(properties->bc);
-      
+
       handled = TRUE;
     }
   else if (event->type == GDK_2BUTTON_PRESS && event->button == 1) /* double click left button */
@@ -1612,13 +1613,13 @@ static gboolean onButtonPressSeqArea(GtkWidget *widget, GdkEventButton *event, g
           /* Removed the clicked sequence (i.e. the currently selected one) */
           removeSelectedSequence(properties->bc, belvuAlignment);
         }
-      else 
+      else
         {
           /* Fetch the clicked sequence (i.e. the currently selected one) */
           fetchAln(properties->bc, properties->bc->selectedAln);
         }
     }
-  
+
   return handled;
 }
 
@@ -1627,25 +1628,25 @@ static gboolean onButtonPressSeqArea(GtkWidget *widget, GdkEventButton *event, g
 static gboolean onButtonReleaseSeqArea(GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   GtkWidget *belvuAlignment = GTK_WIDGET(data);
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   if (event->button == 2)  /* released middle button */
     {
       /* Scroll to centre on the current column */
       int colIdx = getColumnAtCoord(properties, event->x);
       double newValue = colIdx + properties->hAdjustment->value - (properties->hAdjustment->page_size / 2.0);
-      
+
       if (newValue > properties->hAdjustment->upper - properties->hAdjustment->page_size)
         newValue = properties->hAdjustment->upper - properties->hAdjustment->page_size;
-        
+
       gtk_adjustment_set_value(properties->hAdjustment, newValue);
-      
+
       /* Clear the current column highlihting */
       properties->bc->highlightedCol = 0;
       onColSelectionChanged(properties->bc);
-      
+
       handled = TRUE;
     }
   else if (event->type == GDK_2BUTTON_PRESS && event->button == 1) /* double click left button */
@@ -1656,7 +1657,7 @@ static gboolean onButtonReleaseSeqArea(GtkWidget *widget, GdkEventButton *event,
           removeSelectedSequence(properties->bc, belvuAlignment);
         }
     }
-  
+
   return handled;
 }
 
@@ -1665,19 +1666,19 @@ static gboolean onButtonReleaseSeqArea(GtkWidget *widget, GdkEventButton *event,
 static gboolean onMouseMoveSeqArea(GtkWidget *widget, GdkEventMotion *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   GtkWidget *belvuAlignment = GTK_WIDGET(data);
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   if (event->state & GDK_BUTTON2_MASK) /* middle button pressed */
     {
       /* Update the selected/highlighted column */
       selectColumnAtCoord(properties, event->x, TRUE);
       onColSelectionChanged(properties->bc);
-      
+
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -1686,10 +1687,10 @@ static gboolean onMouseMoveSeqArea(GtkWidget *widget, GdkEventMotion *event, gpo
 static gboolean onScrollAlignment(GtkWidget *widget, GdkEventScroll *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   GtkWidget *belvuAlignment = GTK_WIDGET(data);
   BelvuAlignmentProperties *properties = belvuAlignmentGetProperties(belvuAlignment);
-  
+
   switch (event->direction)
     {
       /* left/right scrolling for sequence area or sequence header only */
@@ -1700,7 +1701,7 @@ static gboolean onScrollAlignment(GtkWidget *widget, GdkEventScroll *event, gpoi
           handled = TRUE;
           break;
         }
-        
+
       case GDK_SCROLL_RIGHT:
         {
           if (widget == properties->seqArea || widget == properties->seqHeader)
@@ -1717,7 +1718,7 @@ static gboolean onScrollAlignment(GtkWidget *widget, GdkEventScroll *event, gpoi
           handled = TRUE;
           break;
         }
-        
+
       case GDK_SCROLL_DOWN:
         {
           if (widget == properties->seqArea || widget == properties->columnsArea)
@@ -1725,14 +1726,14 @@ static gboolean onScrollAlignment(GtkWidget *widget, GdkEventScroll *event, gpoi
           handled = TRUE;
           break;
         }
-        
+
       default:
         {
           handled = FALSE;
           break;
         }
     };
-  
+
   return handled;
 }
 
@@ -1759,20 +1760,20 @@ static void setBelvuAlignmentStyle(BelvuContext *bc, GtkWidget *seqArea, GtkWidg
 GtkWidget* createBelvuAlignment(BelvuContext *bc, const char* title, const int wrapWidth)
 {
   GtkWidget *belvuAlignment = NULL;      /* the outermost container */
-  
+
   GtkWidget *seqArea = NULL;             /* the "sequence area", which will draw the actual peptide sequences */
   GtkWidget *columnsArea = NULL;         /* optional "headers" column for drawing names, coords etc. */
   GtkWidget *seqHeader = NULL;       /* header for the sequence area */
   GtkWidget *columnsHeader = NULL;   /* header for the columns area */
-  
+
   GtkAdjustment *hAdjustment = NULL;
   GtkAdjustment *vAdjustment = NULL;
-  
+
   if (wrapWidth == UNSET_INT)
     {
       /* The standard (unwrapped) view. Two columns that share the same vertical
        * scrollbar but only the sequence area will have a horizontal scrollbar. */
-      
+
       /* Place everything in a table */
       belvuAlignment = gtk_table_new(3, 3, FALSE);
       const int xpad = 0, ypad = 0;
@@ -1782,15 +1783,15 @@ GtkWidget* createBelvuAlignment(BelvuContext *bc, const char* title, const int w
       vAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, bc->alignArr->len + 1, 1, 0, 0));
       GtkWidget *hScrollbar = gtk_hscrollbar_new(hAdjustment);
       GtkWidget *vScrollbar = gtk_vscrollbar_new(vAdjustment);
-      
+
       /* Create the drawing areas */
       seqArea = gtk_layout_new(NULL, NULL);
       columnsArea = gtk_layout_new(NULL, NULL);
-      
+
       /* Create a header widget for each drawing area */
       columnsHeader = gtk_drawing_area_new();
       seqHeader = gtk_drawing_area_new();
-      
+
       /* Place all the widgets in the table */
       gtk_table_attach(GTK_TABLE(belvuAlignment), columnsHeader,0, 1, 0, 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
       gtk_table_attach(GTK_TABLE(belvuAlignment), columnsArea,  0, 1, 1, 2, GTK_FILL, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), xpad, ypad);
@@ -1801,14 +1802,14 @@ GtkWidget* createBelvuAlignment(BelvuContext *bc, const char* title, const int w
 
       /* Connect signals */
       gtk_widget_add_events(columnsArea, GDK_BUTTON_PRESS_MASK);
-      g_signal_connect(G_OBJECT(columnsArea), "expose-event", G_CALLBACK(onExposeBelvuColumns), belvuAlignment);  
+      g_signal_connect(G_OBJECT(columnsArea), "expose-event", G_CALLBACK(onExposeBelvuColumns), belvuAlignment);
       g_signal_connect(G_OBJECT(columnsArea), "button-press-event", G_CALLBACK(onButtonPressColumnsArea), belvuAlignment);
       g_signal_connect(G_OBJECT(columnsArea), "scroll-event",  G_CALLBACK(onScrollAlignment), belvuAlignment);
-      
-      g_signal_connect(G_OBJECT(columnsHeader), "expose-event", G_CALLBACK(onExposeBelvuColumnsHeader), belvuAlignment);  
+
+      g_signal_connect(G_OBJECT(columnsHeader), "expose-event", G_CALLBACK(onExposeBelvuColumnsHeader), belvuAlignment);
 
       gtk_widget_add_events(seqHeader, GDK_BUTTON_PRESS_MASK);
-      g_signal_connect(G_OBJECT(seqHeader), "expose-event", G_CALLBACK(onExposeBelvuSequenceHeader), belvuAlignment);  
+      g_signal_connect(G_OBJECT(seqHeader), "expose-event", G_CALLBACK(onExposeBelvuSequenceHeader), belvuAlignment);
       g_signal_connect(G_OBJECT(seqHeader), "scroll-event",  G_CALLBACK(onScrollAlignment), belvuAlignment);
 
       gtk_widget_add_events(seqArea, GDK_BUTTON_RELEASE_MASK);
@@ -1835,15 +1836,15 @@ GtkWidget* createBelvuAlignment(BelvuContext *bc, const char* title, const int w
       belvuAlignment = gtk_scrolled_window_new(NULL, NULL);
       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(belvuAlignment), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
       gtk_container_add(GTK_CONTAINER(belvuAlignment), seqArea);
-      
+
       hAdjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(seqArea));
       vAdjustment = gtk_layout_get_vadjustment(GTK_LAYOUT(seqArea));
     }
 
   gtk_widget_add_events(seqArea, GDK_BUTTON_PRESS_MASK);
-  g_signal_connect(G_OBJECT(seqArea), "expose-event",  G_CALLBACK(onExposeBelvuSequence), belvuAlignment);  
+  g_signal_connect(G_OBJECT(seqArea), "expose-event",  G_CALLBACK(onExposeBelvuSequence), belvuAlignment);
   g_signal_connect(G_OBJECT(seqArea), "size-allocate", G_CALLBACK(onSizeAllocateBelvuAlignment), belvuAlignment);
-  
+
   /* Set the style and properties */
   g_assert(belvuAlignment);
   setBelvuAlignmentStyle(bc, seqArea, columnsArea);
@@ -1851,8 +1852,3 @@ GtkWidget* createBelvuAlignment(BelvuContext *bc, const char* title, const int w
 
   return belvuAlignment;
 }
-
-
-
-
-
diff --git a/src/belvuApp/belvuAlignment.hpp b/src/belvuApp/belvuAlignment.hpp
index f55886d96036c4443e6ca6072cd0807e097750e1..e396ff34ff4b52faafed9602a70000d3bcc437fb 100644
--- a/src/belvuApp/belvuAlignment.hpp
+++ b/src/belvuApp/belvuAlignment.hpp
@@ -1,5 +1,6 @@
 /*  File: belvuAlignment.h
  *  Author: Gemma Barson, 2011-04-12
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
diff --git a/src/belvuApp/belvuConsPlot.cpp b/src/belvuApp/belvuConsPlot.cpp
index 6f3198e43f7d324cee4c8da94d7455673017220f..c60e3193ac3497d67513f81e83f9d26fd7617d45 100644
--- a/src/belvuApp/belvuConsPlot.cpp
+++ b/src/belvuApp/belvuConsPlot.cpp
@@ -1,5 +1,6 @@
 /*  File: belvuConsPlot.h
  *  Author: Gemma Barson, 2011-07-01
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -70,18 +71,18 @@ public:
   GtkWidget *widget;                  /* The conservation plot window */
   BelvuContext *bc;                   /* The belvu context */
   GtkActionGroup *actionGroup;
-    
+
   GtkWidget *drawingArea;             /* The drawing widget */
   GdkRectangle headerRect;            /* Space for drawing the header line */
   GdkRectangle plotRect;              /* Space for drawing the main plot */
   GdkRectangle yScaleRect;            /* Space for drawing the y scale */
   GdkRectangle xScaleRect;            /* Space for drawing the y scale */
-    
+
   int windowSize;                     /* Size of the sliding window used for smothing the profile */
   int lineWidth;                      /* Line width of the plot */
   double xScale;                      /* Used for scaling the x axis */
   double yScale;                      /* Used for scaling the y axis */
-    
+
   double maxcons;                     /* maximum conservation */
   double mincons;                     /* minimum conservation */
   double avgcons;                     /* average conservation */
@@ -100,7 +101,7 @@ static ConsPlotProperties* consPlotGetProperties(GtkWidget *consPlot)
 static void onDestroyConsPlot(GtkWidget *consPlot)
 {
   ConsPlotProperties *properties = consPlotGetProperties(consPlot);
-  
+
   if (properties)
     {
       /* Free the properties struct itself */
@@ -112,8 +113,8 @@ static void onDestroyConsPlot(GtkWidget *consPlot)
 
 
 /* Create the properties struct and initialise all values. */
-static void consPlotCreateProperties(GtkWidget *consPlot, 
-                                     BelvuContext *bc, 
+static void consPlotCreateProperties(GtkWidget *consPlot,
+                                     BelvuContext *bc,
                                      GtkActionGroup *actionGroup,
                                      GtkWidget *drawingArea)
 {
@@ -126,14 +127,14 @@ static void consPlotCreateProperties(GtkWidget *consPlot,
       properties->actionGroup = actionGroup;
 
       properties->drawingArea = drawingArea;
-      
+
       properties->windowSize = 1;
       properties->lineWidth = 1;
       properties->xScale = 10.0;
       properties->yScale = 20.0;
-      
+
       properties->smooth = NULL;
-      
+
       g_object_set_data(G_OBJECT(consPlot), "BelvuConsPlotProperties", properties);
       g_signal_connect(G_OBJECT(consPlot), "destroy", G_CALLBACK (onDestroyConsPlot), NULL);
     }
@@ -156,9 +157,9 @@ static void belvuConsPlotRedrawAll(GtkWidget *consPlot)
 {
   if (!consPlot)
     return;
-  
+
   ConsPlotProperties *properties = consPlotGetProperties(consPlot);
-  
+
   if (properties && properties->drawingArea)
     {
       widgetClearCachedDrawable(properties->drawingArea, NULL);
@@ -182,55 +183,55 @@ static void drawConsPlot(GtkWidget *widget, GdkDrawable *drawable, ConsPlotPrope
 {
   if (!properties->drawingArea)
     return;
-  
+
   BelvuContext *bc = properties->bc;
   GdkGC *gc = gdk_gc_new(drawable);
   gdk_gc_set_line_attributes(gc, properties->lineWidth, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
-  
+
   GtkAdjustment *hAdjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(properties->drawingArea));
   const double xMin = hAdjustment->value;
   const double xMax = min(hAdjustment->value + hAdjustment->page_size, hAdjustment->upper);
   int iMin = (xMin - (double)properties->plotRect.x) / properties->xScale;
   int iMax = (xMax - (double)properties->plotRect.x) / properties->xScale;
-  
+
   if (iMin < 0)
     iMin = 0;
-  
+
   if (iMax > bc->maxLen - 1)
     iMax = bc->maxLen - 1;
-  
+
   /* Draw the header line */
   char *tmpStr = g_strdup_printf("Window = %d", properties->windowSize);
   drawText(widget, drawable, gc, properties->headerRect.x, properties->headerRect.y, tmpStr, NULL, NULL);
   g_free(tmpStr);
-  
+
   /* Draw x scale */
   GdkColor *scaleColor = getGdkColor(BELCOLOR_CONS_PLOT_SCALE, bc->defaultColors, FALSE, FALSE);
   gdk_gc_set_foreground(gc, scaleColor);
 
   const int majorXTickInterval = 10;
   const int minorXTickInterval = 5;
-  
+
   /* Get the start and end x coords of the plot. Note that we offset by the
    * minimum x coord so that the leftmost edge is 0 rather than xMin */
   double xStart = max(xMin, (double)properties->xScaleRect.x) - xMin;
   const double xEnd = min(xMax, (double)properties->xScaleRect.x + (double)properties->xScaleRect.width) - xMin;
-  
+
   /* Draw the base line for the x scale */
   double y = properties->xScaleRect.y;
   gdk_draw_line(drawable, gc, xStart, y, xEnd, y);
 
   /* Loop through each visible column that will have a major tickmark. For
-   * each major tickmark we also draw the minor tickmark previous to it, so 
+   * each major tickmark we also draw the minor tickmark previous to it, so
    * loop until (i - minorXTickInterval) is outside the visible range. */
   int i = roundToValue(iMin, majorXTickInterval);
   double x = 0;
-  
-  for ( ; i - minorXTickInterval <= iMax; i += majorXTickInterval) 
+
+  for ( ; i - minorXTickInterval <= iMax; i += majorXTickInterval)
     {
       /* Get the x position of this column */
       x = properties->xScaleRect.x + (i * properties->xScale) - xMin;
-      
+
       /* Draw the major tickmark (if in range; the very last one might not be) */
       if (i <= iMax)
         gdk_draw_line(drawable, gc, x, y, x, y + MAJOR_TICKMARK_HEIGHT);
@@ -243,12 +244,12 @@ static void drawConsPlot(GtkWidget *widget, GdkDrawable *drawable, ConsPlotPrope
           double x2 = properties->xScaleRect.x + ((i + minorXTickInterval) * properties->xScale) - xMin;
           gdk_draw_line(drawable, gc, x2, y, x2, y + MINOR_TICKMARK_HEIGHT);
         }
-      
+
       tmpStr = g_strdup_printf("%d", i);
       drawText(widget, drawable, gc, x - minorXTickInterval, y + MAJOR_TICKMARK_HEIGHT + CONS_PLOT_LABEL_PAD, tmpStr, NULL, NULL);
       g_free(tmpStr);
     }
-  
+
   /* Draw the y scale. Note that the scale is inversed; that is, the lowest number
    * is at the bottom, i.e. with the highest y position. */
   const double majorYTickInterval = 1.0;
@@ -257,24 +258,24 @@ static void drawConsPlot(GtkWidget *widget, GdkDrawable *drawable, ConsPlotPrope
   x = max(xMin, (double)properties->yScaleRect.x + (double)properties->yScaleRect.width) - xMin;
   const double yStart = properties->yScaleRect.y + properties->yScaleRect.height;
   const double yEnd = properties->yScaleRect.y;
-  
+
   gdk_draw_line(drawable, gc, x, yEnd, x, yStart);
 
   double f = properties->mincons;
   y = 0;
 
-  for ( ; f < properties->maxcons; f += majorYTickInterval) 
+  for ( ; f < properties->maxcons; f += majorYTickInterval)
     {
       y = yStart - (f * properties->yScale);
-      
+
       gdk_draw_line(drawable, gc, x, y, x - MAJOR_TICKMARK_HEIGHT, y);
-      
-      if (f + minorYTickInterval < properties->maxcons) 
+
+      if (f + minorYTickInterval < properties->maxcons)
         {
           double y2 = yStart - ((f + minorYTickInterval) * properties->yScale);
           gdk_draw_line(drawable, gc, x, y2, x - MINOR_TICKMARK_HEIGHT, y2);
         }
-      
+
       tmpStr = g_strdup_printf("%.0f", f);
       PangoLayout *layout = gtk_widget_create_pango_layout(widget, tmpStr);
       g_free(tmpStr);
@@ -283,33 +284,33 @@ static void drawConsPlot(GtkWidget *widget, GdkDrawable *drawable, ConsPlotPrope
       pango_layout_get_size(layout, &textWidth, &textHeight);
       textWidth /= PANGO_SCALE;
       textHeight /= PANGO_SCALE;
-      
-      gdk_draw_layout(drawable, gc, 
-                      x - textWidth - MAJOR_TICKMARK_HEIGHT - CONS_PLOT_LABEL_PAD, 
+
+      gdk_draw_layout(drawable, gc,
+                      x - textWidth - MAJOR_TICKMARK_HEIGHT - CONS_PLOT_LABEL_PAD,
                       y - textHeight / 2, layout);
-      
+
       g_object_unref(layout);
     }
-  
+
   /* Draw average line */
   GdkColor *avgLineColor = getGdkColor(BELCOLOR_CONS_PLOT_AVG, bc->defaultColors, FALSE, FALSE);
   gdk_gc_set_foreground(gc, avgLineColor);
   const double yAvg = yStart - (properties->avgcons * properties->yScale);
-  
+
   gdk_draw_line(drawable, gc, xStart, yAvg, xEnd, yAvg);
   drawText(widget, drawable, gc, xEnd + CONS_PLOT_XPAD, yAvg, AVG_CONSERVATION_LABEL, NULL, NULL);
-  
+
   /* Plot the conservation value for each column */
   GdkColor *plotColor = getGdkColor(BELCOLOR_CONS_PLOT, bc->defaultColors, FALSE, FALSE);
   gdk_gc_set_foreground(gc, plotColor);
-  
-  for (i = iMin + 1; i <= iMax; ++i) 
+
+  for (i = iMin + 1; i <= iMax; ++i)
     {
       x = properties->xScaleRect.x + (i * properties->xScale) - xMin;
-      
+
       const double y1 = yStart - (properties->smooth[i - 1] * properties->yScale);
       const double y2 = yStart - (properties->smooth[i] * properties->yScale);
-      
+
       gdk_draw_line(drawable, gc, x, y1, x + properties->xScale, y2);
     }
 
@@ -326,11 +327,11 @@ static void showSettingsDialog(GtkWidget *consPlot)
 {
   ConsPlotProperties *properties = consPlotGetProperties(consPlot);
   BelvuContext *bc = properties->bc;
-  
+
   char *title = g_strdup_printf("%sPlot Settings", belvuGetTitlePrefix(bc));
 
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
-                                                  GTK_WINDOW(consPlot), 
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
+                                                  GTK_WINDOW(consPlot),
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                                   GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                                   GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
@@ -339,7 +340,7 @@ static void showSettingsDialog(GtkWidget *consPlot)
   g_free(title);
 
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-  
+
   const int numRows = 3;
   const int numCols = 4;
   const int xpad = TABLE_XPAD;
@@ -354,7 +355,7 @@ static void showSettingsDialog(GtkWidget *consPlot)
   GtkWidget *lineEntry = createTextEntryFromInt(dialog, table, 2, 1, xpad, ypad, "_Line width: ", properties->lineWidth, NULL);
 
   gtk_widget_show_all(dialog);
-  
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       const int newWin = convertStringToInt(gtk_entry_get_text(GTK_ENTRY(winEntry)));
@@ -363,7 +364,7 @@ static void showSettingsDialog(GtkWidget *consPlot)
       const int newLine = convertStringToInt(gtk_entry_get_text(GTK_ENTRY(lineEntry)));
 
       gboolean changed = FALSE;
-      
+
       /* Recalculate the conservation array if the window size has changed */
       if (newWin != properties->windowSize)
         {
@@ -371,7 +372,7 @@ static void showSettingsDialog(GtkWidget *consPlot)
           properties->windowSize = newWin;
           calculateConservation(consPlot);
         }
-      
+
       /* Recalculate the window size if either scale has changed */
       if (newX != properties->xScale || newY != properties->yScale)
         {
@@ -389,8 +390,8 @@ static void showSettingsDialog(GtkWidget *consPlot)
           belvuConsPlotRedrawAll(consPlot);
         }
     }
-  
-  gtk_widget_destroy(dialog);  
+
+  gtk_widget_destroy(dialog);
 }
 
 
@@ -403,53 +404,53 @@ static void calculateConservation(GtkWidget *consPlot)
 {
   ConsPlotProperties *properties = consPlotGetProperties(consPlot);
   BelvuContext *bc = properties->bc;
-  
+
   /* Smooth the conservation profile by applying a window */
   if (properties->smooth)
     g_free(properties->smooth);
-  
+
   properties->smooth = (double*)g_malloc(bc->maxLen * sizeof(double));
-  
+
   double sum = 0.0;
-  
+
   int i = 0;
-  for (i = 0; i < properties->windowSize; ++i) 
+  for (i = 0; i < properties->windowSize; ++i)
     sum += bc->conservation[i];
-  
+
   properties->smooth[properties->windowSize / 2] = sum / properties->windowSize;
-  
-  for ( ; i < bc->maxLen; ++i) 
+
+  for ( ; i < bc->maxLen; ++i)
     {
       sum -= bc->conservation[i-properties->windowSize];
       sum += bc->conservation[i];
       properties->smooth[i - properties->windowSize / 2] = sum/properties->windowSize;
     }
-  
+
   /* Find max and min and avg conservation */
   properties->maxcons = -1;
   properties->mincons = 10000;
   properties->avgcons = 0;
-  
-  for (i = 0; i < bc->maxLen; ++i) 
+
+  for (i = 0; i < bc->maxLen; ++i)
     {
-      if (properties->smooth[i] > properties->maxcons) 
+      if (properties->smooth[i] > properties->maxcons)
         properties->maxcons = properties->smooth[i];
-      
-      if (properties->smooth[i] < properties->mincons) 
+
+      if (properties->smooth[i] < properties->mincons)
         properties->mincons = properties->smooth[i];
-      
+
       properties->avgcons += bc->conservation[i];
     }
-  
+
   properties->avgcons /= bc->maxLen * 1.0;
 }
 
 
 /* Calculate the size of the drawing areas */
 static void calculateConsPlotBorders(GtkWidget *consPlot)
-{  
+{
   ConsPlotProperties *properties = consPlotGetProperties(consPlot);
-  
+
   /* Calculate plot size */
   properties->plotRect.width = properties->xScale * properties->bc->maxLen;
   properties->plotRect.height = (properties->maxcons - properties->mincons) * properties->yScale;
@@ -459,10 +460,10 @@ static void calculateConsPlotBorders(GtkWidget *consPlot)
   int textWidth, textHeight;
   getTextSize(properties->drawingArea, tmpStr, &textWidth, &textHeight);
   g_free(tmpStr);
-  
+
   properties->yScaleRect.width = textWidth + MAJOR_TICKMARK_HEIGHT + CONS_PLOT_XPAD;
   properties->yScaleRect.height = properties->plotRect.height;
-  
+
   /* header line size (one character high) */
   properties->headerRect.width = properties->plotRect.width;
   properties->headerRect.height = textHeight;
@@ -474,27 +475,27 @@ static void calculateConsPlotBorders(GtkWidget *consPlot)
   /* Calculate x and y coords */
   properties->headerRect.x = CONS_PLOT_XPAD;
   properties->headerRect.y = CONS_PLOT_YPAD;
-  
+
   properties->yScaleRect.x = CONS_PLOT_XPAD;
   properties->yScaleRect.y = properties->headerRect.y + properties->headerRect.height + CONS_PLOT_YPAD;
-  
+
   properties->plotRect.x = properties->yScaleRect.x + properties->yScaleRect.width + CONS_PLOT_XPAD;
   properties->plotRect.y = properties->yScaleRect.y;
-  
+
   properties->xScaleRect.x = properties->plotRect.x;
   properties->xScaleRect.y = properties->plotRect.y + properties->plotRect.height + CONS_PLOT_YPAD;
 
   /* Set the size of the layout. This must include the rightmost extent of the plot
    * rectangle, and also some extra space on the right for the 'average conservation'
    * label. */
-  const int width = properties->plotRect.x + properties->plotRect.width + 
+  const int width = properties->plotRect.x + properties->plotRect.width +
                     getTextWidth(properties->drawingArea, AVG_CONSERVATION_LABEL) +
                     (CONS_PLOT_XPAD * 2);
-  
-  gtk_layout_set_size(GTK_LAYOUT(properties->drawingArea), 
-                      width, 
+
+  gtk_layout_set_size(GTK_LAYOUT(properties->drawingArea),
+                      width,
                       properties->xScaleRect.y + properties->xScaleRect.height);
-  
+
   belvuConsPlotRedrawAll(consPlot);
 }
 
@@ -506,23 +507,23 @@ static gboolean onExposeConsPlot(GtkWidget *widget, GdkEventExpose *event, gpoin
 {
   GtkWidget *consPlot = GTK_WIDGET(data);
   ConsPlotProperties *properties = consPlotGetProperties(consPlot);
-  
+
   GdkDrawable *window = GTK_LAYOUT(widget)->bin_window;
-  
+
   if (window)
     {
       GdkDrawable *bitmap = widgetGetDrawable(widget);
-      
+
       if (!bitmap)
         {
           /* There isn't a bitmap yet. Create it now. */
-          bitmap = createBlankSizedPixmap(widget, window, 
-                                          widget->allocation.width, 
+          bitmap = createBlankSizedPixmap(widget, window,
+                                          widget->allocation.width,
                                           properties->xScaleRect.y + properties->xScaleRect.height);
 
           drawConsPlot(widget, bitmap, properties);
         }
-      
+
       if (bitmap)
         {
           /* Push the bitmap onto the window */
@@ -536,7 +537,7 @@ static gboolean onExposeConsPlot(GtkWidget *widget, GdkEventExpose *event, gpoin
           g_warning("Failed to draw conservation plot [%p] - could not create bitmap.\n", widget);
         }
     }
-  
+
   return TRUE;
 }
 
@@ -559,12 +560,12 @@ static gboolean onScrollPosChangedConsPlot(GtkObject *object, gpointer data)
 {
   GtkWidget *consPlot = GTK_WIDGET(data);
   ConsPlotProperties *properties = consPlotGetProperties(consPlot);
-  
+
   if (properties->drawingArea)
     {
       belvuConsPlotRedrawAll(consPlot);
     }
-  
+
   return FALSE;
 }
 
@@ -575,16 +576,16 @@ static gboolean onScrollPosChangedConsPlot(GtkObject *object, gpointer data)
 static void setConsPlotStyleProperties(GtkWidget *window, BelvuContext *bc, const int height)
 {
   gtk_widget_set_name(window, BELVU_CONS_PLOT_WINDOW_NAME);
-  
+
   /* Just hide the widget when it is closed rather than destroy it */
   g_signal_connect(window, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-  
+
   /* Set default size based on scale height and alignment window width */
   int screenWidth = 300, screenHeight = 100;
   gbtools::GUIGetTrueMonitorSize(window, &screenWidth, &screenHeight);
-  
+
   const int width = screenWidth * DEFAULT_BELVU_WINDOW_WIDTH_FRACTION;
-  
+
   gtk_window_set_default_size(GTK_WINDOW(window), width, height + CONS_PLOT_WINDOW_YPAD);
 }
 
@@ -593,40 +594,40 @@ void createConsPlot(BelvuContext *bc)
 {
   /* Create the window */
   bc->consPlot = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-  
+
   char *title = g_strdup_printf("%sConservation Profile", belvuGetTitlePrefix(bc));
   gtk_window_set_title(GTK_WINDOW(bc->consPlot), title);
   g_free(title);
-  
+
   /* We must add all toplevel windows to the list of spawned windows */
   bc->spawnedWindows = g_slist_prepend(bc->spawnedWindows, bc->consPlot);
-  
+
   /* Create the context menu and set a callback to show it */
   GtkActionGroup *actionGroup = NULL;
   GtkUIManager *uiManager = createUiManager(bc->consPlot, bc, &actionGroup);
   GtkWidget *contextmenu = createBelvuMenu(bc->consPlot, "/PlotContextMenu", uiManager);
-  
+
   gtk_widget_add_events(bc->consPlot, GDK_BUTTON_PRESS_MASK);
   g_signal_connect(G_OBJECT(bc->consPlot), "button-press-event", G_CALLBACK(onButtonPressBelvu), contextmenu);
-  
+
   GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(bc->consPlot), vbox);
-  
+
   /* We'll place the drawing area in a scrolled window */
   GtkWidget *drawing = gtk_layout_new(NULL, NULL);
   GtkWidget *scrollWin = gtk_scrolled_window_new(NULL, NULL);
   gtk_container_add(GTK_CONTAINER(scrollWin), drawing);
-  
+
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollWin), GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
   gtk_box_pack_start(GTK_BOX(vbox), scrollWin, TRUE, TRUE, 0);
-  
+
   /* Set default background color */
   GdkColor *bgColor = getGdkColor(BELCOLOR_BACKGROUND, bc->defaultColors, FALSE, FALSE);
   gtk_widget_modify_bg(drawing, GTK_STATE_NORMAL, bgColor);
-  
+
   /* Set properties */
   consPlotCreateProperties(bc->consPlot, bc, actionGroup, drawing);
-  
+
   /* Calculate the plot size so we can set the initial window height correctly.
    * Must be done after setting properties, but before showing the widgets. */
   calculateConservation(bc->consPlot);
diff --git a/src/belvuApp/belvuConsPlot.hpp b/src/belvuApp/belvuConsPlot.hpp
index 76e5400b17fef0a8d53d526ae4921398dd9f3ddb..5dda5b8380bbe4653d44cc29acf65fee0d0c9617 100644
--- a/src/belvuApp/belvuConsPlot.hpp
+++ b/src/belvuApp/belvuConsPlot.hpp
@@ -1,5 +1,6 @@
 /*  File: belvuConsPlot.h
  *  Author: Gemma Barson, 2011-07-01
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
diff --git a/src/belvuApp/belvuMain.cpp b/src/belvuApp/belvuMain.cpp
index 94fa8b481a7eac13cca1eac7c15e1acfb8f7f1e1..cd1cdf1bae6e3c678016308c1cc8383adeb8be2e 100644
--- a/src/belvuApp/belvuMain.cpp
+++ b/src/belvuApp/belvuMain.cpp
@@ -1,5 +1,6 @@
 /*  File: belvuMain.c
  *  Author: Gemma Barson, 2011-04-06
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -43,7 +44,7 @@
 #include <ctype.h>
 
 
-/* Usage text. This is a duplicate of the text that is in 
+/* Usage text. This is a duplicate of the text that is in
  * doc/User_doc/dotter_usage.txt, so ideally we would get rid of this and use
  * the text from the file instead; for now, we must update both. */
 
@@ -341,36 +342,36 @@ static void showHelpText(const int exitCode)
 /* Prints version info to stderr */
 static void showVersionInfo()
 {
-  g_message(VERSION_TEXT);  
+  g_message(VERSION_TEXT);
 }
 
 /* Prints compiled date (must go to stdout for our build scripts to work) */
 static void showCompiledInfo()
 {
-  g_message("%s\n", UT_MAKE_COMPILE_DATE());  
+  g_message("%s\n", UT_MAKE_COMPILE_DATE());
 }
 
 
 /* Convert swissprot name suffixes to organisms */
-static void suffix2organism(BelvuContext *bc, GArray *alignArr, GArray *organismArr) 
+static void suffix2organism(BelvuContext *bc, GArray *alignArr, GArray *organismArr)
 {
   int i = 0;
   char *cp = NULL;
-  
-  for (i = 0; i < (int)alignArr->len; ++i) 
+
+  for (i = 0; i < (int)alignArr->len; ++i)
     {
       ALN *alnp = g_array_index(alignArr, ALN*, i);
-      
-      if (!alnp->markup && (cp = strchr(alnp->name, '_'))) 
+
+      if (!alnp->markup && (cp = strchr(alnp->name, '_')))
         {
           char *suffix = (char*)g_malloc(strlen(cp) + 1);
           strcpy(suffix, cp + 1);
-          
-          /* Add organism to table of organisms.  This is necessary to make all 
-           sequences of the same organism point to the same place and to make a 
+
+          /* Add organism to table of organisms.  This is necessary to make all
+           sequences of the same organism point to the same place and to make a
            non-redundant list of present organisms */
           alnp->organism = suffix;
-          
+
           /* Only insert a new organism if it is not already in the array */
           int ip = 0;
           if (!alnArrayFind(organismArr, alnp, &ip, organism_order))
@@ -378,7 +379,7 @@ static void suffix2organism(BelvuContext *bc, GArray *alignArr, GArray *organism
 	      ALN *organism = createEmptyAln();
 	      alncpy(organism, alnp);
 	      organism->organism = alnp->organism;
-	    
+
               g_array_append_val(organismArr, organism);
               g_array_sort(organismArr, organism_order);
 
@@ -404,32 +405,32 @@ static void suffix2organism(BelvuContext *bc, GArray *alignArr, GArray *organism
 static void treeReadDistancesNames(BelvuContext *bc)
 {
   char   *cp = NULL;
-  
+
   char line[MAXLENGTH + 1];
-  
+
   if (!fgets (line, MAXLENGTH, bc->treeReadDistancesPipe))
     g_error("Error reading distance matrix\n");
-  
+
   if ((cp = strchr(line, '\n')))
     *cp = 0;
-  
+
   int nseq = 0;
-  
+
   while ((cp = strtok(nseq ? 0 : line, " \t")))
     {
       ALN *aln = createEmptyAln();
-      
+
       strncpy(aln->name, cp, MAXNAMESIZE);
-      
+
       aln->name[MAXNAMESIZE] = 0;
       aln->nr = nseq;
       g_array_insert_val(bc->alignArr, nseq, aln);
-      
+
       nseq++;
-      
+
       /* printf("%d  %s\n", aln.nr, aln.name); */
     }
-  
+
   g_array_sort(bc->alignArr, nrorder);
 }
 
@@ -439,7 +440,7 @@ static void readScores(char *filename, BelvuContext *bc)
   char line[MAXLENGTH+1], linecp[MAXLENGTH+1], *cp;
   FILE *file;
   int scoreLen;
-  
+
   gboolean found = FALSE;
   gboolean warnings = FALSE;
 
@@ -448,66 +449,66 @@ static void readScores(char *filename, BelvuContext *bc)
 
   if (!(file = fopen(filename, "r")))
     g_error("Cannot open file %s\n", filename);
-  
+
   while (!feof (file))
-    { 
+    {
       if (!fgets (line, MAXLENGTH, file)) break;
       strcpy(linecp, line);
-      
+
       initAln(&aln);
-      
-      if (!(cp = strtok(line, " "))) 
+
+      if (!(cp = strtok(line, " ")))
 	g_error("Error parsing score file %s.\nLine: %s\n", filename, linecp);
-      
+
       if (!(sscanf(cp, "%f", &aln.score)))
         g_error("Error parsing score file %s - bad score.\nLine: %s\n", filename, linecp);
-      
-      if (!(cp = strtok(0, "/"))) 
+
+      if (!(cp = strtok(0, "/")))
 	g_error("Error parsing score file %s.\nLine: %s\n", filename, linecp);
-      
+
       strncpy(aln.name, cp, MAXNAMESIZE);
       aln.name[MAXNAMESIZE] = 0;
-      
-      if (!(cp = strtok(0, "-"))) 
+
+      if (!(cp = strtok(0, "-")))
 	g_error("Error parsing score file %s.\nLine: %s\n", filename, linecp);
-      
+
       if (!(aln.start = atoi(cp)))
         g_error("Error parsing score file %s - no start coordinate.\nLine: %s\n", filename, linecp);
-      
-      if (!(cp = strtok(0, "\n"))) 
+
+      if (!(cp = strtok(0, "\n")))
 	g_error("Error parsing score file %s.\nLine: %s\n", filename, linecp);
-      
+
       if (!(aln.end = atoi(cp)))
         g_error("Error parsing score file %s - no end coordinate.\nLine: %s\n", filename, linecp);
-      
+
       int idx = 0;
-      if (!alignFind(bc->alignArr, &aln, &idx)) 
+      if (!alignFind(bc->alignArr, &aln, &idx))
         {
 	  warnings = TRUE;
-          /* printf("Warning: %s/%d-%d (score %.1f) not found in alignment\n", 
+          /* printf("Warning: %s/%d-%d (score %.1f) not found in alignment\n",
            aln.name, aln.start, aln.end, aln.score);*/
         }
       else
         {
 	  found = TRUE;
-	
+
           g_array_index(bc->alignArr, ALN*, idx)->score = aln.score;
 
           char *scoreStr = g_strdup_printf("%.1f", aln.score);
           scoreLen = strlen(scoreStr);
           g_free(scoreStr);
 
-          if (scoreLen > bc->maxScoreLen) 
+          if (scoreLen > bc->maxScoreLen)
             bc->maxScoreLen = scoreLen;
         }
     }
 
   fclose(file);
-  
+
   if (found)
     {
       bc->displayScores = TRUE;
-    
+
       if (warnings)
         g_warning("Some sequences in the scores file were not found in the alignment.\n");
     }
@@ -524,42 +525,42 @@ int main(int argc, char **argv)
   signal(SIGSEGV, errorHandler);
   signal(SIGFPE, errorHandler);
 
-  FILE    
+  FILE
   *file, *pipe;
-  
-  char    
+
+  char
   *scoreFile = 0,
   *readMatchFile = 0,
   *colorCodesFile = 0,
   *markupColorCodesFile = 0,
   *output_format = 0,
   *optargc;
-  
-  int     
+
+  int
   i,
   output_probs = 0,
   show_ann = 0;
-  
-  double   
+
+  double
   makeNRinit = 0.0,
   init_rmGappyColumns = 0.0,
   init_rmGappySeqs = 0.0;
-  
-  
-  
-  
+
+
+
+
   /* Set up the GLib message handlers
-   * 
+   *
    * There are two handlers: the default one for all non-critical messages, which will just log
-   * output to the console, and one for critical messages and errors, which will display a 
+   * output to the console, and one for critical messages and errors, which will display a
    * pop-up message (the idea being that we don't bother the user unless it's something serious).
    * Note that the latter needs to display a gtk dialog so can't be set up until after gtk_init
    * has been called.
-   * 
+   *
    * All errors and warnings will be sent to stderr, as will info messages (g_message_info).
    * Program output destined for stdout should use g_message.
    * g_debug will direct to stdout as well.
-   * 
+   *
    * In summary:
    *   g_error: pop-up error message (always fatal)
    *   g_critical: pop-up error message
@@ -567,7 +568,7 @@ int main(int argc, char **argv)
    *   g_message_info: program info message sent to stderr
    *   g_message: program output message set to stdout
    *   (g_debug: not sure of usage scenarios but directs to stdout)
-   *   
+   *
    */
   BlxMessageData msgData;
   msgData.titlePrefix = g_strdup(BELVU_PREFIX);
@@ -584,20 +585,20 @@ int main(int argc, char **argv)
   /* Set up tree defaults */
   char treePickString[50];
   strcpy(treePickString, SWAPstr);
-  
+
   setTreeScaleCorr(bc, bc->treeMethod);
-  
-  
+
+
   gboolean verbose = FALSE;
   gboolean init_rmPartial = FALSE;
-  
+
   static gboolean showHelp = FALSE;
   static gboolean showCompiled = FALSE;
   static gboolean showVersion = FALSE;
   static gboolean abbrevTitle = FALSE;
 
   gtk_parse_args(&argc, &argv);
-  
+
   /* Get the input args. We allow long args, so we need to create a long_options array */
   static struct option long_options[] =
     {
@@ -609,21 +610,21 @@ int main(int argc, char **argv)
       {"help",                  no_argument,        0, 'h'},
       {0, 0, 0, 0}
     };
-  
+
   const char  *optstring="aBb:CcGhil:L:m:n:O:o:PpQ:q:RrS:s:T:t:uX:z:";
   extern int   optind;
   extern char *optarg;
   int          optionIndex; /* getopt_long stores the index into the option struct here */
   int          optc;        /* the current option gets stored here */
-  
+
   while ((optc = getopt_long(argc, argv, optstring, long_options, &optionIndex)) != EOF)
     {
-      switch (optc) 
+      switch (optc)
         {
           case 0:
             /* we get here if getopt_long set a flag; nothing else to do */
-            break; 
-            
+            break;
+
           case 'a': show_ann = 1;                                       break;
           case 'B': bc->outputBootstrapTrees = TRUE;                    break;
           case 'b': bc->treebootstraps = atoi(optarg);                  break;
@@ -644,8 +645,8 @@ int main(int argc, char **argv)
           case 'p': output_probs = 1;                                   break;
           case 'R': bc->stripCoordTokensOn = bc->saveCoordsOn = FALSE;  break;
           case 'r': bc->IN_FORMAT = RAW;                                break;
-            
-          case 'S': 
+
+          case 'S':
             switch (*optarg)
             {
               case 'a': bc->sortType = BELVU_SORT_ALPHA;                break;
@@ -653,27 +654,27 @@ int main(int argc, char **argv)
               case 's': bc->sortType = BELVU_SORT_SCORE;                break;
               case 'S': bc->sortType = BELVU_SORT_SIM;                  break;
               case 'i': bc->sortType = BELVU_SORT_ID;                   break;
-              case 'n': 
+              case 'n':
                 bc->treeMethod = NJ;
                 bc->sortType = BELVU_SORT_TREE;                         break;
-              case 'u': 
-                bc->treeMethod = UPGMA; 
+              case 'u':
+                bc->treeMethod = UPGMA;
                 bc->sortType = BELVU_SORT_TREE;                         break;
               default : g_error("Illegal sorting order: %s\n", optarg);   break;
             };
             break;
-            
+
           case 's': scoreFile = g_strdup(optarg);                       break;
-            
-          case 'T': 
-          for (optargc = optarg; *optargc; optargc++) 
+
+          case 'T':
+          for (optargc = optarg; *optargc; optargc++)
             {
               switch (*optargc)
                 {
-                  case 'n': 
+                  case 'n':
                     strcpy(bc->treeMethodString, NJstr);
                     bc->treeMethod = NJ;                          break;
-                  case 'u': 
+                  case 'u':
                     strcpy(bc->treeMethodString, UPGMAstr);
                     bc->treeMethod = UPGMA;                       break;
                   case 'c':
@@ -695,7 +696,7 @@ int main(int argc, char **argv)
                   case 'o':
                     bc->treeCoordsOn = FALSE;                     break;
                   case 'p':
-                    bc->treePrintDistances = TRUE;  
+                    bc->treePrintDistances = TRUE;
                     bc->initTree = TRUE;                          break;
                   case 'R':
                     bc->treeReadDistancesOn = TRUE;               break;
@@ -713,9 +714,9 @@ int main(int argc, char **argv)
                     setTreeScale(bc, 1.0);          break;
                   default : g_error("Illegal sorting order: %s\n", optarg);
                 }
-            } 
+            }
             break;
-            
+
           case 't': strncpy(bc->Title, optarg, 255);		  break;
           case 'u': bc->displayColors = FALSE;                    break;
           case 'X': bc->mksubfamilies_cutoff = atof(optarg);      break;
@@ -723,7 +724,7 @@ int main(int argc, char **argv)
           default : g_error("Illegal option\n");                    break;
         }
     }
-  
+
   if (showVersion)
     {
       showVersionInfo();
@@ -735,44 +736,44 @@ int main(int argc, char **argv)
       showCompiledInfo();
       exit (EXIT_SUCCESS);
     }
-  
+
   if (showHelp)
-    { 
+    {
       showHelpText(EXIT_SUCCESS);
       exit(EXIT_SUCCESS);
     }
-  
-  if (argc-optind < 1) 
-    { 
+
+  if (argc-optind < 1)
+    {
       showUsageText(EXIT_FAILURE);
       exit(EXIT_FAILURE);
     }
-  
-  if (!strcmp(argv[optind], "-")) 
+
+  if (!strcmp(argv[optind], "-"))
     {
       pipe = stdin;
       if (!*bc->Title) strcpy(bc->Title, "stdin");
     }
-  else 
+  else
     {
       if (!(pipe = fopen(argv[optind], "r")))
 	g_error("Cannot open file %s\n", argv[optind]);
-      if (!*bc->Title) 
+      if (!*bc->Title)
 	strncpy(bc->Title, argv[optind], 255);
-      
+
       bc->fileName = g_path_get_basename(argv[optind]);
       bc->dirName = g_path_get_dirname(argv[optind]);
     }
-  
+
   bc->abbrevTitle = abbrevTitle;
   msgData.titlePrefix = abbrevTitle ? g_strdup(BELVU_PREFIX_ABBREV) : g_strdup(BELVU_PREFIX);
-    
-  if (bc->treeReadDistancesOn) 
+
+  if (bc->treeReadDistancesOn)
     {
       /* Should this really be either or?  Problem: cannot read organism info when reading tree */
       bc->treeReadDistancesPipe = pipe;
       treeReadDistancesNames(bc);
-      
+
       bc->initTree = TRUE;
       bc->onlyTree = TRUE;
       bc->treeCoordsOn = FALSE;
@@ -781,16 +782,16 @@ int main(int argc, char **argv)
     {
       readFile(bc, pipe);
     }
-  
+
   if (bc->organismArr->len == 0)
     suffix2organism(bc, bc->alignArr, bc->organismArr);
-  
+
   setOrganismColors(bc->organismArr);
-  
-  if (scoreFile) 
+
+  if (scoreFile)
     readScores(scoreFile, bc);
-  
-  
+
+
   /* Sort by the initial sort order. If sorting by similarity or ID, then
    * we must have a selected sequence - select the first one that is not
    * a markup line. */
@@ -809,40 +810,40 @@ int main(int argc, char **argv)
     }
 
   doSort(bc, bc->sortType, FALSE);
-  
-  if (!bc->matchFooter && readMatchFile) 
+
+  if (!bc->matchFooter && readMatchFile)
     {
-      if (!(file = fopen(readMatchFile, "r"))) 
+      if (!(file = fopen(readMatchFile, "r")))
         g_error("Cannot open file %s\n", readMatchFile);
-      
+
       readMatch(bc, file);
       fclose(file);
     }
-  else if (bc->matchFooter) 
-    {	 
+  else if (bc->matchFooter)
+    {
       readMatch(bc, pipe);
       fclose(pipe);
     }
-  
-  if (!bc->treeReadDistancesOn) 
+
+  if (!bc->treeReadDistancesOn)
     {
       checkAlignment(bc);
       setConsSchemeColors(bc);
     }
-  
+
   if (verbose)
     {
       /* Print conservation statistics */
       int i, j, max, consensus = 0 ;
       double totcons = 0.0;
-    
+
       g_message("\nColumn Consensus        Identity       Conservation\n");
       g_message  ("------ ---------  -------------------  ------------\n");
-    
+
       for (i = 0; i < bc->maxLen; ++i)
         {
           max = 0;
-          
+
           for (j = 1; j < 21; j++)
             {
               if (bc->conservCount[j][i] > max)
@@ -851,35 +852,35 @@ int main(int argc, char **argv)
                   consensus = j;
                 }
             }
-          
-          g_message("%4d       %c      %4d/%-4d = %5.1f %%  %4.1f\n", 
+
+          g_message("%4d       %c      %4d/%-4d = %5.1f %%  %4.1f\n",
                     i+1, b2aIndex(consensus), max, bc->alignArr->len, (double)max/bc->alignArr->len*100, bc->conservation[i]);
           totcons += bc->conservation[i];
         }
-      
+
       g_message ("\nAverage conservation = %.1f\n", totcons/(bc->maxLen*1.0));
-      
+
       exit(0);
     }
-  
+
   initMarkupColors();
   initCustomColors();
 
-  if (colorCodesFile) 
+  if (colorCodesFile)
     {
-      if (!(file = fopen(colorCodesFile, "r"))) 
+      if (!(file = fopen(colorCodesFile, "r")))
         g_error("Cannot open file %s\n", colorCodesFile);
-      
+
       readResidueColorScheme(bc, file, getColorArray(), TRUE);
 
       bc->residueScheme = BELVU_SCHEME_CUSTOM;
       bc->schemeType = BELVU_SCHEME_TYPE_RESIDUE;
       bc->colorByResIdOn = FALSE;
     }
-  
-  if (markupColorCodesFile) 
+
+  if (markupColorCodesFile)
     {
-      if (!(file = fopen(markupColorCodesFile, "r"))) 
+      if (!(file = fopen(markupColorCodesFile, "r")))
         g_error("Cannot open file %s\n", markupColorCodesFile);
 
       readResidueColorScheme(bc, file, getMarkupColorArray(), FALSE);
@@ -892,19 +893,19 @@ int main(int argc, char **argv)
 
   if (makeNRinit)
     mkNonRedundant(bc, makeNRinit);
-  
+
   if (init_rmPartial)
     rmPartialSeqs(bc);
-  
+
   if (init_rmGappyColumns)
     rmEmptyColumns(bc, init_rmGappyColumns/100.0);
-  
+
   if (init_rmGappySeqs) {
     rmGappySeqs(bc, init_rmGappySeqs);
     rmFinaliseGapRemoval(bc);
   }
-  
-  if (output_format) 
+
+  if (output_format)
     {
       if (!strcasecmp(output_format, "Stockholm") ||
           !strcasecmp(output_format, "Mul") ||
@@ -916,24 +917,24 @@ int main(int argc, char **argv)
         {
           writeMSF(bc, stdout);
         }
-      else if (!strcasecmp(output_format, "FastaAlign")) 
+      else if (!strcasecmp(output_format, "FastaAlign"))
         {
 	  bc->saveFormat = BELVU_FILE_ALIGNED_FASTA;
           writeFasta(bc, stdout);
         }
-      else if (!strcasecmp(output_format, "Fasta")) 
+      else if (!strcasecmp(output_format, "Fasta"))
         {
 	  bc->saveFormat = BELVU_FILE_UNALIGNED_FASTA;
           writeFasta(bc, stdout);
         }
-      else if (!strcasecmp(output_format, "tree")) 
+      else if (!strcasecmp(output_format, "tree"))
         {
           separateMarkupLines(bc);
-          
+
           Tree *tree = treeMake(bc, TRUE, TRUE);
           saveTreeNH(tree, tree->head, stdout);
           destroyTree(&tree);
-          
+
           g_message(";\n");
           reInsertMarkupLines(bc);
         }
@@ -944,20 +945,20 @@ int main(int argc, char **argv)
 
       exit(0);
     }
-  
-  if (bc->outputBootstrapTrees && bc->treebootstraps > 0) 
+
+  if (bc->outputBootstrapTrees && bc->treebootstraps > 0)
     {
       treeBootstrap(bc);
       exit(0);
-    } 
-  
-  if (output_probs) 
+    }
+
+  if (output_probs)
     {
       outputProbs(bc, stdout);
       exit(0);
     }
-  
-  if (bc->mksubfamilies_cutoff) 
+
+  if (bc->mksubfamilies_cutoff)
     {
       mksubfamilies(bc, bc->mksubfamilies_cutoff);
       exit(0);
@@ -967,7 +968,7 @@ int main(int argc, char **argv)
   gtk_init(&argc, &argv);
 
   /* After gtk_init is called, we can start using the popup message handler */
-  g_log_set_handler(NULL, (GLogLevelFlags)(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), 
+  g_log_set_handler(NULL, (GLogLevelFlags)(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
                     popupMessageHandler, &msgData);
 
   /* Update bits of the context that require the display to be initialised */
@@ -976,40 +977,40 @@ int main(int argc, char **argv)
   createBelvuColors(bc);
 
   g_message_info("\n%d sequences, max len = %d\n", bc->alignArr->len, bc->maxLen);
-  
+
   /* Try to get 8x13 font for menus, if not set on command line */
   for ( i=0; i < argc; i++)
     {
-      if (!strcmp(argv[i], "-font")) 
+      if (!strcmp(argv[i], "-font"))
         break;
     }
-  
-  if (i == argc) 
+
+  if (i == argc)
     {
       argvAdd(&argc, &argv, "-font");
       argvAdd(&argc, &argv, "8x13");
     }
-  
-  if (show_ann) 
+
+  if (show_ann)
     showAnnotationWindow(bc);
 
   if (bc->outputBootstrapTrees && bc->treebootstraps < 0)
-    {	
+    {
       /* Display [treebootstraps] bootstrap trees */
       bc->treebootstrapsDisplay = TRUE;
-      
+
       bc->treebootstraps = -bc->treebootstraps;
-      
+
       treeBootstrap(bc);
     }
 
-  if (!colorCodesFile) 
+  if (!colorCodesFile)
     {
       bc->schemeType = BELVU_SCHEME_TYPE_CONS;
       bc->consScheme = BELVU_SCHEME_BLOSUM;
       setConsSchemeColors(bc);
     }
-  
+
   /* Create the main belvu graph display of aligned sequences. */
   if (createBelvuWindow(bc, &msgData))
     {
diff --git a/src/belvuApp/belvuTree.cpp b/src/belvuApp/belvuTree.cpp
index 46fb7dc9569f5c40b062978b6a2f736778c91205..f3899632cf4ac2f68703f8a6e911df1088fd21f1 100644
--- a/src/belvuApp/belvuTree.cpp
+++ b/src/belvuApp/belvuTree.cpp
@@ -1,5 +1,6 @@
 /*  File: belvuTree.c
  *  Author: Gemma Barson, 2011-05-06
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -77,17 +78,17 @@ typedef struct _BuildMethodChangedData
 
 
 /*  BLOSUM62 930809
- 
+
  #  Matrix made by matblas from blosum62.iij
  #  * column uses minimum score
  #  BLOSUM Clustered Scoring Matrix in 1/2 Bit Units
  #  Blocks Database = /data/blocks_5.0/blocks.dat
  #  Cluster Percentage: >= 62
  #  Entropy =   0.6979, Expected =  -0.5209
- 
+
  Note: to use with a2b[], always subtract 1 from the values !!!!
- 
- A   R   N   D   C   Q   E   G   H   I   L   K   M   F   P   S   T   W   Y   V   B   Z   X  \* */ 
+
+ A   R   N   D   C   Q   E   G   H   I   L   K   M   F   P   S   T   W   Y   V   B   Z   X  \* */
 static int BLOSUM62[24][24] = {
 {4, -1, -2, -2,  0, -1, -1,  0, -2, -1, -1, -1, -1, -2, -1,  1,  0, -3, -2,  0, -2, -1,  0, -4},
 {-1,  5,  0, -2, -3,  1,  0, -2,  0, -3, -2,  2, -1, -3, -2, -1, -1, -3, -2, -3, -1,  0, -1, -4},
@@ -138,12 +139,12 @@ NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
 NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
 NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
 NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
-NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA 
+NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
 };
 
 
 /* This struct represents an area on the main tree drawing area
- * where a node is drawn. It can be used to find a node that was 
+ * where a node is drawn. It can be used to find a node that was
  * clicked on. */
 typedef struct _ClickableRect
 {
@@ -160,24 +161,24 @@ public:
   GtkWidget *widget;
   BelvuContext *bc;	            /* The belvu context */
   GtkActionGroup *actionGroup;
-    
+
   Tree *tree;                     /* The underlying tree struct */
   gboolean isMainTree;            /* True if tree is the main tree's root node. */
-    
+
   GtkWidget *treeArea;            /* Drawing widget for the tree */
   GdkRectangle treeRect;          /* Specifies the actual area in which we'll draw the tree within treeAre */
-    
+
   gdouble charWidth;
   gdouble charHeight;
-    
+
   BelvuBuildMethod buildMethod;   /* The build method used to build the tree */
   BelvuDistCorr distCorr;         /* The distance-correction method used to build the tree */
-    
+
   double treeScale;               /* The tree scale (not used if main tree - uses the values in the context instead) */
   double lineWidth;               /* Line width (not used if main tree) */
   gboolean showBranchLen;         /* Whether to display branch lengths (not used if main tree) */
   gboolean showOrganism;          /* Whether to show organism names (not used if main tree) */
-    
+
   GArray *clickableRects;         /* Array of rectangles that associate clickable areas in treeArea to TreeNodes. */
 };
 
@@ -203,11 +204,11 @@ static void onDestroyBelvuTree(GtkWidget *belvuTree)
 
   /* We must remove the tree from the list of spawned windows */
   properties->bc->spawnedWindows = g_slist_remove(properties->bc->spawnedWindows, belvuTree);
-  
+
   /* If it is the main tree, also set the pointer in the context to null */
   if (properties->isMainTree)
     properties->bc->belvuTree = NULL;
-  
+
   if (properties)
     {
       /* Free the properties struct itself */
@@ -219,7 +220,7 @@ static void onDestroyBelvuTree(GtkWidget *belvuTree)
 
 
 /* Create the properties struct and initialise all values. */
-static void belvuTreeCreateProperties(GtkWidget *belvuTree, 
+static void belvuTreeCreateProperties(GtkWidget *belvuTree,
                                       BelvuContext *bc,
                                       Tree *tree,
                                       const gboolean isMainTree,
@@ -234,25 +235,25 @@ static void belvuTreeCreateProperties(GtkWidget *belvuTree,
 
       properties->widget = belvuTree;
       properties->bc = bc;
-      
+
       properties->tree = tree;
       properties->isMainTree = isMainTree;
-      
+
       properties->treeArea = treeArea;
       properties->actionGroup = actionGroup;
-      
+
       properties->buildMethod = buildMethod;
       properties->distCorr = distCorr;
       properties->treeScale = bc->treeScale;
       properties->lineWidth = bc->treeLineWidth;
       properties->showBranchLen = bc->treeShowBranchlen;
       properties->showOrganism = bc->treeShowOrganism;
-      
+
       properties->charHeight = 0;
       properties->charWidth = 0;
 
       properties->clickableRects = g_array_new(FALSE, FALSE, sizeof(ClickableRect));
-      
+
       g_object_set_data(G_OBJECT(belvuTree), "BelvuTreeProperties", properties);
       g_signal_connect(G_OBJECT(belvuTree), "destroy", G_CALLBACK (onDestroyBelvuTree), NULL);
     }
@@ -274,7 +275,7 @@ GtkActionGroup* belvuTreeGetActionGroup(GtkWidget *belvuTree)
 
 
 /* Get the tree scale for this tree. Uses the value from the main context
- * if this is the main belvu tree, or the value stored in the properties 
+ * if this is the main belvu tree, or the value stored in the properties
  * for other trees. */
 static double treeGetScale(BelvuTreeProperties *properties)
 {
@@ -305,9 +306,9 @@ static int BSorder(gconstpointer xIn, gconstpointer yIn)
 {
   const BootstrapGroup *x = (const BootstrapGroup*)xIn;
   const BootstrapGroup *y = (const BootstrapGroup*)yIn;
-  
+
   int result = 0;
-  
+
   if (x && x->s && y && y->s)
     result = strcmp(x->s, y->s);
   else if (x && x->s)
@@ -316,7 +317,7 @@ static int BSorder(gconstpointer xIn, gconstpointer yIn)
     result = -1;
   else
     result = 0;
-  
+
   return result;
 }
 
@@ -325,7 +326,7 @@ static int BSptrorder(gconstpointer xIn, gconstpointer yIn)
 {
   const BootstrapGroup *x = *((const BootstrapGroup**)xIn);
   const BootstrapGroup *y = *((const BootstrapGroup**)yIn);
-  
+
   return BSorder(x, y);
 }
 
@@ -333,65 +334,65 @@ static int BSptrorder(gconstpointer xIn, gconstpointer yIn)
 static BootstrapGroup* createEmptyBootstrapGroup()
 {
   BootstrapGroup *result = new BootstrapGroup;
-  
+
   result->node = NULL;
   result->s = NULL;
-  
+
   return result;
 }
 
 
 /* Combines left and right sequence groups and insert to bootstrap group list */
-static GArray* fillBootstrapGroups(BelvuContext *bc, Tree *tree, TreeNode *node, const gboolean isMainTree) 
+static GArray* fillBootstrapGroups(BelvuContext *bc, Tree *tree, TreeNode *node, const gboolean isMainTree)
 {
   GArray *result = NULL;
-  
+
   BootstrapGroup *BS = createEmptyBootstrapGroup();
-  
+
   if (!node->name)
     {
       /* Internal node */
       /* Combine left node sequences into right node array */
-      
+
       GArray *left = fillBootstrapGroups(bc, tree, node->left, isMainTree);
       GArray *right = fillBootstrapGroups(bc, tree, node->right, isMainTree);
-      
+
       /* Nothing to do for root */
       if (node != tree->head)
-        {      
+        {
           /* Combine left and right groups */
           int i = 0;
-          for (i = 0 ; i < (int)left->len; ++i) 
+          for (i = 0 ; i < (int)left->len; ++i)
             {
               char *s = g_array_index(left, char*, i);
               g_array_append_val(right, s);
               g_array_sort(right, strcmp_);
             }
-          
+
           g_array_unref(left);
-          
+
           /* Create string with group members */
           int ssize = 1;
-          for (i = 0 ; i < (int)right->len ; ++i) 
+          for (i = 0 ; i < (int)right->len ; ++i)
             ssize += (strlen(g_array_index(right, char*, i)) + 1);
-          
+
           BS->s = (char*)g_malloc(ssize+1);
           BS->s[0] = 0;
-          
-          for (i = 0 ; i < (int)right->len ; ++i) 
+
+          for (i = 0 ; i < (int)right->len ; ++i)
             {
               char *ch = g_array_index(right, char*, i);
               strcat(BS->s, ch);
               strcat(BS->s, " ");
             }
-          
+
           /* printf("   New bootstrap group: %s\n", BS->s); */
-          
-          if (isMainTree) 
+
+          if (isMainTree)
             {
               /* Associate this node with the group string */
               BS->node =  node;
-              
+
               /* Add group string to array of bootstrap groups */
               g_array_append_val(bc->bootstrapGroups, BS);
             }
@@ -399,9 +400,9 @@ static GArray* fillBootstrapGroups(BelvuContext *bc, Tree *tree, TreeNode *node,
             {
               /* Find group string and increment counter if exists */
               BootstrapGroup *BS2;
-              
+
               int ip = 0;
-              if (bsArrayFind(bc->bootstrapGroups, BS, &ip, BSptrorder)) 
+              if (bsArrayFind(bc->bootstrapGroups, BS, &ip, BSptrorder))
                 {
                   BS2 = g_array_index(bc->bootstrapGroups, BootstrapGroup*, ip);
                   BS2->node->boot++;
@@ -411,14 +412,14 @@ static GArray* fillBootstrapGroups(BelvuContext *bc, Tree *tree, TreeNode *node,
                 {
                   DEBUG_OUT("Did not find bootgroup %s\n", BS->s);
                 }
-              
+
               if (BS && BS->s)
                 g_free(BS->s);
-              
+
               if (BS)
                 delete BS;
             }
-          
+
           result = right;
         }
     }
@@ -430,12 +431,12 @@ static GArray* fillBootstrapGroups(BelvuContext *bc, Tree *tree, TreeNode *node,
       g_array_sort(leaf, strcmp_);
       result = leaf;
     }
-  
+
   return result;
 }
 
 
-static void normaliseBootstraps(BelvuContext *bc, TreeNode *node) 
+static void normaliseBootstraps(BelvuContext *bc, TreeNode *node)
 {
   node->boot = 100.0 * (double)node->boot/(double)bc->treebootstraps;
 }
@@ -462,9 +463,9 @@ static void treeBootstrapStats(BelvuContext *bc, Tree *tree)
       DEBUG_OUT("%d:  %s\n", i, (bs && bs->s ? bs->s : "null"));
     }
 #endif
-  
+
   treeBootstrap(bc);
-  
+
   /* Turn increments to percentages */
   treeTraverse(bc, tree->head, normaliseBootstraps);
 }
@@ -473,41 +474,41 @@ static void treeBootstrapStats(BelvuContext *bc, Tree *tree)
 void treeBootstrap(BelvuContext *bc)
 {
   separateMarkupLines(bc);
-  
+
   /* We will change the sequence strings in the alignments, so first
    * we must make a copy so we can revert them. */
   GArray *alignArrTmp = copyAlignArray(bc->alignArr);
-  
+
 #if defined(__CYGWIN__) || defined(DARWIN)
   srand(time(0));
 #else
   srand48(time(0));
 #endif
-  
+
   int iter = 0;
-  for (iter = 0; iter < bc->treebootstraps; ++iter) 
+  for (iter = 0; iter < bc->treebootstraps; ++iter)
     {
       /* Make bootstrapped Alignment */
       int i = 0;
-      for (i = 0; i < bc->maxLen; ++i) 
+      for (i = 0; i < bc->maxLen; ++i)
         {
           int src = 0;
-          
+
 #if defined(__CYGWIN__) || defined(DARWIN)
           src = (int)((((double)rand())/RAND_MAX) * bc->maxLen);
 #else
           src = (int)(drand48() * bc->maxLen);
 #endif
-          
+
           columnCopy(bc->alignArr, i, alignArrTmp, src);
         }
-      
+
       /* Create the bootstrap tree */
       Tree* tree = treeMake(bc, FALSE, FALSE);
-      
-      if (bc->outputBootstrapTrees) 
+
+      if (bc->outputBootstrapTrees)
         {
-          if (bc->treebootstrapsDisplay) 
+          if (bc->treebootstrapsDisplay)
             {
               /* The tree window takes ownership of the tree struct */
               createBelvuTreeWindow(bc, tree, FALSE);
@@ -518,7 +519,7 @@ void treeBootstrap(BelvuContext *bc)
               g_message("\n");
               saveTreeNH(tree, tree->head, stdout);
               g_message(";\n");
-              
+
               destroyTree(&tree);
             }
         }
@@ -529,25 +530,25 @@ void treeBootstrap(BelvuContext *bc)
           destroyTree(&tree);
         }
     }
-  
+
   /* Restore alignment */
   int i = 0;
   for (i = 0; i < (int)bc->alignArr->len; ++i)
     {
       ALN *srcAln = g_array_index(alignArrTmp, ALN*, i);
       ALN *destAln = g_array_index(bc->alignArr, ALN*, i);
-      
+
       if (destAln->sequenceStr)
         g_string_free(destAln->sequenceStr, TRUE);
-      
+
       if (srcAln->sequenceStr)
         destAln->sequenceStr = srcAln->sequenceStr; /* take ownership of the sequence string */
-      else 
+      else
         destAln->sequenceStr = NULL;
     }
-  
+
   g_array_free(alignArrTmp, TRUE); /* destroys the array and all its ALN structs */
-  
+
   reInsertMarkupLines(bc);
 }
 
@@ -570,14 +571,14 @@ static void treeReadDistances(BelvuContext *bc, double **pairmtx)
   int    i = 0, j = 0 ;
   double  d;
   char line[MAXLENGTH+1];
-  
+
   while (!feof (bc->treeReadDistancesPipe))
-    { 
+    {
       if (!fgets (line, MAXLENGTH, bc->treeReadDistancesPipe))
 	break;
-      
+
       j = 0;
-      
+
       while ( (p = strtok(j ? 0 : line, " \t")) && !isspace(*p))
 	{
 	  d = atof(p);
@@ -585,93 +586,93 @@ static void treeReadDistances(BelvuContext *bc, double **pairmtx)
 	  pairmtx[i][j] = d;
 	  j++;
 	}
-      
+
       if (j != (int)bc->alignArr->len)
 	g_error("nseq = %d, but read %d distances in row %d\n", bc->alignArr->len, j, i);
-      
+
       i++;
     }
-  
+
   if (j != (int)bc->alignArr->len)
     g_error("nseq = %d, but read %d distance rows\n", bc->alignArr->len, i);
-  
+
   return ;
 }
 
 
 /* Correct an observed distance to an estimated 'true' distance.
- 
+
  Adapted from Lasse Arvestad's lapd program
- 
- od = observed distance in percent 
- 
+
+ od = observed distance in percent
+
  */
 static double treeJUKESCANTOR(double od)
 {
   double cd;
-  
+
   od /= 100;
-  
+
   od = 20.0/19.0*od;
   if  (od > 0.95) od = 0.95; /* Limit to 300 PAM */
-  
+
   cd = -19.0/20.0 * log(1-od);
-  
+
   return cd*100;
 }
 
 
 
 /* Correct an observed distance to an estimated 'true' distance.
- 
+
  Adapted from Lasse Arvestad's lapd program
- 
- od = observed distance in percent 
- 
+
+ od = observed distance in percent
+
  */
 static double treeKimura(double od)
 {
   double adjusted, cd;
-  
+
   od /= 100;
-  
+
   adjusted = od + 0.2 * od*od;
-  
+
   if (adjusted > 0.95) adjusted = 0.95;   /* Limit to 300 PAM */
-  
+
   cd = -log(1 - adjusted);
-  
+
   return cd*100;
 }
 
 
 
 /* Correct an observed distance to an estimated 'true' distance.
- 
+
  Based on Christian Storm's 5th order polynomial curve fitting of ROSE simulated data
- 
- od = observed distance in percent 
- 
+
+ od = observed distance in percent
+
  */
 static double treeSTORMSONN(double od)
 {
   double cd;			/* Corrected distance */
-  
+
   if (od > 91.6) return 1000.0;	/* Otherwise log of negative value below */
-  
+
   od /= 100;
-  
-  cd= -log(1 
-           -0.95844*od 
+
+  cd= -log(1
+           -0.95844*od
            -0.69957*od*od
            +2.4955*od*od*od
            -4.6353*od*od*od*od
            +2.8076*od*od*od*od*od);
-  
+
   /* printf(" od=%f  cd=%f\n", od, cd); */
-  
+
   if (cd > 3.0) cd=3.0; /* Limit to 300 PAM */
-  
+
   return cd*100;
 }
 
@@ -680,26 +681,26 @@ static double treeSCOREDIST(char *seq1, char *seq2, BelvuContext *bc)
 {
   char *s1 = seq1;
   char *s2 = seq2;
-  
-  
+
+
   /* Calc scores */
   int len = 0;
   int sc = 0;
   int s1sc = 0;
   int s2sc = 0;
-  
-  for (len=0; *s1; s1++, s2++) 
+
+  for (len=0; *s1; s1++, s2++)
     {
-      if (bc->penalize_gaps) 
+      if (bc->penalize_gaps)
         {
-          if (isGap(*s1) || isGap(*s2)) sc -= 0.6;	
+          if (isGap(*s1) || isGap(*s2)) sc -= 0.6;
         }
-      
-      if (!isGap(*s1) && !isGap(*s2)) 
+
+      if (!isGap(*s1) && !isGap(*s2))
         {
           int val1 = a2b[(unsigned char)(*s1)];
           int val2 = a2b[(unsigned char)(*s2)];
-          
+
           if (val1 > 0 && val2 > 0)
             {
               sc += (double) BLOSUM62[val1 - 1][val2 - 1];
@@ -710,104 +711,104 @@ static double treeSCOREDIST(char *seq1, char *seq2, BelvuContext *bc)
           len++;
         }
     }
-  
+
   double maxsc = (s1sc + s2sc) / 2.0;
-  
+
   /* Calc expected score */
   double expect =  -0.5209 * len;
-  
+
   double od = ((double)sc - expect) / (maxsc - expect);
-  
+
   if (!len || od < 0.05) od = 0.05;  /* Limit to 300 PAM;  len==0 if no overlap */
-  if (od > 1.0) od = 1.0; 
-  
+  if (od > 1.0) od = 1.0;
+
   double cd = -log(od);
-  
+
   DEBUG_OUT("SCOREDIST: len=%d  sc=%d  maxsc=%.2f  expect=%.2f  maxsc-expect=%.2f  od=%.3f\n", len, sc, maxsc, expect, maxsc-expect, od);
-  
+
   cd = cd * 100.0 * 1.337 /* Magic scaling factor optimized for Dayhoff data */ ;
-  
+
   if (cd > 300) cd = 300;  /* Limit to 300 PAM */
-  
+
   /*    if (!bc->penalize_gaps) {
    g_free(s1);
    g_free(s2);
    } */
-  
+
   return cd;
 }
 
 
 
 /* Sum branchlengths, allow going up parents
- 
+
  If going up parents, arg1 = parent  ;  arg2 = child.
- 
+
  If you're not interested in going up parents, simply call me with
  the same node in both arguments.
- 
+
  */
-static double treeSize3way(TreeNode *node, TreeNode *fromnode) 
+static double treeSize3way(TreeNode *node, TreeNode *fromnode)
 {
   int root = 0;
   TreeNode *left = NULL;
   TreeNode *right = NULL;
   double len = 0.0;
-  
-  if (!node) 
+
+  if (!node)
     return 0.0;
-  
+
   /* Get the correct branch length */
   if (node->left == fromnode || node->right == fromnode) /* Going up the tree */
     len = fromnode->branchlen;
   else
     len = node->branchlen;
-  
-  if (node->left == fromnode) 
+
+  if (node->left == fromnode)
     {
       left = node->parent;
-      if (!left) 
+      if (!left)
         root = 1;
     }
   else
     {
       left = node->left;
     }
-  
-  if (node->right == fromnode) 
+
+  if (node->right == fromnode)
     {
       right = node->parent;
-      if (!right) 
+      if (!right)
         root = 1;
     }
-  else 
+  else
     {
       right = node->right;
     }
-  
+
   if (root)
     {
       double retval;
-      
+
       /* go across tree root */
       if (left) /* Coming from right */
         retval = treeSize3way(left, left);
       else  /* Coming from left */
         retval = treeSize3way(right, right);
-      
+
       DEBUG_OUT("Returning (%.1f + %.1f) = %.1f\n", fromnode->branchlen, retval, fromnode->branchlen + retval);
-      
+
       return fromnode->branchlen + retval;
     }
-  else 
+  else
     {
-      double 
+      double
       l = treeSize3way(left, node),
       r = treeSize3way(right, node),
       retval = (l + r)/2.0 + len;
-      
+
       DEBUG_OUT("Returning (%.1f + %.1f)/2 + %.1f = %.1f\n", l, r, len, retval);
-      
+
       return retval;
     }
 }
@@ -815,36 +816,36 @@ static double treeSize3way(TreeNode *node, TreeNode *fromnode)
 
 /* Calculate the difference between left and right trees if the tree
  were to be rerooted at this node.
- 
+
  What is calculated (bal) is the difference between 'left' and
  'right' subtrees minus the length of the branch itself. If this
  difference is negative, a perfectly balanced tree can be made.  For
  imperfectly balanced trees we want to root at the branch that gives
  the best balance.  However, perfectly balanced trees are all
  'perfect' so here we chose the branch with most equal subtrees.
- 
+
  Actually it is not "left" and "right" but "down" and "up" subtrees.  */
-static void treeCalcBalance(BelvuContext *bc, TreeNode *node) 
+static void treeCalcBalance(BelvuContext *bc, TreeNode *node)
 {
   double bal, lweight, rweight;
-  
-  if (node == bc->treeBestBalancedNode) 
+
+  if (node == bc->treeBestBalancedNode)
     return;
-  
+
   DEBUG_OUT("Left/Downstream weight\n");
-  
+
   lweight = treeSize3way(node, node);
-  
+
   DEBUG_OUT("Right/Upstream weight\n");
-  
+
   rweight = treeSize3way(node->parent, node);
-  
+
   bal = fabsf(lweight - rweight) - node->branchlen;
-  
-  DEBUG_OUT("Node=%s (branchlen = %.1f).  Weights = %.1f  %.1f. Bal = %.1f\n", 
+
+  DEBUG_OUT("Node=%s (branchlen = %.1f).  Weights = %.1f  %.1f. Bal = %.1f\n",
             node->name, node->branchlen, lweight, rweight, bal);
-  
-  if (bal < bc->treeBestBalance) 
+
+  if (bal < bc->treeBestBalance)
     { /* better balance */
       if (bc->treeBestBalance > 0.0 ||
           /* If previous tree was not perfectly balanced, or
@@ -852,7 +853,7 @@ static void treeCalcBalance(BelvuContext *bc, TreeNode *node)
           fabsf(lweight - rweight) < bc->treeBestBalance_subtrees)
         {
           DEBUG_OUT("            %s has better balance %.1f < %.1f\n", node->name, bal, bc->treeBestBalance);
-          
+
           bc->treeBestBalancedNode = node;
           bc->treeBestBalance = bal;
           bc->treeBestBalance_subtrees = fabsf(lweight - rweight);
@@ -863,7 +864,7 @@ static void treeCalcBalance(BelvuContext *bc, TreeNode *node)
 
 static TreeNode *treeParent2leaf(TreeNode *newparent, TreeNode *curr)
 {
-  if (!curr->parent) 
+  if (!curr->parent)
     { /* i.e. the old root */
       if (curr->left == newparent)
         {
@@ -875,10 +876,10 @@ static TreeNode *treeParent2leaf(TreeNode *newparent, TreeNode *curr)
           newparent->branchlen += curr->left->branchlen;
           return curr->left;
         }
-    } 
+    }
   else
     {
-      if (curr->left == newparent) 
+      if (curr->left == newparent)
         {
           /* Change the link to the new parent to the old parent */
           curr->left = treeParent2leaf(curr, curr->parent);
@@ -890,34 +891,34 @@ static TreeNode *treeParent2leaf(TreeNode *newparent, TreeNode *curr)
           curr->right->branchlen = curr->branchlen;
         }
     }
-  
+
   return curr;
 }
 
 
 /* Balance the two sides of a tree branch by the weights of the two subtrees.
  The branch has two sides: llen and rlen.
- 
+
  Rationale: The correct center point balances the treesizes on both sides.
- 
+
  Method: Calculate half the unbalance, add it to the appropriate side.
- 
- No real theory for this, but it seems to work in easy cases 
+
+ No real theory for this, but it seems to work in easy cases
  */
 static void treeBalanceByWeight(TreeNode *lnode, TreeNode *rnode, double *llen, double *rlen)
 {
   double adhocRatio = 0.95;
-  
-  double 
-  halfbal, 
+
+  double
+  halfbal,
   branchlen = *rlen+*llen;
   double lweight = treeSize3way(lnode, lnode) /*- lnode->branchlen*/;
   double rweight = treeSize3way(rnode, rnode) /*- rnode->branchlen*/;
-  
+
   halfbal = fabsf(lweight-rweight) / 2.0;
-  
+
   if (halfbal < *llen && halfbal < *rlen) {
-    
+
     if (lweight < rweight) {
       *llen += halfbal;
       *rlen -= halfbal;
@@ -944,9 +945,9 @@ static void treeBalanceByWeight(TreeNode *lnode, TreeNode *rnode, double *llen,
 
 static void fillParents(TreeNode *parent, TreeNode *node)
 {
-  if (!node) 
+  if (!node)
     return;
-  
+
   node->parent = parent;
   fillParents(node, node->left);
   fillParents(node, node->right);
@@ -955,20 +956,20 @@ static void fillParents(TreeNode *parent, TreeNode *node)
 
 static char *fillOrganism(TreeNode *node)
 {
-  char 
+  char
   *leftorganism,
   *rightorganism;
-  
-  if (node->name) 
+
+  if (node->name)
     return node->organism;
-  
+
   leftorganism = fillOrganism(node->left);
   rightorganism = fillOrganism(node->right);
-  
+
   /* printf("\nFill: (left=%s, right=%s):  ", leftorganism, rightorganism); */
-  
+
   node->organism = (leftorganism == rightorganism ? leftorganism : NULL);
-  
+
   return node->organism;
 }
 
@@ -977,7 +978,7 @@ static char *fillOrganism(TreeNode *node)
 static TreeNode* createEmptyTreeNode()
 {
   TreeNode *result = (TreeNode*)g_malloc(sizeof *result);
-  
+
   result->dist = 0.0;
   result->branchlen = 0.0;
   result->boot = 0.0;
@@ -989,7 +990,7 @@ static TreeNode* createEmptyTreeNode()
   result->aln = NULL;
   result->box = 0;
   result->color = 0;
-  
+
   return result;
 }
 
@@ -1021,7 +1022,7 @@ static void destroyTreeNode(TreeNode **node)
 static void treeSwapNode(TreeNode *node)
 {
   void *tmp;
-  
+
   tmp = node->left;
   node->left = node->right;
   node->right = (TreeNode*)tmp;
@@ -1029,8 +1030,8 @@ static void treeSwapNode(TreeNode *node)
 
 
 /* Rerooting works roughly this way:
- 
- - A new node is created with one child being the node chosen as new root 
+
+ - A new node is created with one child being the node chosen as new root
  and the other child the previous parent of it.  The sum of left and right
  branch lengths of the new root should equal the branch length of the chosen node.
  - All previous parent nodes are visited and converted so that:
@@ -1039,24 +1040,24 @@ static void treeSwapNode(TreeNode *node)
  3. The branchlength of the previous parent node is assigned to its parent.
  - When the previous root is reached, it is deleted and the other child
  becomes the child of the calling node.
- 
- Note that treeReroot destroys the old tree, since it reuses the nodes.  
+
+ Note that treeReroot destroys the old tree, since it reuses the nodes.
  Use treecpy if you still need it for something later.
  */
 static TreeNode *treeReroot(TreeNode *node)
 {
   TreeNode *newroot = createEmptyTreeNode();
-  
+
   newroot->left = node;
   newroot->right = treeParent2leaf(node, node->parent);
-  
+
   fillParents(newroot, newroot->left);
   fillParents(newroot, newroot->right);
-  
+
   newroot->left->branchlen = newroot->right->branchlen = node->branchlen / 2.0;
-  treeBalanceByWeight(newroot->left, newroot->right, 
+  treeBalanceByWeight(newroot->left, newroot->right,
                       &newroot->left->branchlen, &newroot->right->branchlen);
-  
+
   return newroot;
 }
 
@@ -1069,21 +1070,21 @@ static gboolean doublesEqual(const double a, const double b)
 
 /* Find the node which has most equal balance, return new tree with this as root.
  */
-static TreeNode *treeFindBalance(BelvuContext *bc, TreeNode *node) 
+static TreeNode *treeFindBalance(BelvuContext *bc, TreeNode *node)
 {
   double lweight = treeSize3way(node->left, node->left);
   double rweight = treeSize3way(node->right, node->right);
-  
+
   bc->treeBestBalancedNode = node;
   bc->treeBestBalance = fabsf(lweight - rweight);
-  
-  bc->treeBestBalance_subtrees = 
+
+  bc->treeBestBalance_subtrees =
   fabsf((lweight - node->left->branchlen) - (rweight - node->right->branchlen));
-  
+
   DEBUG_OUT("Initial weights = %.1f  %.1f. Bal = %.1f\n", lweight, rweight, bc->treeBestBalance);
-  
+
   treeTraverse(bc, node, treeCalcBalance);
-  
+
   if (bc->treeBestBalancedNode == node)
     return node;
   else
@@ -1098,28 +1099,28 @@ static void calcPairwiseDistMatrix(BelvuContext *bc, double **pairmtx)
    * the portion of the array above the diagonal (where j > i); the other
    * values are left uninitialised and should not be used. */
   arrayOrder(bc->alignArr);
-  
+
   int i = 0;
   for (i = 0; i < (int)bc->alignArr->len - 1; ++i)
     {
       ALN *aln_i = g_array_index(bc->alignArr, ALN*, i);
       char *alniSeq = alnGetSeq(aln_i);
-      
+
       int j = i+1;
       for (j = i+1; j < (int)bc->alignArr->len; ++j)
         {
           ALN *aln_j = g_array_index(bc->alignArr, ALN*, j);
           char *alnjSeq = alnGetSeq(aln_j);
-          
+
           pairmtx[i][j] = 100.0 - percentIdentity(alniSeq, alnjSeq, bc->penalize_gaps);
-          
-          if (bc->treeDistCorr == KIMURA) 
+
+          if (bc->treeDistCorr == KIMURA)
             pairmtx[i][j] = treeKimura(pairmtx[i][j]);
-          else if (bc->treeDistCorr == JUKESCANTOR) 
+          else if (bc->treeDistCorr == JUKESCANTOR)
             pairmtx[i][j] = treeJUKESCANTOR(pairmtx[i][j]);
-          else if (bc->treeDistCorr == STORMSONN) 
+          else if (bc->treeDistCorr == STORMSONN)
             pairmtx[i][j] = treeSTORMSONN(pairmtx[i][j]);
-          else if (bc->treeDistCorr == SCOREDIST) 
+          else if (bc->treeDistCorr == SCOREDIST)
             pairmtx[i][j] = treeSCOREDIST(alniSeq, alnjSeq, bc);
         }
     }
@@ -1132,9 +1133,9 @@ static void printTreeDistances(BelvuContext *bc, double **pairmtx)
   double dist;
 
   int i = 0;
-  for (i = 0; i < (int)bc->alignArr->len; i++) 
+  for (i = 0; i < (int)bc->alignArr->len; i++)
     {
-      if (!bc->treeCoordsOn) 
+      if (!bc->treeCoordsOn)
         {
           g_message("%s\t", g_array_index(bc->alignArr, ALN*, i)->name);
         }
@@ -1147,19 +1148,19 @@ static void printTreeDistances(BelvuContext *bc, double **pairmtx)
         }
     }
   g_message ("\n");
-  
-  for (i = 0; i < (int)bc->alignArr->len; ++i) 
+
+  for (i = 0; i < (int)bc->alignArr->len; ++i)
     {
       int j = 0;
-      for (j = 0; j < (int)bc->alignArr->len; ++j) 
+      for (j = 0; j < (int)bc->alignArr->len; ++j)
         {
-          if (i == j) 
+          if (i == j)
             dist = 0.0;
           else if (i < j)
             dist = pairmtx[i][j];
           else
             dist = pairmtx[j][i];
-          
+
           g_message("%7.3f\t", dist);
         }
       g_message ("\n");
@@ -1169,16 +1170,16 @@ static void printTreeDistances(BelvuContext *bc, double **pairmtx)
 
 #ifdef DEBUG
 /* Print the given matrix */
-static void printMtx(BelvuContext *bc, double **mtx) 
+static void printMtx(BelvuContext *bc, double **mtx)
 {
   int i, j;
-  
+
   g_message ("\n");
-  for (i = 0; i < bc->alignArr->len; i++) 
+  for (i = 0; i < bc->alignArr->len; i++)
     {
       for (j = 0; j < bc->alignArr->len; j++)
         g_message("%6.2f ", mtx[i][j]);
-      
+
       g_message ("\n");
   }
 }
@@ -1188,16 +1189,16 @@ static void printMtx(BelvuContext *bc, double **mtx)
 static void printTreeStats(BelvuContext *bc, double **pairmtx, double *avgdist, double **Dmtx, TreeNode **node)
 {
   g_message("Node status, Avg distance:\n");
-  
+
   int i = 0;
   for (i = 0; i < bc->alignArr->len; i++)
-    g_message("%6d ", (node[i] ? 1 : 0)); 
-  
+    g_message("%6d ", (node[i] ? 1 : 0));
+
   g_message("\n");
-  
+
   for (i = 0; i < bc->alignArr->len; i++)
-    g_message("%6.2f ", avgdist[i]); 
-  
+    g_message("%6.2f ", avgdist[i]);
+
   g_message("\n\nPairdistances, corrected pairdistances:");
   printMtx(bc, pairmtx);
   printMtx(bc, Dmtx);
@@ -1210,37 +1211,37 @@ static void printTreeStats(BelvuContext *bc, double **pairmtx, double *avgdist,
 static void constructTreeNJ(BelvuContext *bc, double **pairmtx, double *avgdist, TreeNode **node, double **Dmtx)
 {
   int count = 0;
-  
+
   /* Calculate vector r (avgdist) */
   int i = 0;
   for (i = 0; i < (int)bc->alignArr->len; ++i)
     {
-      if (!node[i]) 
+      if (!node[i])
         continue;
-      
+
       avgdist[i] = 0.0;
-      
+
       int j = 0;
       for (count=0, j = 0; j < (int)bc->alignArr->len; j++)
         {
-          if (!node[j]) 
+          if (!node[j])
             continue;
-          
+
           if (i < j)
             avgdist[i] += pairmtx[i][j];
           else if (i > j)
             avgdist[i] += pairmtx[j][i];
-          
+
           count++;
         }
-      
+
       if (count == 2)	/* Hack, to accommodate last node */
         avgdist[i] = 1;
       else
         avgdist[i] /= 1.0*(count - 2);
     }
-  
-  /* Calculate corrected matrix Dij. Note again that only values 
+
+  /* Calculate corrected matrix Dij. Note again that only values
    * above the diagonal (where j > i) are populated; other values
    * are uninitialised and should not be used. */
   if (1 /* gjm */)
@@ -1249,13 +1250,13 @@ static void constructTreeNJ(BelvuContext *bc, double **pairmtx, double *avgdist,
         {
           if (!node[i])
             continue;
-          
+
           int j = i+1;
           for (j = i+1; j < (int)bc->alignArr->len; ++j)
             {
-              if (!node[j]) 
+              if (!node[j])
                 continue;
-              
+
               Dmtx[i][j] = pairmtx[i][j] - (avgdist[i] + avgdist[j]);
             }
         }
@@ -1263,35 +1264,35 @@ static void constructTreeNJ(BelvuContext *bc, double **pairmtx, double *avgdist,
   else
     {		/* Felsenstein */
       double Q = 0.0;
-      
+
       for (i = 0; i < (int)bc->alignArr->len - 1; ++i)
         {
           if (!node[i])
             continue;
-          
+
           int j = i+1;
           for (j = i+1; j < (int)bc->alignArr->len; j++)
             {
-              if (!node[j]) 
+              if (!node[j])
                 continue;
-              
+
               Q += pairmtx[i][j];
             }
         }
-      
+
       for (i = 0; i < (int)bc->alignArr->len - 1; ++i)
         {
           if (!node[i])
             continue;
-          
+
           int j = i+1;
           for (j = i+1; j < (int)bc->alignArr->len; j++)
             {
               if (!node[j])
                 continue;
-              
+
               Dmtx[i][j] = (pairmtx[i][j] +
-                            (2.0*Q)/(count-(count == 2 ? 1 : 2)) - 
+                            (2.0*Q)/(count-(count == 2 ? 1 : 2)) -
                             avgdist[i] - avgdist[j]) / 2.0;
             }
         }
@@ -1308,26 +1309,26 @@ static double treeFindSmallestDist(BelvuContext *bc, double **pairmtx, double **
   double pmaxid = 1000000;
 
   int i = 0;
-  for (i = 0; i < (int)bc->alignArr->len - 1; ++i) 
+  for (i = 0; i < (int)bc->alignArr->len - 1; ++i)
     {
-      if (!node[i]) 
+      if (!node[i])
         continue;
-      
+
       int j = i+1;
-      for (j = i+1; j < (int)bc->alignArr->len; ++j) 
+      for (j = i+1; j < (int)bc->alignArr->len; ++j)
         {
-          if (!node[j]) 
+          if (!node[j])
             continue;
-          
+
           /* printf("iter %d, i=%d. j=%d, dist= %f\n", iter, i, j, curMtx[i][j]);*/
-          if (curMtx[i][j] < maxid) 
+          if (curMtx[i][j] < maxid)
             {
               maxid = curMtx[i][j];
               pmaxid = pairmtx[i][j];
               maxi = i;
               maxj = j;
             }
-          else if (bc->treeMethod == NJ && doublesEqual(Dmtx[i][j], maxid) && pairmtx[i][j] < pmaxid) 
+          else if (bc->treeMethod == NJ && doublesEqual(Dmtx[i][j], maxid) && pairmtx[i][j] < pmaxid)
             {
               /* To resolve ties - important for tree look! */
               maxi = i;
@@ -1336,15 +1337,15 @@ static double treeFindSmallestDist(BelvuContext *bc, double **pairmtx, double **
             }
         }
     }
-  
+
   maxid = pairmtx[maxi][maxj]; /* Don't want to point to Dmtx in NJ */
-  
+
   if (maxiOut)
     *maxiOut = maxi;
-  
+
   if (maxjOut)
     *maxjOut = maxj;
-  
+
   return maxid;
 }
 
@@ -1366,7 +1367,7 @@ Tree* treeMake(BelvuContext *bc, const gboolean doBootstrap, const gboolean disp
 
   TreeNode *newnode = NULL ;
   int maxi = -1, maxj = -1;
-  double maxid = 0.0, **pairmtx, **Dmtx, **curMtx, *src, *trg, 
+  double maxid = 0.0, **pairmtx, **Dmtx, **curMtx, *src, *trg,
   *avgdist,		/* vector r in Durbin et al */
   llen = 0, rlen = 0;
   TreeNode **nodes;   /* Array of (primary) nodes.  Value=0 => stale column */
@@ -1376,7 +1377,7 @@ Tree* treeMake(BelvuContext *bc, const gboolean doBootstrap, const gboolean disp
 
   /* Allocate memory */
   BlxHandle localHandle = handleCreate(); /* handles local memory that will be free'd before we return */
-  
+
   nodes = (TreeNode**)handleAlloc(&localHandle, bc->alignArr->len * sizeof(TreeNode *));
   pairmtx = (double**)handleAlloc(&localHandle, bc->alignArr->len * sizeof(double *));
   Dmtx = (double**)handleAlloc(&localHandle, bc->alignArr->len * sizeof(double *));
@@ -1392,12 +1393,12 @@ Tree* treeMake(BelvuContext *bc, const gboolean doBootstrap, const gboolean disp
 
       nodes[i] = createEmptyTreeNode();
       nodes[i]->name =  (char*)g_malloc(strlen(aln_i->name) + 50);
-      
-      if (!bc->treeCoordsOn) 
+
+      if (!bc->treeCoordsOn)
         sprintf(nodes[i]->name, "%s", aln_i->name);
       else
         sprintf(nodes[i]->name, "%s/%d-%d", aln_i->name, aln_i->start, aln_i->end);
-      
+
       nodes[i]->aln = aln_i;
       nodes[i]->organism = aln_i->organism;
     }
@@ -1409,16 +1410,16 @@ Tree* treeMake(BelvuContext *bc, const gboolean doBootstrap, const gboolean disp
     calcPairwiseDistMatrix(bc, pairmtx);
 
   /* If requested (or if debug is on), print the distance matrix */
-  if (bc->treePrintDistances) 
+  if (bc->treePrintDistances)
     {
       printTreeDistances(bc, pairmtx);
       exit(0);
-    }  
+    }
 
 #ifdef DEBUG
   printTreeDistances(bc, pairmtx);
 #endif
-  
+
   /* Construct the tree */
   int iter = 0;
   for (iter = 0; iter < (int)bc->alignArr->len - 1; ++iter)
@@ -1428,15 +1429,15 @@ Tree* treeMake(BelvuContext *bc, const gboolean doBootstrap, const gboolean disp
           constructTreeNJ(bc, pairmtx, avgdist, nodes, Dmtx);
           curMtx = Dmtx;
         }
-      else 
+      else
         {
           curMtx = pairmtx;
         }
-      
+
 #ifdef DEBUG
       printTreeStats(bc, pairmtx, avgdist, Dmtx, nodes);
 #endif
-      
+
       /* Find smallest distance pair in pairmtx */
       maxid = treeFindSmallestDist(bc, pairmtx, curMtx, Dmtx, nodes, &maxi, &maxj);
 
@@ -1446,39 +1447,39 @@ Tree* treeMake(BelvuContext *bc, const gboolean doBootstrap, const gboolean disp
         {
           if (!nodes[i])
             continue;
-          
-          if (i < maxi) 
+
+          if (i < maxi)
             trg = &pairmtx[i][maxi];
-          else if (i > maxi) 
+          else if (i > maxi)
             trg = &pairmtx[maxi][i];
           else continue;
-          
-          if (i < maxj) 
+
+          if (i < maxj)
             src = &pairmtx[i][maxj];
-          else if (i > maxj) 
+          else if (i > maxj)
             src = &pairmtx[maxj][i];
           else continue;
-          
-          if (bc->treeMethod == UPGMA) 
+
+          if (bc->treeMethod == UPGMA)
             *trg = (*trg + *src) / 2.0;
           else
             *trg = (*trg + *src - maxid) / 2.0;
         }
-      
+
       /* Create node for maxi and maxj */
       newnode = createEmptyTreeNode();
-      
+
       if (bc->treeMethod == UPGMA)
         {
           /* subtract lower branch lengths from absolute distance
            Horribly ugly, only to be able to share code UPGMA and NJ */
           TreeNode *tmpnode = nodes[maxi]->left;
-          
+
           for (llen = maxid; tmpnode; tmpnode = tmpnode->left)
             llen -= tmpnode->branchlen;
-          
+
           tmpnode = nodes[maxj]->right;
-          
+
           for (rlen = maxid; tmpnode; tmpnode = tmpnode->right)
             rlen -= tmpnode->branchlen;
         }
@@ -1486,46 +1487,46 @@ Tree* treeMake(BelvuContext *bc, const gboolean doBootstrap, const gboolean disp
         {
           llen = (maxid + avgdist[maxi] - avgdist[maxj]) / 2.0;
           rlen = maxid - llen;
-          
+
           if (iter == (int)bc->alignArr->len - 2)
             { /* Root node */
-              
+
               /* Not necessary anymore, the tree is re-balanced at the end which calls this too
                treeBalanceByWeight(node[maxi], node[maxj], &llen, &rlen);*/
-              
-              /* Put entire length of root branch in one leg so the rebalancing 
+
+              /* Put entire length of root branch in one leg so the rebalancing
                will work properly (otherwise it is hard to take this branch into account */
               rlen += llen;
               llen = 0;
             }
         }
-      
+
       DEBUG_OUT("Iter %d: Merging %d and %d, dist= %f\n", iter, maxi+1, maxj+1, curMtx[maxi][maxj]);
       DEBUG_OUT("maxid= %f  llen= %f  rlen= %f\n", maxid, llen, rlen);
       DEBUG_OUT("avgdist[left]= %f  avgdist[right]= %f\n\n", avgdist[maxi], avgdist[maxj]);
-      
+
       newnode->left = nodes[maxi];
       newnode->left->branchlen = llen;
-      
+
       newnode->right = nodes[maxj];
       newnode->right->branchlen = rlen;
-      
+
       newnode->organism = (nodes[maxi]->organism == nodes[maxj]->organism ?
                            nodes[maxi]->organism : NULL);
-      
+
       nodes[maxi] = newnode;
       nodes[maxj] = NULL;
     }
 
   fillParents(newnode, newnode->left);
   fillParents(newnode, newnode->right);
-  
+
   if (bc->treeMethod == UPGMA)
     newnode->branchlen = 100 - maxid ;
-  
+
   if (bc->treeMethod == NJ)
     newnode = treeFindBalance(bc, newnode) ;
-  
+
   fillOrganism(newnode);
 
   /* Set the newnode to be the root node of the tree */
@@ -1534,16 +1535,16 @@ Tree* treeMake(BelvuContext *bc, const gboolean doBootstrap, const gboolean disp
   /* Clean up locally allocated memory */
   handleDestroy(&localHandle);
 
-  if (doBootstrap && bc->treebootstraps) 
+  if (doBootstrap && bc->treebootstraps)
     treeBootstrapStats(bc, tree);
-  
+
   setBusyCursor(bc, FALSE);
-  
+
   if (displayFeedback)
     {
       g_message_info("Finished calculating tree.\n");
     }
-  
+
   return tree;
 }
 
@@ -1552,51 +1553,51 @@ Tree* treeMake(BelvuContext *bc, const gboolean doBootstrap, const gboolean disp
  *                   Find Orthologs                        *
  ***********************************************************/
 
-static void treePrintNode(BelvuContext *bc, TreeNode *node) 
+static void treePrintNode(BelvuContext *bc, TreeNode *node)
 {
-  if (node->name) 
+  if (node->name)
     g_message("%s ", node->name);
 }
 
 
-static gboolean treePrintOrthologsRecur(BelvuContext *bc, TreeNode *node) 
+static gboolean treePrintOrthologsRecur(BelvuContext *bc, TreeNode *node)
 {
   gboolean found = FALSE;
-  
-  if (!node || !node->left || !node->right) 
+
+  if (!node || !node->left || !node->right)
     return found;
-  
+
   DEBUG_OUT("\n 1 (%s, seq=%s):  ", node->left->organism, node->left->name);
   DEBUG_OUT("\n 2 (%s, seq=%s)\n: ", node->right->organism, node->right->name);
-  
+
   if (node->left->organism && node->right->organism &&
-      node->left->organism != node->right->organism) 
+      node->left->organism != node->right->organism)
     {
       found = TRUE;
-      
+
       g_message("\nSpecies 1 (%s):  ", node->left->organism);
       treeTraverse(bc, node->left, treePrintNode);
       g_message("\nSpecies 2 (%s): ", node->right->organism);
       treeTraverse(bc, node->right, treePrintNode);
       g_message("\n");
     }
-  else 
+  else
     {
       if (treePrintOrthologsRecur(bc, node->left))
         found = TRUE;
-      
+
       if (treePrintOrthologsRecur(bc, node->right))
         found = TRUE;
     }
-  
+
   return found;
 }
 
 
-void treePrintOrthologs(BelvuContext *bc, GtkWidget *treeWindow) 
+void treePrintOrthologs(BelvuContext *bc, GtkWidget *treeWindow)
 {
   BelvuTreeProperties *properties = belvuTreeGetProperties(treeWindow);
-  
+
   if (properties->tree == NULL)
     {
       g_critical("Tree has not been calculated.\n");
@@ -1627,16 +1628,16 @@ void belvuTreeRemakeTree(GtkWidget *belvuTree)
 
   /* Re-make the tree */
   separateMarkupLines(bc);
-  
+
   Tree *newTree = treeMake(bc, TRUE, TRUE);
-  
-  /* Update the contents of our tree with the new member variables (we don't 
-   * change the actual tree pointer if it already exists because the context 
+
+  /* Update the contents of our tree with the new member variables (we don't
+   * change the actual tree pointer if it already exists because the context
    * may point to the same tree struct). */
   if (properties->tree)
     {
       destroyTreeContents(properties->tree);
-      
+
       if (newTree)
         {
           properties->tree->head = newTree->head;
@@ -1648,16 +1649,16 @@ void belvuTreeRemakeTree(GtkWidget *belvuTree)
     {
       properties->tree = newTree;
     }
-  
+
   reInsertMarkupLines(bc);
-  
+
   /* Make sure our properties are up to date with the data used to create
    * the new tree. */
   properties->buildMethod = bc->treeMethod;
   properties->distCorr = bc->treeDistCorr;
-  
+
   calculateBelvuTreeBorders(belvuTree);
-  
+
   /* If the alignment is sorted by tree and we've changed the main belvu tree's
    * order, we need to refresh the sort order */
   if (properties->isMainTree)
@@ -1670,11 +1671,11 @@ static void belvuTreeUpdateSettings(BelvuContext *bc, GtkWidget *treeWindow)
 {
   if (!treeWindow)
     return;
-  
+
   /* The tree window exists, so must be updated */
   BelvuTreeProperties *properties = belvuTreeGetProperties(treeWindow);
   g_assert(properties);
-  
+
   if (properties->tree == NULL || properties->tree->head == NULL)
     {
       /* The underlying tree has been invalidated, so we'll need to re-make
@@ -1696,7 +1697,7 @@ void belvuTreeRedrawAll(gpointer widget, gpointer data)
 {
   if (!widget || !stringsEqual(gtk_widget_get_name(GTK_WIDGET(widget)), BELVU_TREE_WINDOW_NAME, TRUE))
     return;
-  
+
   GtkWidget *belvuTree = GTK_WIDGET(widget);
   BelvuTreeProperties *properties = belvuTreeGetProperties(belvuTree);
 
@@ -1717,12 +1718,12 @@ static void createClickableRect(BelvuTreeProperties *properties,
 
   clickRect.node = node;
   clickRect.isBranch = isBranch;
-  
+
   clickRect.rect.x = x;
   clickRect.rect.y = y;
   clickRect.rect.width = width;
   clickRect.rect.height = height;
-  
+
   g_array_append_val(properties->clickableRects, clickRect);
 }
 
@@ -1731,71 +1732,71 @@ static void createClickableRect(BelvuTreeProperties *properties,
  Note: must be in sync with treeDrawNodeBox, which draws clickable
  boxes first.
  */
-static double treeDrawNode(BelvuContext *bc, 
+static double treeDrawNode(BelvuContext *bc,
                            GtkWidget *widget,
-                           GdkDrawable *drawable, 
-                           GdkGC *gc, 
+                           GdkDrawable *drawable,
+                           GdkGC *gc,
                            BelvuTreeProperties *properties,
-                           GdkColor *defaultColor, 
-                           TreeNode *node, 
-                           double x) 
+                           GdkColor *defaultColor,
+                           TreeNode *node,
+                           double x)
 {
   double y, yl, yr;
-  
-  if (!node) 
+
+  if (!node)
     return 0.0;
-  
+
   const int curX = x + roundNearest(node->branchlen * (double)(treeGetScale(properties) * properties->charWidth));
 
   GdkGC *leftGc = gdk_gc_new(drawable);
   gdk_gc_copy(leftGc, gc);
   yl = treeDrawNode(bc, widget, drawable, leftGc, properties, defaultColor, node->left, curX);
-  
+
   gdk_gc_set_foreground(gc, defaultColor);
   yr = treeDrawNode(bc, widget, drawable, gc, properties, defaultColor, node->right, curX);
-  
+
   GdkGC *gcTmp = gdk_gc_new(drawable);
   gdk_gc_set_foreground(gcTmp, defaultColor);
 
-  if (yl) 
+  if (yl)
     {
       /* internal node */
       y = (yl + yr) / 2.0;
-      
+
       /* connect children */
       gdk_draw_line(drawable, gc, curX, yr, curX, y);
       gdk_gc_copy(gc, leftGc);
       gdk_draw_line(drawable, gc, curX, yl, curX, y);
-      
+
       if (node->left->organism != node->right->organism)
         {
           /* Reset color */
           gdk_gc_set_foreground(gc, defaultColor);
         }
     }
-  else 
+  else
     {
       /* Sequence name */
       const gboolean isSelected = (bc->selectedAln && bc->selectedAln == node->aln);
-      
+
       y = bc->tree_y * properties->charHeight;
       bc->tree_y++;
-      
-      if (bc->treeColorsOn && node->organism) 
+
+      if (bc->treeColorsOn && node->organism)
         {
           /* Get the color for this organism */
           ALN aln;
           initAln(&aln);
-          
+
           aln.organism = node->organism;
-          
+
           int ip = 0;
-          if (alnArrayFind(bc->organismArr, &aln, &ip, organism_order)) 
+          if (alnArrayFind(bc->organismArr, &aln, &ip, organism_order))
             {
               GdkColor color;
               int colorNum = g_array_index(bc->organismArr, ALN*, ip)->color;
               convertColorNumToGdkColor(colorNum, FALSE, &color); /* we currently don't change the text color when the node is selected */
-              
+
               gdk_gc_set_foreground(gc, &color);
 	    }
 	}
@@ -1804,7 +1805,7 @@ static double treeDrawNode(BelvuContext *bc,
           /* Just use the default color */
           gdk_gc_set_foreground(gc, defaultColor);
         }
-      
+
       /* Draw the sequence name */
       int nameWidth = 0, nameHeight = 0;
       const int textX = curX + DEFAULT_XPAD;
@@ -1817,10 +1818,10 @@ static double treeDrawNode(BelvuContext *bc,
           /* Highlight this node */
           GdkColor color;
           convertColorNumToGdkColor(node->aln->color, isSelected, &color);
-          
+
           gdk_gc_set_foreground(gcTmp, &color);
           gdk_draw_rectangle(drawable, gcTmp, TRUE, textX - DEFAULT_XPAD/2, textY - 1, nameWidth + DEFAULT_XPAD, nameHeight + 2);
-          
+
           /* This is a bit hacky because it re-draws text we've already drawn because it was covered by the
            * background. We should rearrange things slightly so that we can get nameWidth and nameHeight another
            * way so we can avoidthis, but it's a very small performance hit so not worth worrying about. */
@@ -1828,31 +1829,31 @@ static double treeDrawNode(BelvuContext *bc,
           gdk_gc_set_foreground(gcTmp, fgColor);
           drawText(widget, drawable, gcTmp, curX + DEFAULT_XPAD, y - properties->charHeight / 2, node->name, NULL, NULL);
         }
-      
+
       /* Make a clickable box for the sequence name */
       createClickableRect(properties, node, textX, textY, nameWidth, properties->charHeight, FALSE);
 
-      if (treeGetShowOrganism(properties) && node->organism) 
+      if (treeGetShowOrganism(properties) && node->organism)
         {
           drawText(widget, drawable, gc, curX + nameWidth + DEFAULT_XPAD * 2, y - properties->charHeight / 2, node->organism, NULL, NULL);
         }
     }
-  
+
   /* Horizontal branches. If highlighting orthologs, draw a shaded area underneath
    * the branch. */
-  if (bc->highlightOrthologs && 
+  if (bc->highlightOrthologs &&
       node->left && node->right &&
       node->left->organism && node->right->organism &&
-      node->left->organism != node->right->organism) 
+      node->left->organism != node->right->organism)
     {
       gdk_gc_set_foreground(gcTmp, defaultColor);
       gdk_draw_rectangle(drawable, gcTmp, TRUE, x, y - properties->charHeight/2, curX - x, properties->charHeight);
     }
-  
+
   gdk_draw_line(drawable, gc, curX, y, x, y);
   createClickableRect(properties, node, x, y - properties->charHeight/2, curX - x, properties->charHeight, TRUE);
-  
-  if (treeGetShowBranchLen(properties) && node->branchlen) 
+
+  if (treeGetShowBranchLen(properties) && node->branchlen)
     {
       /* Draw the branch label, which shows the branch length */
       char *tmpStr = g_strdup_printf("%.1f", node->branchlen);
@@ -1861,12 +1862,12 @@ static double treeDrawNode(BelvuContext *bc,
       double pos = min((double)curX, x) + (abs((int)(curX - x)) / 2) - (textWidth * 0.5); /* centre text at middle of branch */
 
       drawText(widget, drawable, gc, pos, y, tmpStr, NULL, NULL);
-      
+
       g_free(tmpStr);
     }
-  
+
   /* This prints the tree bootstrap statistics */
-  if (bc->treebootstraps && !node->name && node != properties->tree->head && !bc->treebootstrapsDisplay) 
+  if (bc->treebootstraps && !node->name && node != properties->tree->head && !bc->treebootstrapsDisplay)
     {
       GdkColor *color = getGdkColor(BELCOLOR_TREE_BOOTSTRAP, bc->defaultColors, FALSE, FALSE);
       gdk_gc_set_foreground(gc, color);
@@ -1874,17 +1875,17 @@ static double treeDrawNode(BelvuContext *bc,
       char *tmpStr = g_strdup_printf("%.0f", node->boot);
       const int textWidth = getTextWidth(widget, tmpStr);
       double pos = curX - textWidth - 0.5;
-      
-      if (pos < 0.0) 
+
+      if (pos < 0.0)
         pos = 0;
-      
+
       g_message("%f  %f   \n", node->boot, pos / properties->charWidth);
       drawText(widget, drawable,  gc, pos, y, tmpStr, NULL, NULL);
 
       g_free(tmpStr);
       gdk_gc_set_foreground(gc, defaultColor);
     }
-  
+
   g_object_unref(leftGc);
 
   return y;
@@ -1911,9 +1912,9 @@ void destroyTree(Tree **tree)
 {
   if (tree == NULL)
     return;
-  
+
   destroyTreeContents(*tree);
-  
+
   /* Free the tree struct */
   g_free(*tree);
   *tree = NULL;
@@ -1924,9 +1925,9 @@ void destroyTree(Tree **tree)
 static Tree* createEmptyTree()
 {
   Tree *result = (Tree*)g_malloc(sizeof *result);
-  
+
   result->head = NULL;
-  
+
   return result;
 }
 
@@ -1937,31 +1938,31 @@ static void drawBelvuTree(GtkWidget *widget, GdkDrawable *drawable, BelvuTreePro
 
   if (!properties->tree || !properties->tree->head)
     return;
-  
+
   /* Clear any previous clickable rects that were created */
   g_array_unref(properties->clickableRects);
   properties->clickableRects = g_array_new(FALSE, FALSE, sizeof(ClickableRect));
-  
+
   bc->tree_y = 1;
 
   GdkGC *gc = gdk_gc_new(drawable);
   GdkColor *defaultColor = getGdkColor(BELCOLOR_TREE_LINE, bc->defaultColors, FALSE, FALSE);
   gdk_gc_set_line_attributes(gc, treeGetLineWidth(properties) * properties->charWidth, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
-  
+
   treeDrawNode(bc, widget, drawable, gc, properties, defaultColor, properties->tree->head, properties->treeRect.x);
 
   int xscale = treeGetScale(properties) * properties->charWidth;
   int yscale = properties->charHeight;
-  
+
   const int markerHt = 0.5 * yscale;
-  
+
   const int xStart = properties->treeRect.x;
   const int xWidth = 10 * xscale;
   const int xHalfWidth = xWidth / 2;
   int xMax = 0;
-  
+
   /* Draw scale */
-  if (bc->treeMethod == UPGMA) 
+  if (bc->treeMethod == UPGMA)
     {
       xMax = xStart + (100 * xscale);
 
@@ -1969,17 +1970,17 @@ static void drawBelvuTree(GtkWidget *widget, GdkDrawable *drawable, BelvuTreePro
       int y = bc->tree_y * yscale;
 
       gdk_draw_line(drawable, gc, xStart, y, xMax, y);
-      
+
       int x = xStart;
       int i = 1;
-      for (; i <= 101; i += 10, x += xWidth) 
+      for (; i <= 101; i += 10, x += xWidth)
         {
-          if (i < 101) 
+          if (i < 101)
             {
               /* Draw half-way marker lines */
               gdk_draw_line(drawable, gc, x + xHalfWidth, y, x + xHalfWidth, y + markerHt);
             }
-          
+
           /* Draw the full marker line, with a label */
           gdk_draw_line(drawable, gc, x, y, x, y + markerHt);
 
@@ -1995,34 +1996,34 @@ static void drawBelvuTree(GtkWidget *widget, GdkDrawable *drawable, BelvuTreePro
       bc->tree_y += 3;
       int y = bc->tree_y * yscale;
       int x = xStart;
-      
+
       drawText(widget, drawable, gc, x + xHalfWidth, y - 3 * markerHt, "0.1", NULL, NULL);
-      
+
       gdk_draw_line(drawable, gc, x, y, x + xWidth, y);
       gdk_draw_line(drawable, gc, x, y - markerHt, x, y + markerHt);
       gdk_draw_line(drawable, gc, x + xWidth, y - markerHt, x + xWidth, y + markerHt);
     }
-  
-  if (bc->treeMethod == NJ) 
-    {	
+
+  if (bc->treeMethod == NJ)
+    {
       int y = bc->tree_y * yscale;
 
       double lweight, rweight;
-      
+
       lweight = treeSize3way(properties->tree->head->left, properties->tree->head);
       rweight = treeSize3way(properties->tree->head->right, properties->tree->head);
-      
+
       char *tmpStr = NULL;
 #ifdef DEBUG
       tmpStr = g_strdup_printf("Tree balance = %.1f (%.1f-%.1f)", fabsf(lweight - rweight), lweight, rweight);
 #else
       tmpStr = g_strdup_printf("Tree balance = %.1f", fabsf(lweight - rweight));
 #endif
-      
+
       drawText(widget, drawable, gc, xMax + 2 * DEFAULT_XPAD, y - markerHt, tmpStr, NULL, NULL);
       g_free(tmpStr);
     }
-  
+
   g_object_unref(gc);
 }
 
@@ -2033,26 +2034,26 @@ static gboolean onExposeBelvuTree(GtkWidget *widget, GdkEventExpose *event, gpoi
 {
   GtkWidget *belvuTree = GTK_WIDGET(data);
   GdkDrawable *window = GTK_LAYOUT(widget)->bin_window;
-  
+
   if (window)
     {
       GdkDrawable *bitmap = widgetGetDrawable(widget);
       BelvuTreeProperties *properties = belvuTreeGetProperties(belvuTree);
-      
+
       if (!bitmap)
         {
           /* There isn't a bitmap yet. Create it now. */
           if (properties->treeRect.width > 0 && properties->treeRect.height > 0)
             {
-              bitmap = createBlankSizedPixmap(widget, window, properties->treeRect.x * 2 + properties->treeRect.width, 
+              bitmap = createBlankSizedPixmap(widget, window, properties->treeRect.x * 2 + properties->treeRect.width,
                                               properties->treeRect.y * 2 + properties->treeRect.height);
-              
+
               separateMarkupLines(properties->bc);
               drawBelvuTree(widget, bitmap, properties);
               reInsertMarkupLines(properties->bc);
             }
         }
-      
+
       if (bitmap)
         {
           /* Push the bitmap onto the window */
@@ -2065,7 +2066,7 @@ static gboolean onExposeBelvuTree(GtkWidget *widget, GdkEventExpose *event, gpoi
 	  g_warning("Failed to draw Belvu tree [%p] - could not create bitmap.\n", widget);
 	}
     }
-  
+
   return TRUE;
 }
 
@@ -2080,7 +2081,7 @@ static void onLeftClickTree(GtkWidget *belvuTree, const int x, const int y)
   BelvuTreeProperties *properties = belvuTreeGetProperties(belvuTree);
   BelvuContext *bc = properties->bc;
 
-  /* We store a list of rectangles in our properties that tell us where 
+  /* We store a list of rectangles in our properties that tell us where
    * clickable items lie. Loop through them and see if the click point lies
    * inside any of them. */
   ClickableRect *foundRect = NULL;
@@ -2089,7 +2090,7 @@ static void onLeftClickTree(GtkWidget *belvuTree, const int x, const int y)
   for ( ; i < (int)properties->clickableRects->len; ++i)
     {
       ClickableRect *clickRect = &g_array_index(properties->clickableRects, ClickableRect, i);
-      
+
       if (pointInRect(x, y, &clickRect->rect))
         {
           foundRect = clickRect;
@@ -2112,7 +2113,7 @@ static void onLeftClickTree(GtkWidget *belvuTree, const int x, const int y)
             {
               /* Re-routing changes the tree's head node. */
               properties->tree->head = treeReroot(foundRect->node);
-              
+
               /* Re-routing can also affect the drawing area size, so recalculate borders */
               calculateBelvuTreeBorders(belvuTree);
             }
@@ -2120,7 +2121,7 @@ static void onLeftClickTree(GtkWidget *belvuTree, const int x, const int y)
             {
               g_warning("Program error: unrecognised tree selection mode '%d'.\n", bc->treePickMode);
             }
-          
+
           belvuTreeRedrawAll(belvuTree, NULL);
 
           /* If this is the main tree, then we need to update the main alignment
@@ -2139,14 +2140,14 @@ static void onLeftClickTree(GtkWidget *belvuTree, const int x, const int y)
 static gboolean onButtonPressBelvuTree(GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->type == GDK_BUTTON_PRESS && event->button == 1) /* left click */
     {
       GtkWidget *belvuTree = GTK_WIDGET(data);
       onLeftClickTree(belvuTree, event->x, event->y);
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -2156,11 +2157,11 @@ void onBelvuTreeFontSizeChanged(GtkWidget *belvuTree)
 {
   if (!belvuTree)
     return;
-  
+
   BelvuTreeProperties *properties = belvuTreeGetProperties(belvuTree);
-  
+
   getFontCharSize(properties->treeArea, properties->treeArea->style->font_desc, &properties->charWidth, &properties->charHeight);
-  
+
   calculateBelvuTreeBorders(belvuTree);
   belvuTreeRedrawAll(belvuTree, NULL);
 }
@@ -2171,15 +2172,15 @@ static gboolean onZoomBelvuTree(BelvuContext *bc, const gboolean zoomIn)
   if (bc->belvuTree)
     {
       int size = pango_font_description_get_size(bc->belvuTree->style->font_desc) / PANGO_SCALE;
-      
+
       if (zoomIn)
         widgetSetFontSizeAndCheck(bc->belvuTree, size + 1);
       else
         widgetSetFontSizeAndCheck(bc->belvuTree, size - 1);
-      
+
       onBelvuTreeFontSizeChanged(bc->belvuTree);
-    }  
-  
+    }
+
   return TRUE;
 }
 
@@ -2188,19 +2189,19 @@ static gboolean onZoomBelvuTree(BelvuContext *bc, const gboolean zoomIn)
 gboolean onKeyPressBelvuTree(GtkWidget *window, GdkEventKey *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   BelvuContext *bc = (BelvuContext*)data;
-  
+
   switch (event->keyval)
   {
     case GDK_plus:      /* fall through */
     case GDK_equal:     handled = onZoomBelvuTree(bc, TRUE);    break;
     case GDK_minus:     /* fall through */
     case GDK_underscore: handled = onZoomBelvuTree(bc, FALSE);  break;
-      
+
     default: break;
   };
-  
+
   return handled;
 }
 
@@ -2215,7 +2216,7 @@ static gboolean onBoolChangedCallback(GtkWidget *button, const gint responseId,
 {
   gboolean *value = (gboolean*)data;
   *value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
-  
+
   return TRUE;
 }
 
@@ -2224,23 +2225,23 @@ static gboolean onBoolChangedCallback(GtkWidget *button, const gint responseId,
 static gboolean onDoubleChangedCallback(GtkWidget *entry, const gint responseId, gpointer data)
 {
   double *value = (double*)data;
-  
+
   const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry));
   *value = g_strtod(text, NULL);
-  
+
   return TRUE;
 }
 
 /* Utility to create a check button and place it in the given parent box. The
- * button will control the setting of the given boolean value, which will be 
+ * button will control the setting of the given boolean value, which will be
  * updated when the button's parent dialog gets a response. */
 static void createCheckButton(const char *mnemonic, gboolean *value, GtkTable *table, const int row, const int col)
 {
   g_assert(value);
-  
+
   GtkWidget *button = gtk_check_button_new_with_mnemonic(mnemonic);
   gtk_table_attach(table, button, col, col + 2, row, row + 1, GTK_FILL, GTK_SHRINK, TABLE_XPAD, TABLE_YPAD);
-  
+
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *value);
   widgetSetCallbackData(button, onBoolChangedCallback, value);
 }
@@ -2256,7 +2257,7 @@ static GtkWidget* createDoubleTextEntry(const char *labelText, double *value, Gt
   GtkWidget *label = gtk_label_new(labelText);
   gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
   gtk_table_attach(table, label, col, col + 1, row, row + 1, GTK_FILL, GTK_SHRINK, TABLE_XPAD, TABLE_YPAD);
-  
+
   /* Create the text entry */
   GtkWidget *entry = gtk_entry_new();
   gtk_table_attach(table, entry, col + 1, col + 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_SHRINK, TABLE_XPAD, TABLE_YPAD);
@@ -2266,26 +2267,26 @@ static GtkWidget* createDoubleTextEntry(const char *labelText, double *value, Gt
   char *defaultInput = convertDoubleToString(*value, 2);
   gtk_entry_set_text(GTK_ENTRY(entry), defaultInput);
 
-  
+
   const int defaultLen = min((int)strlen(defaultInput) * 8, 500);
   gtk_widget_set_size_request(entry, defaultLen, -1);
 
   g_free(defaultInput);
-  
+
   return entry;
 }
 
-static GtkWidget* createTreeDisplayOptsButtons(GtkBox *box, 
+static GtkWidget* createTreeDisplayOptsButtons(GtkBox *box,
                                                double *treeScale,
                                                double *lineWidth,
-                                               gboolean *showBranchLen, 
+                                               gboolean *showBranchLen,
                                                gboolean *showOrganism,
 					       GtkWidget **treeScaleEntry)
 {
   /* Put the display options in a table in a frame */
   GtkContainer *frame = GTK_CONTAINER(gtk_frame_new("Display options"));
   gtk_box_pack_start(box, GTK_WIDGET(frame), FALSE, FALSE, DIALOG_YPAD);
-  
+
   GtkTable *table = GTK_TABLE(gtk_table_new(2, 2, FALSE));
   gtk_container_add(frame, GTK_WIDGET(table));
 
@@ -2293,7 +2294,7 @@ static GtkWidget* createTreeDisplayOptsButtons(GtkBox *box,
   createDoubleTextEntry("Line width:", lineWidth, table, 1, 0);
   createCheckButton("Display branch lengths", showBranchLen, table, 2, 0);
   createCheckButton("Display organism", showOrganism, table, 3, 0);
-  
+
   return GTK_WIDGET(frame);
 }
 
@@ -2302,24 +2303,24 @@ static void createTreeInteractionButtons(GtkBox *box, BelvuPickMode *pickMode)
 {
   GtkWidget *frame = gtk_frame_new("Interactions");
   gtk_box_pack_start(box, GTK_WIDGET(frame), FALSE, FALSE, DIALOG_YPAD);
-  
+
   /* Create the tree pick-method drop-down box */
   GtkBox *hbox = GTK_BOX(gtk_hbox_new(FALSE, 0));
   gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(hbox));
 
   GtkWidget *label = gtk_label_new("Action when picking a node:");
   gtk_box_pack_start(hbox, label, FALSE, FALSE, DIALOG_XPAD);
-  
+
   GtkComboBox *combo = createComboBox();
-  
+
   GtkTreeIter *iter = NULL;
   BelvuPickMode initMode = *pickMode;
-  
+
   addComboItem(combo, iter, NODESWAP, SWAPstr, initMode);
   addComboItem(combo, iter, NODEROOT, ROOTstr, initMode);
 
   widgetSetCallbackData(GTK_WIDGET(combo), onComboChanged, pickMode);
-  
+
   gtk_box_pack_start(hbox, GTK_WIDGET(combo), FALSE, FALSE, DIALOG_XPAD);
 }
 
@@ -2335,17 +2336,17 @@ static gboolean correctingDistances(const BelvuBuildMethod buildMethod, const Be
 gboolean onBuildMethodChanged(GtkWidget *combo, const gint responseId, gpointer data)
 {
   BelvuContext *bc = (BelvuContext*)data;
-  
+
   const int origVal = bc->treeMethod;
-  
+
   onComboChanged(combo, responseId, &bc->treeMethod);
-  
+
   /* This change invalidates the tree, so set the tree head to null to indicate this */
   if (origVal != bc->treeMethod)
     {
       belvuContextSetTree(bc, NULL);
     }
-  
+
   return TRUE;
 }
 
@@ -2354,26 +2355,26 @@ gboolean onBuildMethodChanged(GtkWidget *combo, const gint responseId, gpointer
 gboolean onDistCorrChanged(GtkWidget *combo, const gint responseId, gpointer data)
 {
   BelvuContext *bc = (BelvuContext*)data;
-  
+
   const int origVal = bc->treeDistCorr;
 
   onComboChanged(combo, responseId, &bc->treeDistCorr);
-  
+
   /* This change invalidates the tree, so set the tree head to null to indicate this */
   if (origVal != bc->treeDistCorr)
     {
       belvuContextSetTree(bc, NULL);
     }
-  
+
   return TRUE;
 }
 
 
 /* Utility to create a standard 2-column combo box and place it in the given
  * table with a label with the given text. */
-static GtkComboBox* createComboWithLabel(GtkTable *table, 
-                                         const char *labelText, 
-                                         const int col, 
+static GtkComboBox* createComboWithLabel(GtkTable *table,
+                                         const char *labelText,
+                                         const int col,
                                          const int row,
                                          BlxResponseCallback callbackFunc,
                                          gpointer data)
@@ -2382,14 +2383,14 @@ static GtkComboBox* createComboWithLabel(GtkTable *table,
   GtkWidget *label = gtk_label_new(labelText);
   gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
   gtk_table_attach(table, label, col, col + 1, row, row + 1, GTK_FILL, GTK_SHRINK, TABLE_XPAD, TABLE_YPAD);
-  
+
   GtkComboBox *combo = createComboBox();
   gtk_table_attach(table, GTK_WIDGET(combo), col + 1, col + 2, row, row + 1, GTK_FILL, GTK_SHRINK, TABLE_XPAD, TABLE_YPAD);
-  
+
   widgetSetCallbackData(GTK_WIDGET(combo), callbackFunc, data);
-  
+
   return combo;
-} 
+}
 
 static void updateTreeScaleEntry(GtkComboBox *combo, gpointer data)
 {
@@ -2398,7 +2399,7 @@ static void updateTreeScaleEntry(GtkComboBox *combo, gpointer data)
   int newBuildMethod, newDistCorr;
   onComboChanged(userData->buildMethodCombo, 0, &newBuildMethod);
   onComboChanged(userData->distCorrCombo, 0, &newDistCorr);
-  
+
   if (correctingDistances(origBuildMethod, origDistCorr) == correctingDistances((BelvuBuildMethod)newBuildMethod, (BelvuDistCorr)newDistCorr))
     return;
 
@@ -2415,8 +2416,8 @@ static void updateTreeScaleEntry(GtkComboBox *combo, gpointer data)
       char *tmpStr = g_strdup_printf("%.2f", DEFAULT_TREE_SCALE_NON_CORR);
       gtk_entry_set_text(GTK_ENTRY(*userData->treeScaleEntry), tmpStr);
       g_free(tmpStr);
-    }    
-  
+    }
+
   origBuildMethod = (BelvuBuildMethod)newBuildMethod;
   origDistCorr = (BelvuDistCorr)newDistCorr;
 }
@@ -2428,27 +2429,27 @@ static void createTreeBuildMethodButtons(BelvuContext *bc, GtkBox *box, BelvuBui
   /* We'll put everything in a table inside a frame */
   GtkWidget *frame = gtk_frame_new("Build methods");
   gtk_box_pack_start(box, GTK_WIDGET(frame), FALSE, FALSE, DIALOG_YPAD);
-  
+
   GtkTable *table = GTK_TABLE(gtk_table_new(2, 2, FALSE));
   gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(table));
-  
+
   /* Create the build-method drop-down box */
   static BuildMethodChangedData data;
   data.bc = bc;
   data.treeScaleEntry = treeScaleEntry;
-  
+
   GtkComboBox *buildMethodCombo = createComboWithLabel(table, "Tree building method:", 0, 0, onBuildMethodChanged, bc);
   data.buildMethodCombo = GTK_WIDGET(buildMethodCombo);
-  
+
   GtkTreeIter *iter = NULL;
   int initMode = *buildMethod;
   addComboItem(buildMethodCombo, iter, NJ, NJstr, initMode);
   addComboItem(buildMethodCombo, iter, UPGMA, UPGMAstr, initMode);
-  
+
   /* Create the distance-correction method drop-down box */
   GtkComboBox *distCorrCombo = createComboWithLabel(table, "Distance correction method:", 0, 1, onDistCorrChanged, bc);
   data.distCorrCombo = GTK_WIDGET(distCorrCombo);
-  
+
   iter = NULL;
   initMode = *distCorr;
   addComboItem(distCorrCombo, iter, UNCORR, UNCORRstr, initMode);
@@ -2456,7 +2457,7 @@ static void createTreeBuildMethodButtons(BelvuContext *bc, GtkBox *box, BelvuBui
   addComboItem(distCorrCombo, iter, KIMURA, KIMURAstr, initMode);
   addComboItem(distCorrCombo, iter, STORMSONN, STORMSONNstr, initMode);
   addComboItem(distCorrCombo, iter, SCOREDIST, SCOREDISTstr, initMode);
-  
+
   origBuildMethod = bc->treeMethod;
   origDistCorr = bc->treeDistCorr;
   g_signal_connect(G_OBJECT(buildMethodCombo), "changed", G_CALLBACK(updateTreeScaleEntry), &data);
@@ -2466,22 +2467,22 @@ static void createTreeBuildMethodButtons(BelvuContext *bc, GtkBox *box, BelvuBui
 
 
 /* Utility function to create the content for the tree settings dialog */
-GtkWidget* createTreeSettingsDialogContent(BelvuContext *bc, 
-                                           GtkWidget *dialog, 
+GtkWidget* createTreeSettingsDialogContent(BelvuContext *bc,
+                                           GtkWidget *dialog,
                                            const gboolean isMainTree,
                                            double *treeScale,
                                            double *lineWidth,
-                                           gboolean *showBranchLen, 
+                                           gboolean *showBranchLen,
                                            gboolean *showOrganism,
                                            BelvuPickMode *pickMode,
-                                           BelvuBuildMethod *buildMethod, 
+                                           BelvuBuildMethod *buildMethod,
                                            BelvuDistCorr *distCorr)
 {
   GtkBox *vbox = GTK_BOX(gtk_vbox_new(FALSE, 0));
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), GTK_WIDGET(vbox), FALSE, FALSE, 0);
-  
+
   static GtkWidget *treeScaleEntry = NULL;
-  
+
   /* Only give the option to change the build method for the main belvu tree */
   if (isMainTree)
     createTreeBuildMethodButtons(bc, vbox, buildMethod, distCorr, &treeScaleEntry);
@@ -2494,7 +2495,7 @@ GtkWidget* createTreeSettingsDialogContent(BelvuContext *bc,
    * activate the default response, thereby allowing the user to create the tree
    * very quickly just by pressing Enter. */
   gtk_container_set_focus_child(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), content);
-  
+
   return GTK_WIDGET(vbox);
 }
 
@@ -2511,52 +2512,52 @@ void onResponseTreeSettingsDialog(GtkDialog *dialog, gint responseId, gpointer d
   GtkWidget *window = GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(dialog)));
   GtkWidget *treeWindow = NULL;
   gboolean isMainTree = FALSE;
-  
+
   if (window && stringsEqual(gtk_widget_get_name(window), BELVU_TREE_WINDOW_NAME, TRUE))
     {
       treeWindow = window;
       BelvuTreeProperties *properties = belvuTreeGetProperties(treeWindow);
       isMainTree = properties->isMainTree;
     }
-  else 
+  else
     {
       treeWindow = bc->belvuTree;
       isMainTree = TRUE;
     }
-  
-  
+
+
   switch (responseId)
   {
     case GTK_RESPONSE_ACCEPT:
-      /* Call all of the callbacks for each individual widget to update the 
+      /* Call all of the callbacks for each individual widget to update the
        * properties. Then refresh the window and show the tree. Destroy dialog
        * if successful. */
       destroy = widgetCallAllCallbacks(GTK_WIDGET(dialog), GINT_TO_POINTER(responseId));
       belvuTreeUpdateSettings(bc, treeWindow);
-      
+
       if (!treeWindow)
         createAndShowBelvuTree(bc, isMainTree);
       else
         gtk_window_present(GTK_WINDOW(treeWindow));
-        
+
       break;
-      
+
     case GTK_RESPONSE_APPLY:
       /* Never destroy */
       destroy = FALSE;
       widgetCallAllCallbacks(GTK_WIDGET(dialog), GINT_TO_POINTER(responseId));
       belvuTreeUpdateSettings(bc, treeWindow);
       break;
-      
+
     case GTK_RESPONSE_CANCEL:
     case GTK_RESPONSE_REJECT:
       destroy = TRUE;
       break;
-      
+
     default:
       break;
   };
-  
+
   if (destroy)
     {
       gtk_widget_destroy(GTK_WIDGET(dialog));
@@ -2568,9 +2569,9 @@ void onResponseTreeSettingsDialog(GtkDialog *dialog, gint responseId, gpointer d
 void showTreeSettingsDialog(GtkWidget *window, BelvuContext *bc)
 {
   char *title = g_strdup_printf("%sTree Settings", belvuGetTitlePrefix(bc));
-  
+
   GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
-                                       GTK_WINDOW(window), 
+                                       GTK_WINDOW(window),
                                        (GtkDialogFlags)(GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL),
                                        GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                        GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
@@ -2578,13 +2579,13 @@ void showTreeSettingsDialog(GtkWidget *window, BelvuContext *bc)
                                        NULL);
 
   g_free(title);
-  
+
   g_signal_connect(dialog, "response", G_CALLBACK(onResponseTreeSettingsDialog), bc);
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-  
+
   GtkWidget *treeWindow = NULL;
   gboolean isMainTree = FALSE;
-  
+
   /* If this is a tree window then check the properties to see if it is the main
    * window. Otherwise, use the main tree from the context. If it's the main window
    * then updating the tree settings will change them in the context; otherwise
@@ -2595,7 +2596,7 @@ void showTreeSettingsDialog(GtkWidget *window, BelvuContext *bc)
   double *lineWidth = &bc->treeLineWidth;
   gboolean *showBranchLen = &bc->treeShowBranchlen;
   gboolean *showOrganisms = &bc->treeShowOrganism;
-  
+
   if (window && stringsEqual(gtk_widget_get_name(window), BELVU_TREE_WINDOW_NAME, TRUE))
     {
       treeWindow = window;
@@ -2621,7 +2622,7 @@ void showTreeSettingsDialog(GtkWidget *window, BelvuContext *bc)
                                   treeScale, lineWidth,
                                   showBranchLen, showOrganisms,
                                   &bc->treePickMode, &bc->treeMethod, &bc->treeDistCorr);
-  
+
   gtk_widget_show_all(dialog);
   gtk_window_present(GTK_WINDOW(dialog));
 }
@@ -2634,21 +2635,21 @@ static void calculateNodeWidth(BelvuTreeProperties *properties, TreeNode *node,
 {
   if (!node)
     return;
-  
+
   const int curX = x + (node->branchlen * treeGetScale(properties) * properties->charWidth);
-  
+
   /* Recurse left and right */
   calculateNodeWidth(properties, node->left, curX);
   calculateNodeWidth(properties, node->right, curX);
-  
+
   /* Check if the end of this text is outside the maximum x position found so far */
   int textWidth = 0;
   textWidth += getTextWidth(properties->treeArea, node->name) + DEFAULT_XPAD;
   textWidth += getTextWidth(properties->treeArea, node->organism) + DEFAULT_XPAD;
-  
+
   int pos = curX + textWidth;
-  
-  if (pos > properties->bc->maxTreeWidth) 
+
+  if (pos > properties->bc->maxTreeWidth)
     properties->bc->maxTreeWidth = pos;
 }
 
@@ -2656,18 +2657,18 @@ static void calculateBelvuTreeBorders(GtkWidget *belvuTree)
 {
   if (!belvuTree)
     return;
-  
+
   BelvuTreeProperties *properties = belvuTreeGetProperties(belvuTree);
 
   if (!properties || !properties->tree || !properties->tree->head)
     return;
-  
+
   /* This loops through all nodes and calculates the max tree width */
   properties->bc->maxTreeWidth = 0;
   calculateNodeWidth(properties, properties->tree->head, properties->treeRect.x);
-  
+
   int treeHeight = (properties->bc->alignArr->len + 7) * properties->charHeight;
-  
+
   if (treeHeight > MAX_PIXMAP_HEIGHT)
     {
       treeHeight = MAX_PIXMAP_HEIGHT;
@@ -2675,19 +2676,19 @@ static void calculateBelvuTreeBorders(GtkWidget *belvuTree)
     }
 
   int treeWidth = properties->bc->maxTreeWidth;
-  
+
   if (treeWidth > MAX_PIXMAP_WIDTH)
     {
       treeWidth = MAX_PIXMAP_WIDTH;
       g_warning("The tree window is too large and will be clipped.\n");
     }
-  
+
   properties->treeRect.x = DEFAULT_XPAD;
   properties->treeRect.y = DEFAULT_YPAD;
   properties->treeRect.width = treeWidth;
   properties->treeRect.height = treeHeight;
-  
-  gtk_layout_set_size(GTK_LAYOUT(properties->treeArea), DEFAULT_XPAD * 2 + properties->treeRect.width, 
+
+  gtk_layout_set_size(GTK_LAYOUT(properties->treeArea), DEFAULT_XPAD * 2 + properties->treeRect.width,
                       DEFAULT_YPAD * 2 + properties->treeRect.height);
 }
 
@@ -2700,29 +2701,29 @@ static void calculateBelvuTreeBorders(GtkWidget *belvuTree)
 static void setBelvuTreeStyle(BelvuContext *bc, GtkWidget *belvuTree)
 {
   GdkColor *bgColor = getGdkColor(BELCOLOR_BACKGROUND, bc->defaultColors, FALSE, FALSE);
-  
+
   gtk_widget_modify_bg(belvuTree, GTK_STATE_NORMAL, bgColor);
 }
 
 
-/* Create a widget for drawing a tree. Returns the GtkLayout widget that 
+/* Create a widget for drawing a tree. Returns the GtkLayout widget that
  * does the drawing. Places the widget into the given parent box. */
 static GtkWidget* createBelvuTreeWidget(BelvuContext *bc, GtkBox *box)
 {
   /* Create the drawing area */
   GtkWidget *treeArea = gtk_layout_new(NULL, NULL);
-  
+
   /* Make it scrollable. The scroll-window will be the outermost container and
    * therefore will be the widget that we treat as the "belvu tree". */
   GtkWidget *scrollWin = gtk_scrolled_window_new(NULL, NULL);
   gtk_box_pack_start(box, scrollWin, TRUE, TRUE, 0);
-  
+
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollWin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
   gtk_container_add(GTK_CONTAINER(scrollWin), treeArea);
 
   /* Set the style */
   setBelvuTreeStyle(bc, treeArea);
-  
+
   return treeArea;
 }
 
@@ -2730,11 +2731,11 @@ static GtkWidget* createBelvuTreeWidget(BelvuContext *bc, GtkBox *box)
 static void setTreeWindowStyleProperties(GtkWidget *window)
 {
   gtk_widget_set_name(window, BELVU_TREE_WINDOW_NAME);
-  
+
   /* Set the initial window size based on some fraction of the screen size */
   int screenWidth = 300, screenHeight = 200;
   gbtools::GUIGetTrueMonitorSize(window, &screenWidth, &screenHeight);
-  
+
   const int width = screenWidth * DEFAULT_TREE_WINDOW_WIDTH_FRACTION;
   const int height = screenHeight * DEFAULT_TREE_WINDOW_HEIGHT_FRACTION;
   gtk_window_set_default_size(GTK_WINDOW(window), width, height);
@@ -2750,17 +2751,17 @@ GtkWidget* createBelvuTreeWindow(BelvuContext *bc, Tree *tree, const gboolean is
 
   const char *titlePrefix = (isMainTree ? TITLE_MAIN_TREE_PREFIX : TITLE_BOOTSTRAP_TREE_PREFIX);
   const char *titleDesc = (bc->treeMethod == NJ ? TITLE_NJ_TREE_DESCRIPTION : TITLE_UPGMA_TREE_DESCRIPTION);
-  
-  char *title = g_strdup_printf("%s%s%stree using %s distances of %s", 
+
+  char *title = g_strdup_printf("%s%s%stree using %s distances of %s",
                                 belvuGetTitlePrefix(bc),
-                                titlePrefix, 
+                                titlePrefix,
                                 titleDesc,
                                 bc->treeDistString,
                                 bc->Title);
-  
+
   gtk_window_set_title(GTK_WINDOW(belvuTree), title);
   g_free(title);
-  
+
   /* We must add all toplevel windows to the list of spawned windows */
   bc->spawnedWindows = g_slist_prepend(bc->spawnedWindows, belvuTree);
 
@@ -2772,14 +2773,14 @@ GtkWidget* createBelvuTreeWindow(BelvuContext *bc, Tree *tree, const gboolean is
   GtkActionGroup *actionGroup = NULL;
   GtkUIManager *uiManager = createUiManager(belvuTree, bc, &actionGroup);
   GtkWidget *contextmenu = createBelvuMenu(belvuTree, "/TreeContextMenu", uiManager);
-  
+
   gtk_widget_add_events(belvuTree, GDK_BUTTON_PRESS_MASK);
   g_signal_connect(G_OBJECT(belvuTree), "button-press-event", G_CALLBACK(onButtonPressBelvu), contextmenu);
-  
+
   /* We'll place everything in a vbox */
   GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(belvuTree), vbox);
-  
+
   /* Add the alignment section */
   GtkWidget *treeArea = createBelvuTreeWidget(bc, GTK_BOX(vbox));
 
@@ -2791,14 +2792,14 @@ GtkWidget* createBelvuTreeWindow(BelvuContext *bc, Tree *tree, const gboolean is
 
   /* Connect signals. Pass the window as the data. */
   gtk_widget_add_events(treeArea, GDK_BUTTON_PRESS_MASK);
-  g_signal_connect(G_OBJECT(treeArea), "expose-event", G_CALLBACK(onExposeBelvuTree), belvuTree);  
-  g_signal_connect(G_OBJECT(treeArea), "button-press-event", G_CALLBACK(onButtonPressBelvuTree), belvuTree);  
+  g_signal_connect(G_OBJECT(treeArea), "expose-event", G_CALLBACK(onExposeBelvuTree), belvuTree);
+  g_signal_connect(G_OBJECT(treeArea), "button-press-event", G_CALLBACK(onButtonPressBelvuTree), belvuTree);
   g_signal_connect(G_OBJECT(belvuTree), "key-press-event", G_CALLBACK(onKeyPressBelvuTree), bc);
-  
+
   /* Set the font size to be the same as the main alignment window */
   if (bc->belvuAlignment)
     widgetSetFontSize(belvuTree, GINT_TO_POINTER(pango_font_description_get_size(bc->belvuAlignment->style->font_desc) / PANGO_SCALE));
-  
+
   onBelvuTreeFontSizeChanged(belvuTree);
 
   gtk_widget_show_all(belvuTree);
@@ -2808,22 +2809,22 @@ GtkWidget* createBelvuTreeWindow(BelvuContext *bc, Tree *tree, const gboolean is
 }
 
 
-/* Create a new tree and create a tree-window to display it. If isMainTree is 
+/* Create a new tree and create a tree-window to display it. If isMainTree is
  * true then set this as the main belvu tree. */
 GtkWidget* createAndShowBelvuTree(BelvuContext *bc, const gboolean isMainTree)
 {
   GtkWidget *belvuTree = NULL;
-  
+
   /* For the main tree, use the existing tree nodes if any; otherwise create
    * one. For other trees, we always need to create the tree nodes. */
   if (!isMainTree || !bc->mainTree || !bc->mainTree->head)
     {
       separateMarkupLines(bc);
       Tree *tree = treeMake(bc, TRUE, TRUE);
-      
+
       if (isMainTree)
         belvuContextSetTree(bc, &tree);
-          
+
       belvuTree = createBelvuTreeWindow(bc, tree, isMainTree);
       reInsertMarkupLines(bc);
     }
@@ -2831,9 +2832,6 @@ GtkWidget* createAndShowBelvuTree(BelvuContext *bc, const gboolean isMainTree)
     {
       belvuTree = createBelvuTreeWindow(bc, bc->mainTree, isMainTree);
     }
-  
+
   return belvuTree;
 }
-
-
-
diff --git a/src/belvuApp/belvuTree.hpp b/src/belvuApp/belvuTree.hpp
index ce2957f827677a37271ba7c75c62e2b31e0454be..7942d1ecf910b31509438a2c5a83534af9cbbbc5 100644
--- a/src/belvuApp/belvuTree.hpp
+++ b/src/belvuApp/belvuTree.hpp
@@ -1,5 +1,6 @@
 /*  File: belvuTree.h
  *  Author: Gemma Barson, 2011-05-06
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -63,7 +64,7 @@ BelvuContext*             belvuTreeGetContext(GtkWidget *belvuTree);
 void                      showTreeSettingsDialog(GtkWidget *window, BelvuContext *bc);
 
 GtkWidget*                createTreeSettingsDialogContent(BelvuContext *bc, GtkWidget *dialog, const gboolean isMainTree,
-                                                          double *treeScale, double *lineWidth, 
+                                                          double *treeScale, double *lineWidth,
                                                           gboolean *showBranchLen, gboolean *showOrganism,
                                                           BelvuPickMode *pickMode, BelvuBuildMethod *buildMethod, BelvuDistCorr *distCorr);
 
diff --git a/src/belvuApp/belvuWindow.cpp b/src/belvuApp/belvuWindow.cpp
index 98ce4e7e6aa9862d34d72a9160e4e69207125baa..6d81849836e3f9db34e18eb0c61ed1c2fc16d59a 100644
--- a/src/belvuApp/belvuWindow.cpp
+++ b/src/belvuApp/belvuWindow.cpp
@@ -1,5 +1,6 @@
 /*  File: belvuWindow.c
  *  Author: Gemma Barson, 2011-04-11
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -51,7 +52,7 @@ using namespace std;
 #define DEFAULT_FONT_SIZE_ADJUSTMENT     0   /* used to start with a smaller font than the default widget font */
 #define MAIN_BELVU_WINDOW_NAME           "BelvuWindow"
 #define WRAPPED_BELVU_WINDOW_NAME        "WrappedBelvuWindow"
-#define BELVU_ORGS_WINDOW_NAME           "BelvuOrgsWindow" 
+#define BELVU_ORGS_WINDOW_NAME           "BelvuOrgsWindow"
 #define DEFAULT_WRAP_WINDOW_WIDTH_FRACTION      0.6    /* default width of wrap window (as fraction of screen width) */
 #define DEFAULT_WRAP_WINDOW_HEIGHT_FRACTION     0.85   /* default height of wrap window (as fraction of screen height) */
 #define MAX_ORGS_WINDOW_WIDTH_FRACTION          0.5    /* max width of organisms window (as fraction of screen width) */
@@ -342,7 +343,7 @@ static const GtkToggleActionEntry toggleMenuEntries[] = {
   {"FetchWWW",               NULL, FetchWWWStr,                          NULL,                FetchWWWDesc,            G_CALLBACK(onFetchWWWMenu),           FALSE},
   {"rmMany",     GTK_STOCK_DELETE, rmManyStr,                            NULL,                rmManyDesc,              G_CALLBACK(onRemoveSeqsMenu),         FALSE},
   {"FindOrthogs",            NULL, FindOrthogsStr,                       NULL,                FindOrthogsDesc,         G_CALLBACK(onFindOrthogsMenu),        FALSE},
-  {"autoRmEmptyColumns",     NULL, autoRmEmptyColumnsStr,                NULL,                autoRmEmptyColumnsDesc,  G_CALLBACK(onAutoRmEmptyColumnsMenu), TRUE}, 
+  {"autoRmEmptyColumns",     NULL, autoRmEmptyColumnsStr,                NULL,                autoRmEmptyColumnsDesc,  G_CALLBACK(onAutoRmEmptyColumnsMenu), TRUE},
   {"toggleColorByResId",     NULL, thresholdStr,                         NULL,                thresholdStr,            G_CALLBACK(ontoggleColorByResIdMenu), FALSE},
   {"ignoreGaps",             NULL, ignoreGapsStr,                        NULL,                ignoreGapsStr,           G_CALLBACK(onignoreGapsMenu),         FALSE},
   {"printColors",            NULL, printColorsStr,                       NULL,                printColorsStr,          G_CALLBACK(onprintColorsMenu),        FALSE},
@@ -546,12 +547,12 @@ static const char standardMenuDescription[] =
 
 
 /* Utility function to create the UI manager for the menus */
-GtkUIManager* createUiManager(GtkWidget *window, 
-                              BelvuContext *bc, 
+GtkUIManager* createUiManager(GtkWidget *window,
+                              BelvuContext *bc,
                               GtkActionGroup **actionGroupOut)
 {
   GtkActionGroup *action_group = gtk_action_group_new ("MenuActions");
-  
+
   gtk_action_group_add_actions(action_group, menuEntries, G_N_ELEMENTS(menuEntries), window);
   gtk_action_group_add_toggle_actions(action_group, toggleMenuEntries, G_N_ELEMENTS(toggleMenuEntries), window);
 
@@ -564,20 +565,20 @@ GtkUIManager* createUiManager(GtkWidget *window,
   GtkUIManager *ui_manager = gtk_ui_manager_new();
   gtk_ui_manager_insert_action_group(ui_manager, action_group, 0);
   gtk_ui_manager_set_add_tearoffs(ui_manager, TRUE);
-  
+
   GtkAccelGroup *accel_group = gtk_ui_manager_get_accel_group(ui_manager);
   gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
-  
+
   if (actionGroupOut)
     *actionGroupOut = action_group;
-  
+
   return ui_manager;
 }
 
 
 /* Create a menu */
-GtkWidget* createBelvuMenu(GtkWidget *window, 
-                           const char *path, 
+GtkWidget* createBelvuMenu(GtkWidget *window,
+                           const char *path,
                            GtkUIManager *ui_manager)
 {
   GError *error = NULL;
@@ -586,9 +587,9 @@ GtkWidget* createBelvuMenu(GtkWidget *window,
       prefixError(error, "Building menus failed: ");
       reportAndClearIfError(&error, G_LOG_LEVEL_ERROR);
     }
-  
+
   GtkWidget *menu = gtk_ui_manager_get_widget (ui_manager, path);
-  
+
   return menu;
 }
 
@@ -622,11 +623,11 @@ static void onQuitMenu(GtkAction *action, gpointer data)
   else
     {
       gboolean quit = TRUE;
-      
+
       /* Check if the alignment has been save and if not give the option to cancel */
       if (!bc->saved)
         quit = saveAlignmentPrompt(window, bc);
-      
+
       if (quit)
         gtk_main_quit();
     }
@@ -648,7 +649,7 @@ static void onAboutMenu(GtkAction *action, gpointer data)
 static gboolean printCachedDrawablesOnly(GtkWidget *widget)
 {
   const char *name = gtk_widget_get_name(widget);
-  
+
   return (stringsEqual(name, WRAPPED_BELVU_WINDOW_NAME, TRUE) ||
           stringsEqual(name, BELVU_TREE_WINDOW_NAME, TRUE) ||
           stringsEqual(name, BELVU_ORGS_WINDOW_NAME, TRUE));
@@ -660,13 +661,13 @@ static void onPrintMenu(GtkAction *action, gpointer data)
 
   static GtkPageSetup *pageSetup = NULL;
   static GtkPrintSettings *printSettings = NULL;
-  
+
   if (!pageSetup)
     {
       pageSetup = gtk_page_setup_new();
       gtk_page_setup_set_orientation(pageSetup, GTK_PAGE_ORIENTATION_PORTRAIT);
     }
-  
+
   if (!printSettings)
     {
       printSettings = gtk_print_settings_new();
@@ -674,15 +675,15 @@ static void onPrintMenu(GtkAction *action, gpointer data)
       gtk_print_settings_set_quality(printSettings, GTK_PRINT_QUALITY_HIGH);
       gtk_print_settings_set_resolution(printSettings, DEFAULT_PRINT_RESOLUTION);
     }
-  
+
   /* If we're just printing the cached drawable, get the actual drawing
-   * area widget that should be drawn. (Otherwise it gets clipped to the 
+   * area widget that should be drawn. (Otherwise it gets clipped to the
    * size of the container widget) */
   const gboolean printCachedOnly = printCachedDrawablesOnly(window);
   PrintScaleType scaleType = PRINT_FIT_BOTH;
 
   GtkWidget *widgetToPrint = NULL;
-  
+
   if (printCachedOnly)
     {
       widgetGetDrawing(window, &widgetToPrint);
@@ -692,7 +693,7 @@ static void onPrintMenu(GtkAction *action, gpointer data)
     {
       widgetToPrint = window;
     }
-  
+
   blxPrintWidget(widgetToPrint, NULL, GTK_WINDOW(window), &printSettings, &pageSetup, NULL, printCachedOnly, scaleType);
 }
 
@@ -708,7 +709,7 @@ static void onWrapMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *window = GTK_WIDGET(data);
   BelvuContext *bc = windowGetContext(window);
-  
+
   showWrapDialog(bc, bc->belvuWindow);
 }
 
@@ -716,7 +717,7 @@ static void onShowTreeMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   if (!properties->bc->belvuTree)
     {
       /* If the tree exists, create a window from it. Otherwise we need to
@@ -737,7 +738,7 @@ static BelvuContext* windowGetContext(GtkWidget *window)
 {
   BelvuContext *bc = NULL;
   const char *name = gtk_widget_get_name(window);
-  
+
   if (stringsEqual(name, MAIN_BELVU_WINDOW_NAME, TRUE))
     {
       BelvuWindowProperties *properties = belvuWindowGetProperties(window);
@@ -756,7 +757,7 @@ static BelvuContext* windowGetContext(GtkWidget *window)
       GenericWindowProperties *properties = windowGetProperties(window);
       bc = properties->bc;
     }
-  
+
   return bc;
 }
 
@@ -764,7 +765,7 @@ static void onRecalcTreeMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *window = GTK_WIDGET(data);
   BelvuContext *bc = windowGetContext(window);
-  
+
   if (bc->belvuTree)
     {
       /* Update the tree window */
@@ -776,7 +777,7 @@ static void onRecalcTreeMenu(GtkAction *action, gpointer data)
       separateMarkupLines(bc);
       Tree *tree = treeMake(bc, FALSE, TRUE);
       reInsertMarkupLines(bc);
-      
+
       belvuContextSetTree(bc, &tree);
       onTreeOrderChanged(bc);
     }
@@ -786,7 +787,7 @@ static void onTreeOptsMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *window = GTK_WIDGET(data);
   BelvuContext *bc = windowGetContext(window);
-  
+
   showTreeSettingsDialog(window, bc);
 }
 
@@ -819,7 +820,7 @@ static void onSaveAsMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *window = GTK_WIDGET(data);
   BelvuContext *bc = windowGetContext(window);
-  
+
   showSaveAsDialog(bc, window);
 }
 
@@ -827,19 +828,19 @@ static void onOutputMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuContext *bc = windowGetContext(belvuWindow);
-  
-  if (!bc->selectedAln) 
+
+  if (!bc->selectedAln)
     {
       g_critical("Please select a sequence first.\n");
     }
   else
     {
-      g_message("%.1f %s/%d-%d\n", 
+      g_message("%.1f %s/%d-%d\n",
                 bc->selectedAln->score,
                 bc->selectedAln->name,
                 bc->selectedAln->start,
                 bc->selectedAln->end);
-    
+
       fflush(stdout);
     }
 }
@@ -872,7 +873,7 @@ static void onCleanUpMenu(GtkAction *action, gpointer data)
   /* Close all windows that were spawned from the main window */
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   g_slist_foreach(properties->bc->spawnedWindows, destroyWidget, NULL);
 }
 
@@ -926,7 +927,7 @@ static void onrmColumnLeftMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   if (properties->bc->selectedCol > 0)
     {
       rmColumn(properties->bc, 1, properties->bc->selectedCol);
@@ -936,7 +937,7 @@ static void onrmColumnLeftMenu(GtkAction *action, gpointer data)
 
       properties->bc->selectedCol = 0; /* cancel selection, because this col is deleted now */
       properties->bc->highlightedCol = 0; /* cancel selection, because this col is deleted now */
-      
+
       onColSelectionChanged(properties->bc);
     }
   else
@@ -949,7 +950,7 @@ static void onrmColumnRightMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   if (properties->bc->selectedCol > 0)
     {
       rmColumn(properties->bc, properties->bc->selectedCol, properties->bc->maxLen);
@@ -972,8 +973,8 @@ static void onrmColumnCutoffMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
-  if (!colorByConservation(properties->bc)) 
+
+  if (!colorByConservation(properties->bc))
     {
       g_critical("Please select a conservation coloring scheme from the Color menu first.\n");
       return;
@@ -993,9 +994,9 @@ static void onrmGappyColumnsMenu(GtkAction *action, gpointer data)
 static void onRemoveSeqsMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
-  
+
   const gboolean optionOn = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-  
+
   if (optionOn)
     startRemovingSequences(belvuWindow);
   else
@@ -1007,9 +1008,9 @@ static void onAutoRmEmptyColumnsMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   const gboolean newVal = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-  
+
   if (properties->bc->rmEmptyColumnsOn != newVal)
     {
       properties->bc->rmEmptyColumnsOn = newVal;
@@ -1021,7 +1022,7 @@ static void onreadLabelsMenu(GtkAction *action, gpointer data)
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
 
-  if (!properties->bc->selectedAln) 
+  if (!properties->bc->selectedAln)
     {
       g_critical("Please select a sequence first.\n");
       return;
@@ -1074,7 +1075,7 @@ static void onunhideMenu(GtkAction *action, gpointer data)
     {
       g_array_index(properties->bc->alignArr, ALN*, i)->hide = FALSE;
     }
-  
+
   belvuAlignmentRedrawAll(properties->bc->belvuAlignment);
 }
 
@@ -1089,9 +1090,9 @@ static void onunhideMenu(GtkAction *action, gpointer data)
 static gboolean saveAlignmentPrompt(GtkWidget *widget, BelvuContext *bc)
 {
   char *title = g_strdup_printf("%sSave alignment?", belvuGetTitlePrefix(bc));
-  
+
   GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
-                                                  GTK_WINDOW(widget), 
+                                                  GTK_WINDOW(widget),
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                                   GTK_STOCK_YES, GTK_RESPONSE_YES,        /* yes, save the alignment and exit */
                                                   GTK_STOCK_NO, GTK_RESPONSE_NO,          /* no, don't save (but still exit) */
@@ -1099,7 +1100,7 @@ static gboolean saveAlignmentPrompt(GtkWidget *widget, BelvuContext *bc)
                                                   NULL);
 
   g_free(title);
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
 
   /* Put message and icon into an hbox */
@@ -1115,7 +1116,7 @@ static gboolean saveAlignmentPrompt(GtkWidget *widget, BelvuContext *bc)
 
   gint response = gtk_dialog_run(GTK_DIALOG(dialog));
   gboolean quit = FALSE;
-  
+
   if (response == GTK_RESPONSE_YES)
     {
       quit = saveAlignment(bc, widget);
@@ -1126,7 +1127,7 @@ static gboolean saveAlignmentPrompt(GtkWidget *widget, BelvuContext *bc)
     }
 
   gtk_widget_destroy(dialog);
-  
+
   return quit;
 }
 
@@ -1139,14 +1140,14 @@ static const char* saveFasta(BelvuContext *bc, GtkWidget *parent)
   char *title = g_strdup_printf("%s", bc->saveFormat == BELVU_FILE_UNALIGNED_FASTA ? "Save as unaligned Fasta file:" : "Save as aligned Fasta file:");
   const char *filename = getSaveFileName(parent, bc->fileName, bc->dirName, NULL, title);
   g_free(title);
-  
+
   FILE *fil = fopen(filename, "w");
-  
+
   if (fil)
     {
       writeFasta(bc, fil);
     }
-  
+
   return filename;
 }
 
@@ -1154,14 +1155,14 @@ static const char* saveFasta(BelvuContext *bc, GtkWidget *parent)
 static const char* saveMsf(BelvuContext *bc, GtkWidget *parent)
 {
   const char *filename = getSaveFileName(parent, bc->fileName, bc->dirName, NULL, "Save as MSF (/) file:");
-  
+
   FILE *fil = fopen(filename, "w");
-  
+
   if (fil)
     {
       writeMSF(bc, fil);
     }
-  
+
   return filename;
 }
 
@@ -1170,12 +1171,12 @@ static const char* saveMul(BelvuContext *bc, GtkWidget *parent)
 {
   const char *filename = getSaveFileName(parent, bc->fileName, bc->dirName, NULL, "Save as Stockholm file:");
   FILE *fil = fopen(filename, "w");
-  
+
   if (fil)
     {
       writeMul(bc, fil);
     }
-  
+
   return filename;
 }
 
@@ -1184,7 +1185,7 @@ static const char* saveMul(BelvuContext *bc, GtkWidget *parent)
  *                 Colour menu actions                     *
  ***********************************************************/
 
-/* This function is called when the color scheme has been changed. It performs all 
+/* This function is called when the color scheme has been changed. It performs all
  * required updates. */
 static void onColorSchemeChanged(BelvuWindowProperties *properties)
 {
@@ -1198,15 +1199,15 @@ static void onColorSchemeChanged(BelvuWindowProperties *properties)
       case BELVU_SCHEME_TYPE_CONS:
 	setToggleMenuStatus(properties->actionGroup, "ColorByCons", TRUE);
 	break;
-    
+
       default:
 	g_warning("Program error: unrecognised color scheme type '%d'.\n", properties->bc->schemeType);
 	break;
     };
-  
+
   /* Some menu actions are enabled/disabled depending on which scheme type is selected */
   greyOutInvalidActions(properties->bc);
-  
+
   /* Update the display */
   updateSchemeColors(properties->bc);
   belvuAlignmentRedrawAll(properties->bc->belvuAlignment);
@@ -1219,17 +1220,17 @@ static void onToggleSchemeType(GtkRadioAction *action, GtkRadioAction *current,
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
 
   BelvuSchemeType newScheme = (BelvuSchemeType)gtk_radio_action_get_current_value(current);
-  
+
   if (newScheme != properties->bc->schemeType)
     {
       properties->bc->schemeType = newScheme;
-      
+
       /* Toggle the actual scheme to the current default for this scheme type */
       if (newScheme == BELVU_SCHEME_TYPE_RESIDUE)
         setRadioMenuStatus(properties->actionGroup, "colorSchemeStandard", properties->bc->residueScheme);
       else
         setRadioMenuStatus(properties->actionGroup, "colorSchemeStandard", properties->bc->consScheme);
-      
+
       onColorSchemeChanged(properties);
     }
 }
@@ -1273,7 +1274,7 @@ static void onToggleSortOrder(GtkRadioAction *action, GtkRadioAction *current, g
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   properties->bc->sortType = (BelvuSortType)gtk_radio_action_get_current_value(current);
   doSort(properties->bc, properties->bc->sortType, TRUE);
 
@@ -1293,11 +1294,11 @@ static void onToggleSortOrder(GtkRadioAction *action, GtkRadioAction *current, g
 static void ontogglePaletteMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *window = GTK_WIDGET(data);
-  
+
   if (stringsEqual(gtk_widget_get_name(window), MAIN_BELVU_WINDOW_NAME, TRUE))
     {
       BelvuWindowProperties *properties = belvuWindowGetProperties(window);
-      
+
       if (properties->bc->schemeType == BELVU_SCHEME_TYPE_CONS)
         setToggleMenuStatus(properties->actionGroup, "ColorByResidue", TRUE);
       else
@@ -1313,7 +1314,7 @@ static void ontoggleColorByResIdMenu(GtkAction *action, gpointer data)
 
   /* Toggle the flag */
   properties->bc->colorByResIdOn = !properties->bc->colorByResIdOn;
-  
+
   /* Update the color scheme and redraw */
   updateSchemeColors(properties->bc);
   belvuAlignmentRedrawAll(properties->bc->belvuAlignment);
@@ -1323,7 +1324,7 @@ static void ontoggleColorByResIdMenu(GtkAction *action, gpointer data)
 static void oncolorByResIdMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
-  showColorByResIdDialog(belvuWindow);  
+  showColorByResIdDialog(belvuWindow);
 }
 
 static void onsaveColorSchemeMenu(GtkAction *action, gpointer data)
@@ -1341,7 +1342,7 @@ static void onsaveColorSchemeMenu(GtkAction *action, gpointer data)
       properties->bc->dirName = g_path_get_dirname(filename);
       properties->bc->fileName = g_path_get_basename(filename);
     }
-  
+
   saveResidueColorScheme(properties->bc, fil);
 }
 
@@ -1360,7 +1361,7 @@ static void onloadColorSchemeMenu(GtkAction *action, gpointer data)
       properties->bc->dirName = g_path_get_dirname(filename);
       properties->bc->fileName = g_path_get_basename(filename);
     }
-  
+
   readResidueColorScheme(properties->bc, fil, getColorArray(), TRUE);
 
   setRadioMenuStatus(properties->actionGroup, "colorSchemeStandard", BELVU_SCHEME_CUSTOM);
@@ -1375,7 +1376,7 @@ static void onignoreGapsMenu(GtkAction *action, gpointer data)
 
   /* Toggle the 'ignore gaps' option */
   properties->bc->ignoreGapsOn = !properties->bc->ignoreGapsOn;
-  
+
   onColorSchemeChanged(properties);
 }
 
@@ -1383,10 +1384,10 @@ static void onprintColorsMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   /* Toggle the 'ignore gaps' option */
   properties->bc->printColorsOn = !properties->bc->printColorsOn;
-  
+
   onColorSchemeChanged(properties);
 }
 
@@ -1396,9 +1397,9 @@ static void onexcludeHighlightedMenu(GtkAction *action, gpointer data)
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
 
   const gboolean exclude = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-  
+
   setExcludeFromConsCalc(properties->bc, exclude);
-  
+
   belvuAlignmentRedrawAll(properties->bc->belvuAlignment);
 }
 
@@ -1406,9 +1407,9 @@ static void ondisplayColorsMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   const gboolean newVal = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-  
+
   if (properties->bc->displayColors != newVal)
     {
       properties->bc->displayColors = newVal;
@@ -1420,7 +1421,7 @@ static void onlowercaseMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   properties->bc->lowercaseOn = !properties->bc->lowercaseOn;
   belvuAlignmentRedrawAll(properties->bc->belvuAlignment);
 }
@@ -1429,7 +1430,7 @@ static void oneditColorSchemeMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuContext *bc = windowGetContext(belvuWindow);
-  
+
   if (colorByConservation(bc))
     showEditConsColorsDialog(belvuWindow, TRUE);
   else
@@ -1440,11 +1441,11 @@ static void onSaveTreeMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *window = GTK_WIDGET(data);
   BelvuContext *bc = windowGetContext(window);
-  
+
   const char *filename = getSaveFileName(window, bc->fileName, bc->dirName, NULL, "Save tree in New Hampshire format");
-  
+
   FILE *file = fopen(filename, "w");
-  
+
   if (file)
     {
       saveTreeNH(bc->mainTree, bc->mainTree->head, file);
@@ -1452,7 +1453,7 @@ static void onSaveTreeMenu(GtkAction *action, gpointer data)
       /* Add a terminating line and close the file. */
       fprintf(file, ";\n");
       fclose(file);
-      
+
       g_message_info("Tree saved to %s\n", filename);
     }
 }
@@ -1463,15 +1464,15 @@ static void onFindOrthogsMenu(GtkAction *action, gpointer data)
   BelvuContext *bc = windowGetContext(window);
 
   GtkWidget *treeWindow = NULL;
-  
+
   /* If the current window is a tree, use that; otherwise use the main belvu tree */
   if (stringsEqual(gtk_widget_get_name(window), BELVU_TREE_WINDOW_NAME, TRUE))
     treeWindow = window;
   else
     treeWindow = bc->belvuTree;
-  
+
   bc->highlightOrthologs = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-      
+
   /* If turning the option on, print the orthologs to stdout */
   if (bc->highlightOrthologs)
     treePrintOrthologs(bc, treeWindow);
@@ -1484,7 +1485,7 @@ static void onShowOrgsMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *window = GTK_WIDGET(data);
   BelvuContext *bc = windowGetContext(window);
-  
+
   if (bc->organismArr->len < 1)
     {
       g_critical("No organism details found.\n");
@@ -1543,14 +1544,14 @@ static void destroyBelvuWindow(GtkWidget *belvuWindow)
   if (properties)
     {
       destroyBelvuContext(&properties->bc);
-  
+
       /* Free the properties struct itself */
       delete properties;
       properties = NULL;
       g_object_set_data(G_OBJECT(belvuWindow), "BelvuWindowProperties", NULL);
     }
 
-  gtk_main_quit();  
+  gtk_main_quit();
 }
 
 
@@ -1559,16 +1560,16 @@ static void destroyBelvuWindow(GtkWidget *belvuWindow)
 static void onDestroyBelvuWindow(GtkWidget *belvuWindow)
 {
   gboolean destroy = TRUE;
-  
+
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   if (!properties->bc->saved)
     {
       /* The alignment has not been saved - ask the user if they want to save/cancel */
       BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
       destroy = saveAlignmentPrompt(belvuWindow, properties->bc);
     }
-  
+
   if (destroy)
     {
       destroyBelvuWindow(belvuWindow);
@@ -1577,8 +1578,8 @@ static void onDestroyBelvuWindow(GtkWidget *belvuWindow)
 
 
 /* Create the properties struct and initialise all values. */
-static void belvuWindowCreateProperties(GtkWidget *belvuWindow, 
-					BelvuContext *bc, 
+static void belvuWindowCreateProperties(GtkWidget *belvuWindow,
+					BelvuContext *bc,
 					GtkWidget *statusBar,
 					GtkWidget *feedbackBox,
                                         GtkActionGroup *actionGroup)
@@ -1586,13 +1587,13 @@ static void belvuWindowCreateProperties(GtkWidget *belvuWindow,
   if (belvuWindow)
     {
       BelvuWindowProperties *properties = new BelvuWindowProperties;
-     
+
       properties->widget = belvuWindow;
       properties->bc = bc;
       properties->statusBar = statusBar;
       properties->feedbackBox = feedbackBox;
       properties->actionGroup = actionGroup;
-      
+
       g_object_set_data(G_OBJECT(belvuWindow), "BelvuWindowProperties", properties);
       g_signal_connect(G_OBJECT(belvuWindow), "destroy", G_CALLBACK (onDestroyBelvuWindow), NULL);
     }
@@ -1618,7 +1619,7 @@ static void onDestroyGenericWindow(GtkWidget *window)
 
   /* We must remove the window from the list of spawned windows */
   properties->bc->spawnedWindows = g_slist_remove(properties->bc->spawnedWindows, window);
-  
+
   if (properties)
     {
       /* Free the properties struct */
@@ -1630,7 +1631,7 @@ static void onDestroyGenericWindow(GtkWidget *window)
 
 
 /* Create the properties struct and initialise all values for a generic window. */
-static void genericWindowCreateProperties(GtkWidget *wrapWindow, 
+static void genericWindowCreateProperties(GtkWidget *wrapWindow,
                                           BelvuContext *bc,
                                           GtkActionGroup *actionGroup)
 {
@@ -1673,7 +1674,7 @@ static void showFontDialog(BelvuContext *bc, GtkWidget *window)
         {
           widgetSetFontSize(bc->belvuWindow, GINT_TO_POINTER(newSize));
           widgetSetFontSize(bc->belvuTree, GINT_TO_POINTER(newSize));
-          
+
           onBelvuAlignmentFontSizeChanged(bc->belvuAlignment);
           onBelvuTreeFontSizeChanged(bc->belvuTree);
         }
@@ -1736,7 +1737,7 @@ static void updateSequenceRemovalMode(GtkWidget *belvuWindow)
 static void startRemovingSequences(GtkWidget *belvuWindow)
 {
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   if (!properties->bc->removingSeqs)
     {
       properties->bc->removingSeqs = TRUE;
@@ -1747,7 +1748,7 @@ static void startRemovingSequences(GtkWidget *belvuWindow)
 static void endRemovingSequences(GtkWidget *belvuWindow)
 {
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   properties->bc->removingSeqs = FALSE;
   updateSequenceRemovalMode(belvuWindow);
 }
@@ -1761,9 +1762,9 @@ static void endRemovingSequences(GtkWidget *belvuWindow)
 static void aboutDialogOpenLinkCB(GtkAboutDialog *about, const gchar *link, gpointer data)
 {
   GError *error = NULL ;
-    
+
   if (!seqtoolsLaunchWebBrowser(link, &error))
-    g_critical("Cannot show link in web browser: \"%s\"", link) ;    
+    g_critical("Cannot show link in web browser: \"%s\"", link) ;
 }
 
 
@@ -1774,10 +1775,10 @@ static void showAboutDialog(GtkWidget *parent)
   const gchar *authors[] = {AUTHOR_LIST, NULL} ;
 
   gtk_about_dialog_set_url_hook(aboutDialogOpenLinkCB, NULL, NULL) ;
-  
+
   gtk_show_about_dialog(GTK_WINDOW(parent),
 			"authors", authors,
-			"comments", belvuGetCommentsString(), 
+			"comments", belvuGetCommentsString(),
 			"copyright", belvuGetCopyrightString(),
 			"license", belvuGetLicenseString(),
 			"name", belvuGetAppName(),
@@ -1785,7 +1786,7 @@ static void showAboutDialog(GtkWidget *parent)
 			"website", belvuGetWebSiteString(),
 			NULL) ;
 #endif
-  
+
   return ;
 }
 
@@ -1810,16 +1811,16 @@ static void showHelpDialog()
     {
       /* Get the executable's directory */
       char *dir = g_path_get_dirname(exe);
-      
+
       ok = dir != NULL;
-      
+
       if (ok)
         {
           /* Get the path to the html page */
           char *path = g_strdup_printf("%s/%s", dir, rel_path);
-          
+
           ok = path != NULL;
-          
+
           if (ok)
             {
               g_message_info("Opening help page '%s'\n", path);
@@ -1832,7 +1833,7 @@ static void showHelpDialog()
 
       g_free(exe);
     }
-  
+
   if (!ok)
     {
       if (error)
@@ -1853,7 +1854,7 @@ static void showHelpDialog()
 static gboolean saveAlignment(BelvuContext *bc, GtkWidget *window)
 {
   const char *filename = NULL;
-  
+
   if (bc->saveFormat == BELVU_FILE_MSF)
     filename = saveMsf(bc, window);
   else if (bc->saveFormat == BELVU_FILE_ALIGNED_FASTA)
@@ -1862,16 +1863,16 @@ static gboolean saveAlignment(BelvuContext *bc, GtkWidget *window)
     filename = saveFasta(bc, window);
   else
     filename = saveMul(bc, window);
-  
+
   /* Remember the last filename */
-  if (filename)	
+  if (filename)
     {
       if (bc->dirName) g_free(bc->dirName);
       if (bc->fileName) g_free(bc->fileName);
       bc->dirName = g_path_get_dirname(filename);
       bc->fileName = g_path_get_basename(filename);
     }
-  
+
   /* If the filename is null, the user must have cancelled. */
   return (filename != NULL);
 }
@@ -1882,11 +1883,11 @@ static GtkComboBox* createFileFormatCombo(const int initFormatId)
 {
   GtkComboBox *combo = createComboBox();
   GtkTreeIter *iter = NULL;
-  
+
   int i = 0;
   for ( ; i < BELVU_NUM_FILE_FORMATS; ++i)
     addComboItem(combo, iter, i, getFileFormatString(i), initFormatId);
-  
+
   return combo;
 }
 
@@ -1897,11 +1898,11 @@ static GtkComboBox* createFileFormatCombo(const int initFormatId)
 static void onSaveCoordsToggled(GtkWidget *button, gpointer data)
 {
   GtkWidget *otherWidget = GTK_WIDGET(data);
-  
+
   if (otherWidget)
     {
       const gboolean isActive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
-      gtk_widget_set_sensitive(otherWidget, isActive); 
+      gtk_widget_set_sensitive(otherWidget, isActive);
     }
 }
 
@@ -1910,75 +1911,75 @@ static void showSaveAsDialog(BelvuContext *bc, GtkWidget *window)
 {
   char *title = g_strdup_printf("%sSave As", belvuGetTitlePrefix(bc));
 
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
-                                                  GTK_WINDOW(window), 
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
+                                                  GTK_WINDOW(window),
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                                   GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                                   GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                                   NULL);
 
   g_free(title);
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
 
   GtkBox *contentArea = GTK_BOX(GTK_DIALOG(dialog)->vbox);
-  
+
   /* Create a drop-down for selectin the file format */
   GtkWidget *hbox = gtk_hbox_new(FALSE, DIALOG_XPAD);
   gtk_box_pack_start(contentArea, hbox, FALSE, FALSE, DIALOG_XPAD);
-  
+
   GtkWidget *label = gtk_label_new("Format: ");
   gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, DIALOG_XPAD);
-  
+
   GtkComboBox *combo = createFileFormatCombo(bc->saveFormat);
   gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(combo), FALSE, FALSE, DIALOG_YPAD);
-  
+
   /* Create a tick box for enabling the 'save coords' option */
   GtkToggleButton *checkButton = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic("Save _coordinates"));
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkButton), bc->saveCoordsOn);
   gtk_box_pack_start(contentArea, GTK_WIDGET(checkButton), FALSE, FALSE, DIALOG_YPAD);
-  
+
   /* Create selection buttons to allow user to specify separator char */
   GtkBox *hbox2 = GTK_BOX(gtk_hbox_new(FALSE, DIALOG_XPAD));
   gtk_box_pack_start(contentArea, GTK_WIDGET(hbox2), FALSE, FALSE, DIALOG_YPAD);
-  
+
   GtkWidget *separatorLabel = gtk_label_new("Separator character between name and coords:\n(Use = for GCG)");
   gtk_misc_set_alignment(GTK_MISC(separatorLabel), 0.0, 0.0);
   gtk_box_pack_start(hbox2, separatorLabel, FALSE, FALSE, DIALOG_XPAD);
-  
+
   GtkBox *vbox = GTK_BOX(gtk_vbox_new(FALSE, DIALOG_YPAD));
   gtk_box_pack_start(hbox2, GTK_WIDGET(vbox), FALSE, FALSE, DIALOG_XPAD);
-  
+
   const gboolean button1Active = (bc->saveSeparator == '/');
   GtkWidget *button1 = gtk_radio_button_new_with_label_from_widget(NULL, "slash  (/) ");
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button1), button1Active);
   gtk_box_pack_start(vbox, button1, FALSE, FALSE, 0);
-  
+
   GtkWidget *button2 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(button1), "equals  (=) ");
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button2), !button1Active);
   gtk_box_pack_start(vbox, button2, FALSE, FALSE, 0);
-  
+
   /* The save separator is only applicable if saving coords */
-  gtk_widget_set_sensitive(GTK_WIDGET(hbox2), bc->saveCoordsOn); 
+  gtk_widget_set_sensitive(GTK_WIDGET(hbox2), bc->saveCoordsOn);
   g_signal_connect(G_OBJECT(checkButton), "toggled", G_CALLBACK(onSaveCoordsToggled), hbox2);
-  
-  
+
+
   gtk_widget_show_all(dialog);
-  
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       bc->saveFormat = (BelvuFileFormat)gtk_combo_box_get_active(combo);
       bc->saveCoordsOn = gtk_toggle_button_get_active(checkButton);
-    
+
       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button1)))
 	bc->saveSeparator = '/';
-      else 
+      else
 	bc->saveSeparator = '=';
-    
-    
+
+
       saveAlignment(bc, window);
     }
-  
+
   gtk_widget_destroy(dialog);
 }
 
@@ -2076,7 +2077,7 @@ static gboolean onFindSeqs(GtkWidget *button, const gint responseId, gpointer da
 
 
 /* To do: implement functionality to search for sequences by a pattern of residues */
-/* 
+/*
 static gboolean onFindResidues(GtkWidget *button, const gint responseId, gpointer data)
 {
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
@@ -2122,7 +2123,7 @@ static void showFindDialog(BelvuContext *bc, GtkWidget *window)
                                            NULL);
 
       g_free(title);
-      
+
       /* These calls are required to make the dialog persistent... */
       addPersistentDialog(bc->dialogList, dialogId, dialog);
       g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
@@ -2159,26 +2160,26 @@ static GtkWidget* createPromptDialog(GtkWidget *window,
                                      const char *text1,
                                      const char *text2,
                                      GtkWidget **entry)
-{ 
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
+{
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
                                                   GTK_WINDOW(window),
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                                   GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                                   GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                                   NULL);
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-  
+
   if (window)
     pango_font_description_set_size(dialog->style->font_desc, pango_font_description_get_size(window->style->font_desc));
-  
+
   GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 12);
-  
+
   GtkWidget *label1 = gtk_label_new(text1);
   gtk_misc_set_alignment(GTK_MISC(label1), 1, 0.5);
   gtk_box_pack_start(GTK_BOX(hbox), label1, FALSE, FALSE, 0);
-  
+
   *entry = gtk_entry_new();
   gtk_box_pack_start(GTK_BOX(hbox), *entry, FALSE, FALSE, 0);
 
@@ -2186,47 +2187,47 @@ static GtkWidget* createPromptDialog(GtkWidget *window,
   gtk_entry_set_activates_default(GTK_ENTRY(*entry), TRUE);
 
   gtk_entry_set_text(GTK_ENTRY(*entry), defaultResult);
-  
+
   GtkWidget *label2 = gtk_label_new(text2);
   gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5);
   gtk_box_pack_start(GTK_BOX(hbox), label2, FALSE, FALSE, 0);
 
   gtk_widget_show_all(dialog);
-  
+
   return dialog;
 }
 
 
 /* Show a dialog to ask the user what threshold to use for removing
- * "gappy" sequences (i.e. sequences that are more than the given 
+ * "gappy" sequences (i.e. sequences that are more than the given
  * percentage of gaps). */
 static void showRemoveGappySeqsDialog(GtkWidget *belvuWindow)
 {
   static char *inputText = NULL;
-  
+
   if (!inputText)
     inputText = g_strdup("50");
-  
+
   GtkWidget *entry = NULL;
   BelvuContext *bc = windowGetContext(belvuWindow);
-  
+
   char *title = g_strdup_printf("%sremove sequences", belvuGetTitlePrefix(bc));
 
   GtkWidget *dialog = createPromptDialog(belvuWindow, inputText, title, "Remove sequences that are ", "% or more gaps.", &entry);
   g_free(title);
-  
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       if (inputText)
 	g_free(inputText);
-      
+
       inputText = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
       const gdouble cutoff = g_strtod(inputText, NULL);
-      
+
       BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
       removeGappySeqs(properties->bc, properties->bc->belvuAlignment, cutoff);
     }
-  
+
   gtk_widget_destroy(dialog);
 }
 
@@ -2234,28 +2235,28 @@ static void showRemoveGappySeqsDialog(GtkWidget *belvuWindow)
 static void showMakeNonRedundantDialog(GtkWidget *belvuWindow)
 {
   static char *inputText = NULL;
-  
+
   if (!inputText)
     inputText = g_strdup("80.0");
-  
+
   GtkWidget *entry = NULL;
   BelvuContext *bc = windowGetContext(belvuWindow);
   char *title = g_strdup_printf("%sremove sequences", belvuGetTitlePrefix(bc));
   GtkWidget *dialog = createPromptDialog(belvuWindow, inputText, title, "Remove sequences that are more than ", "% identical.", &entry);
   g_free(title);
-  
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       if (inputText)
 	g_free(inputText);
-      
+
       inputText = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
       const gdouble cutoff = g_strtod(inputText, NULL);
-      
+
       BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
       removeRedundantSeqs(properties->bc, properties->bc->belvuAlignment, cutoff);
     }
-  
+
   gtk_widget_destroy(dialog);
 }
 
@@ -2263,29 +2264,29 @@ static void showMakeNonRedundantDialog(GtkWidget *belvuWindow)
 static void showRemoveOutliersDialog(GtkWidget *belvuWindow)
 {
   static char *inputText = NULL;
-  
+
   if (!inputText)
     inputText = g_strdup("20.0");
-  
+
   GtkWidget *entry = NULL;
   BelvuContext *bc = windowGetContext(belvuWindow);
   char *title = g_strdup_printf("%sremove sequences", belvuGetTitlePrefix(bc));
 
   GtkWidget *dialog = createPromptDialog(belvuWindow, inputText, title, "Remove sequences that are less than ", "% identical with any other.", &entry);
   g_free(title);
-  
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       if (inputText)
 	g_free(inputText);
-      
+
       inputText = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
       const gdouble cutoff = g_strtod(inputText, NULL);
-      
+
       BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
       removeOutliers(properties->bc, properties->bc->belvuAlignment, cutoff);
     }
-  
+
   gtk_widget_destroy(dialog);
 }
 
@@ -2293,28 +2294,28 @@ static void showRemoveOutliersDialog(GtkWidget *belvuWindow)
 static void showRemoveByScoreDialog(GtkWidget *belvuWindow)
 {
   static char *inputText = NULL;
-  
+
   if (!inputText)
     inputText = g_strdup("20.0");
-  
+
   GtkWidget *entry = NULL;
   BelvuContext *bc = windowGetContext(belvuWindow);
   char *title = g_strdup_printf("%sremove sequences", belvuGetTitlePrefix(bc));
   GtkWidget *dialog = createPromptDialog(belvuWindow, inputText, title, "Remove sequences that have a score less than ", "", &entry);
   g_free(title);
-  
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       if (inputText)
 	g_free(inputText);
-      
+
       inputText = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
       const gdouble cutoff = g_strtod(inputText, NULL);
-      
+
       BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
       removeByScore(properties->bc, properties->bc->belvuAlignment, cutoff);
     }
-  
+
   gtk_widget_destroy(dialog);
 }
 
@@ -2327,34 +2328,34 @@ static void showRemoveColumnsDialog(GtkWidget *belvuWindow)
 {
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
   BelvuContext *bc = properties->bc;
-  
+
   char *title = g_strdup_printf("%sRemove Columns", belvuGetTitlePrefix(bc));
 
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
-                                                  GTK_WINDOW(belvuWindow), 
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
+                                                  GTK_WINDOW(belvuWindow),
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                                   GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                                   GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                                   NULL);
 
   g_free(title);
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-  
+
   GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 12);
-  
+
   GtkWidget *label1 = gtk_label_new("Remove columns from");
   gtk_misc_set_alignment(GTK_MISC(label1), 1, 0.5);
   gtk_box_pack_start(GTK_BOX(hbox), label1, FALSE, FALSE, 0);
-  
+
   char *maxLenText = g_strdup_printf("%d", bc->maxLen);
   GtkWidget *entry1 = gtk_entry_new();
   gtk_box_pack_start(GTK_BOX(hbox), entry1, FALSE, FALSE, 0);
   gtk_entry_set_width_chars(GTK_ENTRY(entry1), strlen(maxLenText) + 1);
   gtk_entry_set_activates_default(GTK_ENTRY(entry1), TRUE);
   gtk_entry_set_text(GTK_ENTRY(entry1), "1");
-  
+
   GtkWidget *label2 = gtk_label_new("to");
   gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5);
   gtk_box_pack_start(GTK_BOX(hbox), label2, FALSE, FALSE, 0);
@@ -2366,24 +2367,24 @@ static void showRemoveColumnsDialog(GtkWidget *belvuWindow)
   gtk_entry_set_text(GTK_ENTRY(entry2), maxLenText);
   g_free(maxLenText);
   maxLenText = NULL;
-  
+
   gtk_widget_show_all(dialog);
 
-  
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       const char *inputText1 = gtk_entry_get_text(GTK_ENTRY(entry1));
       const int fromVal = convertStringToInt(inputText1);
-      
+
       const char *inputText2 = gtk_entry_get_text(GTK_ENTRY(entry2));
       const int toVal = convertStringToInt(inputText2);
 
       rmColumn(bc, fromVal, toVal);
-      
+
       rmFinaliseColumnRemoval(bc);
       updateOnAlignmentLenChanged(bc->belvuAlignment);
     }
-  
+
   gtk_widget_destroy(dialog);
 }
 
@@ -2393,62 +2394,62 @@ static void showRemoveColumnsCutoffDialog(GtkWidget *belvuWindow)
 {
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
   BelvuContext *bc = properties->bc;
-  
+
   static char *fromText = NULL;
   static char *toText = NULL;
 
   if (!fromText)
     fromText = g_strdup_printf("%.2f", -1.0);
-  
+
   if (!toText)
     toText = g_strdup_printf("%.2f", 0.9);
-  
+
   char *title = g_strdup_printf("%sRemove Columns", belvuGetTitlePrefix(bc));
 
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
-                                                  GTK_WINDOW(belvuWindow), 
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
+                                                  GTK_WINDOW(belvuWindow),
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                                   GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                                   GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                                   NULL);
 
   g_free(title);
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-  
+
   GtkWidget *vbox = gtk_vbox_new(FALSE, DIALOG_YPAD);
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox, FALSE, FALSE, DIALOG_YPAD);
-  
+
   /* Place a label at the top */
   GtkWidget *label1 = gtk_label_new("Remove columns with a (maximum) conservation between: ");
   gtk_misc_set_alignment(GTK_MISC(label1), 0.0, 0.5);
   gtk_box_pack_start(GTK_BOX(vbox), label1, FALSE, FALSE, 0);
-  
+
   /* Place the text entry boxes in an hbox */
   GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, DIALOG_YPAD);
 
   gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(""), FALSE, FALSE, DIALOG_XPAD);
-  
+
   GtkWidget *entry1 = gtk_entry_new();
   gtk_box_pack_start(GTK_BOX(hbox), entry1, FALSE, FALSE, DIALOG_XPAD);
   gtk_entry_set_width_chars(GTK_ENTRY(entry1), strlen(fromText) + 1);
   gtk_entry_set_activates_default(GTK_ENTRY(entry1), TRUE);
   gtk_entry_set_text(GTK_ENTRY(entry1), fromText);
-  
+
   GtkWidget *label2 = gtk_label_new("<   conservation   <=");
   gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5);
   gtk_box_pack_start(GTK_BOX(hbox), label2, FALSE, FALSE, 0);
-  
+
   GtkWidget *entry2 = gtk_entry_new();
   gtk_box_pack_start(GTK_BOX(hbox), entry2, FALSE, FALSE, DIALOG_XPAD);
   gtk_entry_set_width_chars(GTK_ENTRY(entry2), strlen(toText) + 3);
   gtk_entry_set_activates_default(GTK_ENTRY(entry2), TRUE);
   gtk_entry_set_text(GTK_ENTRY(entry2), toText);
-  
+
   gtk_widget_show_all(dialog);
-  
-  
+
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       g_free(fromText);
@@ -2458,11 +2459,11 @@ static void showRemoveColumnsCutoffDialog(GtkWidget *belvuWindow)
       g_free(toText);
       toText = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry2)));
       const double toVal = g_strtod(toText, NULL);
-    
+
       rmColumnCutoff(bc, fromVal, toVal);
       updateOnAlignmentLenChanged(bc->belvuAlignment);
     }
-  
+
   gtk_widget_destroy(dialog);
 }
 
@@ -2472,29 +2473,29 @@ static void showRemoveGappyColumnsDialog(GtkWidget *belvuWindow)
 {
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
   BelvuContext *bc = properties->bc;
-  
+
   static char *inputText = NULL;
-  
+
   if (!inputText)
     inputText = g_strdup_printf("%.0f", 50.0);
-  
+
   GtkWidget *entry = NULL;
   char *title = g_strdup_printf("%sRemove Columns", belvuGetTitlePrefix(bc));
   GtkWidget *dialog = createPromptDialog(belvuWindow, inputText, title, "Remove columns with more than ", " % gaps", &entry);
   g_free(title);
-  
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       g_free(inputText);
       inputText = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
       const double cutoff = g_strtod(inputText, NULL);
-      
+
       rmEmptyColumns(bc, cutoff/100.0);
-      
+
       rmFinaliseColumnRemoval(bc);
       updateOnAlignmentLenChanged(bc->belvuAlignment);
     }
-  
+
   gtk_widget_destroy(dialog);
 }
 
@@ -2510,14 +2511,14 @@ static void showSelectGapCharDialog(GtkWidget *belvuWindow)
   char *title = g_strdup_printf("%sGap Character", belvuGetTitlePrefix(bc));
 
   GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
-                                                  GTK_WINDOW(belvuWindow), 
+                                                  GTK_WINDOW(belvuWindow),
                                                   (GtkDialogFlags)(GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL),
                                                   GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                                   GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                                   NULL);
 
   g_free(title);
-  
+
   g_signal_connect(dialog, "response", G_CALLBACK(onResponseDialog), belvuWindow);
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
 
@@ -2527,13 +2528,13 @@ static void showSelectGapCharDialog(GtkWidget *belvuWindow)
   GtkWidget *label = gtk_label_new("Select gap character:");
   gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
   gtk_box_pack_start(hbox, label, FALSE, FALSE, 12);
-  
+
   /* Create radio buttons for each gap character (only dot or dash at the moment) */
   GtkBox *vbox = GTK_BOX(gtk_vbox_new(FALSE, 12));
   gtk_box_pack_start(hbox, GTK_WIDGET(vbox), TRUE, TRUE, 0);
-  
+
   const gboolean button1Active = (bc->gapChar == '.');
-  
+
   GtkWidget *button1 = gtk_radio_button_new_with_label_from_widget(NULL, "dot  (.) ");
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button1), button1Active);
   gtk_box_pack_start(vbox, button1, FALSE, FALSE, 0);
@@ -2541,41 +2542,41 @@ static void showSelectGapCharDialog(GtkWidget *belvuWindow)
   GtkWidget *button2 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(button1), "dash  (-) ");
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button2), !button1Active);
   gtk_box_pack_start(vbox, button2, FALSE, FALSE, 0);
-  
+
   gtk_window_set_default_size(GTK_WINDOW(dialog), 300, -1);
   gtk_widget_show_all(dialog);
-  
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       char newChar;
-      
+
       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button1)))
         newChar = '.';
-      else 
+      else
         newChar = '-';
-      
+
       if (newChar != bc->gapChar)
         {
           bc->gapChar = newChar;
-          
+
           /* Change all the gaps in the sequences to use the new gap char */
           int i,j;
-          for (i = 0; i < (int)bc->alignArr->len; ++i) 
+          for (i = 0; i < (int)bc->alignArr->len; ++i)
             {
               ALN *alnp = g_array_index(bc->alignArr, ALN*, i);
               char *alnpSeq = alnGetSeq(alnp);
-              
-              for (j = 0; j < bc->maxLen; ++j) 
+
+              for (j = 0; j < bc->maxLen; ++j)
                 {
-                  if (isGap(alnpSeq[j])) 
+                  if (isGap(alnpSeq[j]))
                     alnpSeq[j] = bc->gapChar;
                 }
             }
-          
+
           belvuAlignmentRedrawAll(bc->belvuAlignment);
         }
     }
-  
+
   gtk_widget_destroy(dialog);
 }
 
@@ -2588,35 +2589,35 @@ static void showSelectGapCharDialog(GtkWidget *belvuWindow)
 static void showColorByResIdDialog(GtkWidget *belvuWindow)
 {
   static char *inputText = NULL;
-  
+
   if (!inputText)
     inputText = g_strdup("20.0");
-  
+
   GtkWidget *entry = NULL;
   BelvuContext *bc = windowGetContext(belvuWindow);
   char *title = g_strdup_printf("%sColor by Residue ID", belvuGetTitlePrefix(bc));
   GtkWidget *dialog = createPromptDialog(belvuWindow, inputText, title, "Only colour residues above ", "% identity", &entry);
   g_free(title);
-  
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       if (inputText)
 	g_free(inputText);
-      
+
       inputText = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
 
       BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
       properties->bc->colorByResIdCutoff = g_strtod(inputText, NULL);
-    
+
       /* This sets the flag and also updates the associated 'toggle' menu item */
       setToggleMenuStatus(properties->actionGroup, "toggleColorByResId", TRUE);
-    
+
       /* Update the color scheme and redraw */
       updateSchemeColors(properties->bc);
       belvuAlignmentRedrawAll(properties->bc->belvuAlignment);
     }
-  
-  gtk_widget_destroy(dialog);  
+
+  gtk_widget_destroy(dialog);
 }
 
 
@@ -2629,11 +2630,11 @@ static GtkComboBox* createColorCombo(const int colorNum)
 {
   GtkComboBox *combo = createComboBox();
   GtkTreeIter *iter = NULL;
-  
+
   int i = 0;
   for (i = 0; i < NUM_TRUECOLORS; ++i)
     addComboItem(combo, iter, i, getColorNumName(i), colorNum);
-  
+
   return combo;
 }
 
@@ -2643,12 +2644,12 @@ static GtkComboBox* createColorCombo(const int colorNum)
 static void updateColorButton(GtkWidget *combo, gpointer data)
 {
   GtkWidget *colorButton = GTK_WIDGET(data);
-  
+
   const int colorNum = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
-  
+
   GdkColor color;
   convertColorNumToGdkColor(colorNum, FALSE, &color);
-  
+
   gtk_widget_modify_bg(colorButton, GTK_STATE_NORMAL, &color);
 }
 
@@ -2659,10 +2660,10 @@ static void updateColorResidue(GtkWidget *combo, gpointer data)
 {
   const int colorNum = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
   const char *residue = (const char*)data;
-  
+
   setColor(*residue, colorNum);
-  
-  
+
+
   GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(combo));
   GtkWidget *belvuWindow = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
@@ -2671,12 +2672,12 @@ static void updateColorResidue(GtkWidget *combo, gpointer data)
 }
 
 
-/* Create a color chooser button. This is a bit of a hack because it has to 
+/* Create a color chooser button. This is a bit of a hack because it has to
  * deal with the old-style acedb colors, whereas ideally we would get rid of
  * those and just use a GTK color-button widget. */
-static void createColorButton(const int colorNum, 
-                              GtkTable *table, 
-                              const int row, 
+static void createColorButton(const int colorNum,
+                              GtkTable *table,
+                              const int row,
                               const int col,
                               const int xpad,
                               const int ypad,
@@ -2686,7 +2687,7 @@ static void createColorButton(const int colorNum,
   /* Create the color chooser. First get the current color for this residue */
   GdkColor color;
   convertColorNumToGdkColor(colorNum, FALSE, &color);
-  
+
   /* Create a color box to display the currently-selected color. NB ideally we would get
    * rid of the drop-down box and have a color-picker button instead, but this requires
    * changes to the way colors are stored and saved in order to support more colors than
@@ -2695,7 +2696,7 @@ static void createColorButton(const int colorNum,
   gtk_table_attach(table, colorButton, col, col + 1, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
   gtk_widget_set_size_request(colorButton, 40, 20);
   gtk_widget_modify_bg(colorButton, GTK_STATE_NORMAL, &color);
-  
+
   /* Create a drop-down box to allow the user to select one of the old-style acedb colors. */
   GtkWidget *combo = GTK_WIDGET(createColorCombo(colorNum));
   gtk_table_attach(table, combo, col + 1, col + 2, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
@@ -2709,10 +2710,10 @@ static void createColorButton(const int colorNum,
 
 
 /* This creates a single color item on the edit-residue-colors dialog */
-static void createResidueColorBox(GtkTable *table, 
+static void createResidueColorBox(GtkTable *table,
                                   char *residue,
                                   GString *groups[],
-                                  int *row, 
+                                  int *row,
                                   int *col,
                                   const int xpad,
                                   const int ypad)
@@ -2720,14 +2721,14 @@ static void createResidueColorBox(GtkTable *table,
   /* Create the label */
   GtkWidget *label = gtk_label_new(residue);
   gtk_table_attach(table, label, *col, *col + 1, *row, *row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
-  
+
   /* Create the color chooser. First get the current color for this residue */
   const int colorNum = getColor(*residue);
   createColorButton(colorNum, table, *row, *col + 1, xpad, ypad, G_CALLBACK(updateColorResidue), residue);
-  
+
   /* Append this residue to the group for this color */
 //to do:  g_string_append(groups[colorNum], residue);
-  
+
   *row += 1;
 }
 
@@ -2736,7 +2737,7 @@ static void createResidueColorBox(GtkTable *table,
 static GSList* createResidueList()
 {
   GSList *list = NULL;
-  
+
   list = g_slist_prepend(list, g_strdup("V"));
   list = g_slist_prepend(list, g_strdup("Y"));
   list = g_slist_prepend(list, g_strdup("W"));
@@ -2757,7 +2758,7 @@ static GSList* createResidueList()
   list = g_slist_prepend(list, g_strdup("N"));
   list = g_slist_prepend(list, g_strdup("R"));
   list = g_slist_prepend(list, g_strdup("A"));
-  
+
   return list;
 }
 
@@ -2769,17 +2770,17 @@ static void createResidueColorBoxes(GtkBox *box, GSList *residueList, GString *g
   const int numCols = 7;
   int xpad = 4;
   int ypad = TABLE_YPAD;
-  
+
   GtkTable *table = GTK_TABLE(gtk_table_new(numRows, numCols, FALSE));
   gtk_box_pack_start(box, GTK_WIDGET(table), FALSE, FALSE, 0);
-  
+
   int row = 0;
   int col = 0;
-  
+
   int i = 0;
   GSList *residueItem = residueList;
   const int numResidues = g_slist_length(residueList);
-  
+
   for ( ; residueItem && i < numResidues / 2; ++i, residueItem = residueItem->next)
     {
       createResidueColorBox(table, (char*)(residueItem->data), groups, &row, &col, xpad, ypad);
@@ -2803,55 +2804,55 @@ static void createEditResidueContent(GtkBox *box)
 {
   GtkBox *vbox = GTK_BOX(gtk_vbox_new(FALSE, 0));
   gtk_box_pack_start(box, GTK_WIDGET(vbox), TRUE, TRUE, 0);
-  
+
   static GSList *residueList = NULL;
-  
+
   if (!residueList)
     residueList = createResidueList();
-  
+
 //  GString* groups[NUM_TRUECOLORS];
 //  int i = 0;
 //  for (i = 0; i < NUM_TRUECOLORS; ++i)
 //    groups[i] = g_string_new("");
-  
+
   createResidueColorBoxes(vbox, residueList, NULL);
-  
-  
+
+
 //  GtkTable *table = GTK_TABLE(gtk_table_new(g_slist_length(residueList) + 1, 3, FALSE));
 //  gtk_box_pack_start(vbox, GTK_WIDGET(table), TRUE, TRUE, 0);
 //  int row = 0;
 //  const int xpad = TABLE_XPAD;
 //  const int ypad = TABLE_YPAD;
-//  
+//
 //  GtkWidget *header = gtk_label_new("Groups:");
 //  gtk_table_attach(table, header, 0, 1, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
 //  ++row;
-//  
+//
 //  for (i = 0; i < NUM_TRUECOLORS; ++i)
 //    {
 //      if (groups[i]->len > 0 && groups[i]->str)
 //        {
 //          GdkColor color;
 //          convertColorNumToGdkColor(i, FALSE, &color);
-//          
+//
 //          GtkWidget *eventBox = gtk_event_box_new();
 //          gtk_widget_modify_bg(eventBox, GTK_STATE_NORMAL, &color);
 //          gtk_table_attach(table, eventBox, 0, 1, row, row + 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
-//          
+//
 //          GtkWidget *label = gtk_label_new(getColorNumName(i));
 //          gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
 //          gtk_container_add(GTK_CONTAINER(eventBox), label);
-//          
+//
 //          gtk_table_attach(table, gtk_label_new(":"), 1, 2, row, row + 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
 //
 //          label = gtk_label_new(groups[i]->str);
 //          gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
 //          gtk_table_attach(table, label, 2, 3, row, row + 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
-//          
+//
 //          ++row;
 //        }
 //    }
-// 
+//
 }
 
 
@@ -2862,7 +2863,7 @@ void onResponseEditResidueColorsDialog(GtkDialog *dialog, gint responseId, gpoin
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
   BelvuContext *bc = properties->bc;
-  
+
   switch (responseId)
   {
     case GTK_RESPONSE_ACCEPT:
@@ -2874,7 +2875,7 @@ void onResponseEditResidueColorsDialog(GtkDialog *dialog, gint responseId, gpoin
           setToggleMenuStatus(properties->actionGroup, "colorSchemeCustom", TRUE);
         }
       break;
-      
+
     case GTK_RESPONSE_CANCEL:
     case GTK_RESPONSE_REJECT:
       /* Reset the color scheme, refresh, and close the dialog. */
@@ -2883,11 +2884,11 @@ void onResponseEditResidueColorsDialog(GtkDialog *dialog, gint responseId, gpoin
       updateSchemeColors(bc);
       belvuAlignmentRedrawAll(bc->belvuAlignment);
       break;
-      
+
     default:
       break;
   };
-  
+
   if (destroy)
     {
       gtk_widget_hide_all(GTK_WIDGET(dialog));
@@ -2900,27 +2901,27 @@ static void showEditResidueColorsDialog(GtkWidget *belvuWindow, const gboolean b
 {
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
   BelvuContext *bc = properties->bc;
-  
+
   const BelvuDialogId dialogId = BELDIALOG_EDIT_RESIDUE_COLORS;
   GtkWidget *dialog = getPersistentDialog(bc->dialogList, dialogId);
-  
+
   if (!dialog)
     {
       char *title = g_strdup_printf("%sEdit Residue Colors", belvuGetTitlePrefix(bc));
 
       dialog = gtk_dialog_new_with_buttons(title,
-                                           GTK_WINDOW(belvuWindow), 
+                                           GTK_WINDOW(belvuWindow),
                                            (GtkDialogFlags)(GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL),
                                            GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                            GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                            NULL);
 
       g_free(title);
-      
+
       /* These calls are required to make the dialog persistent... */
       addPersistentDialog(bc->dialogList, dialogId, dialog);
       g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-      
+
       g_signal_connect(dialog, "response", G_CALLBACK(onResponseEditResidueColorsDialog), belvuWindow);
     }
   else
@@ -2928,20 +2929,20 @@ static void showEditResidueColorsDialog(GtkWidget *belvuWindow, const gboolean b
       /* Need to refresh the dialog contents, so clear and re-create content area */
       dialogClearContentArea(GTK_DIALOG(dialog));
     }
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-  
+
   GtkBox *vbox = GTK_BOX(GTK_DIALOG(dialog)->vbox);
   createEditResidueContent(vbox);
 
   /* Show / bring to front */
   gtk_widget_show_all(dialog);
-  
+
   if (bringToFront)
     {
       gtk_window_present(GTK_WINDOW(dialog));
     }
-  
+
 }
 
 
@@ -2953,7 +2954,7 @@ void onResponseConsColorsDialog(GtkDialog *dialog, gint responseId, gpointer dat
   GtkWidget *belvuWindow = GTK_WIDGET(data);
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
   BelvuContext *bc = properties->bc;
-  
+
   switch (responseId)
   {
     case GTK_RESPONSE_ACCEPT:
@@ -2961,25 +2962,25 @@ void onResponseConsColorsDialog(GtkDialog *dialog, gint responseId, gpointer dat
       destroy = widgetCallAllCallbacks(GTK_WIDGET(dialog), GINT_TO_POINTER(responseId));
       setToggleMenuStatus(properties->actionGroup, "ColorByCons", TRUE);
       break;
-      
+
     case GTK_RESPONSE_APPLY:
       /* Never close */
       destroy = FALSE;
       widgetCallAllCallbacks(GTK_WIDGET(dialog), GINT_TO_POINTER(responseId));
       setToggleMenuStatus(properties->actionGroup, "ColorByCons", TRUE);
       break;
-      
+
     case GTK_RESPONSE_CANCEL:
     case GTK_RESPONSE_REJECT:
       /* Reset the color scheme. */
       destroy = TRUE;
       saveOrResetConsColors(bc, FALSE); /* restores old values */
       break;
-      
+
     default:
       break;
   };
-  
+
   onColorSchemeChanged(properties);
 
   if (destroy)
@@ -2994,11 +2995,11 @@ static void updateConsFgColor(GtkWidget *combo, gpointer data)
 {
   int *colorNum = (int*)data;
   *colorNum = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
-  
+
   GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(combo));
   GtkWidget *belvuWindow = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   onColorSchemeChanged(properties);
 }
 
@@ -3008,11 +3009,11 @@ static void updateConsBgColor(GtkWidget *combo, gpointer data)
 {
   int *colorNum = (int*)data;
   *colorNum = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
-  
+
   GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(combo));
   GtkWidget *belvuWindow = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
-  
+
   onColorSchemeChanged(properties);
 }
 
@@ -3023,10 +3024,10 @@ static gboolean onConsThresholdChanged(GtkWidget *widget, gint responseId, gpoin
 {
   GtkEntry *entry = GTK_ENTRY(widget);
   double *val = (double*)data;
-  
+
   const gchar *inputText = gtk_entry_get_text(entry);
   *val = g_strtod(inputText, NULL);
-  
+
   return TRUE;
 }
 
@@ -3038,20 +3039,20 @@ static void addConsColorLine(BelvuContext *bc, const char *labelText, const Belv
   GtkWidget *label = gtk_label_new(labelText);
   gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.0);
   gtk_table_attach(table, label, 0, 1, *row, *row + 1, GTK_FILL, GTK_SHRINK, TABLE_XPAD, TABLE_YPAD);
-  
+
   /* Threshold entry box */
   GtkWidget *entry = gtk_entry_new();
   gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-  
+
   char *defaultInput = g_strdup_printf("%.1f", *cutoff);
   gtk_entry_set_text(GTK_ENTRY(entry), defaultInput);
   gtk_entry_set_width_chars(GTK_ENTRY(entry), strlen(defaultInput) + 2);
   g_free(defaultInput);
   defaultInput = NULL;
-  
+
   gtk_table_attach(table, entry, 1, 2, *row, *row + 1, GTK_FILL, GTK_SHRINK, TABLE_XPAD, TABLE_YPAD);
   widgetSetCallbackData(entry, onConsThresholdChanged, cutoff);
-  
+
   /* Text color chooser */
   int *fgColorNum = getConsColor(bc, consLevel, TRUE);
   createColorButton(*fgColorNum, table, *row, 2, 2, TABLE_YPAD, G_CALLBACK(updateConsFgColor), fgColorNum);
@@ -3065,7 +3066,7 @@ static void addConsColorLine(BelvuContext *bc, const char *labelText, const Belv
 
 
 /* Hacky function to save the current conservation colors or reset them to
- * previously saved values (if 'save' is false). Ideally, the drawing 
+ * previously saved values (if 'save' is false). Ideally, the drawing
  * functions would not use the colors in the BelvuContext directly and we'd
  * therefore be able to show the user different colors without having to change
  * the BelvuContext, and hence without the need for this hacky undo function. */
@@ -3079,7 +3080,7 @@ static void saveOrResetConsColors(BelvuContext *bc, const gboolean save)
   static double lowSimCutoff = 0;
   static double midSimCutoff = 0;
   static double maxSimCutoff = 0;
-  
+
   static int maxfgColor = 0;
   static int midfgColor = 0;
   static int lowfgColor = 0;
@@ -3091,7 +3092,7 @@ static void saveOrResetConsColors(BelvuContext *bc, const gboolean save)
   static int lowfgPrintColor = 0;
   static int maxbgPrintColor = 0;
   static int midbgPrintColor = 0;
-  static int lowbgPrintColor = 0;  
+  static int lowbgPrintColor = 0;
   if (save)
     {
       /* Remember the current conservation colors */
@@ -3146,35 +3147,35 @@ static void createEditConsColorsContent(GtkBox *box, BelvuContext *bc)
 {
   /* Save current values so that we can restore them later if we cancel */
   saveOrResetConsColors(bc, TRUE);
-  
+
   /* We'll put everything in a vbox */
   GtkBox *vbox = GTK_BOX(gtk_vbox_new(FALSE, 0));
   gtk_box_pack_start(box, GTK_WIDGET(vbox), FALSE, FALSE, 0);
-  
+
   /* Create the labels */
   char *tmpStr = g_strdup_printf("Coloring by %s", bc->consScheme == BELVU_SCHEME_BLOSUM ? "average BLOSUM62 score" : "% identity");
-  
+
   GtkWidget *label = gtk_label_new(tmpStr);
   gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
   gtk_box_pack_start(vbox, label, FALSE, FALSE, DIALOG_YPAD);
-  
+
   g_free(tmpStr);
   tmpStr = NULL;
 
   const gboolean colorById = (bc->consScheme == BELVU_SCHEME_ID || bc->consScheme == BELVU_SCHEME_ID_BLOSUM);
   const gboolean colorBySim = (bc->consScheme == BELVU_SCHEME_BLOSUM || bc->consScheme == BELVU_SCHEME_ID_BLOSUM);
-  
+
   if (colorBySim)
     {
       label = gtk_label_new("Similar residues according to BLOSUM62 are coloured as the most conserved one.");
       gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
       gtk_box_pack_start(vbox, label, FALSE, FALSE, DIALOG_YPAD);
     }
-  
+
   /* Place the main widgets in a table */
   GtkTable *table = GTK_TABLE(gtk_table_new(4, 6, FALSE));
   gtk_box_pack_start(vbox, GTK_WIDGET(table), TRUE, TRUE, DIALOG_YPAD);
-  
+
   /* 1st row contains labels */
   int row = 0;
   label = gtk_label_new("Threshold");\
@@ -3188,12 +3189,12 @@ static void createEditConsColorsContent(GtkBox *box, BelvuContext *bc)
   label = gtk_label_new("Background colour");
   gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
   gtk_table_attach(table, label, 4, 6, row, row + 1, GTK_FILL, GTK_SHRINK, TABLE_XPAD, TABLE_YPAD);
-  
+
   ++row;
   addConsColorLine(bc, "Max:", CONS_LEVEL_MAX, colorById ? &bc->maxIdCutoff : &bc->maxSimCutoff, table, &row);
   addConsColorLine(bc, "Mid:", CONS_LEVEL_MID, colorById ? &bc->midIdCutoff : &bc->midSimCutoff, table, &row);
   addConsColorLine(bc, "Low:", CONS_LEVEL_LOW, colorById ? &bc->lowIdCutoff : &bc->lowSimCutoff, table, &row);
-  
+
   label = gtk_label_new("Press Enter or click Add to update the display after changing threshold values.");
   gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
   gtk_box_pack_start(vbox, label, FALSE, FALSE, DIALOG_YPAD);
@@ -3209,16 +3210,16 @@ static void showEditConsColorsDialog(GtkWidget *belvuWindow, const gboolean brin
 {
   BelvuWindowProperties *properties = belvuWindowGetProperties(belvuWindow);
   BelvuContext *bc = properties->bc;
-  
+
   const BelvuDialogId dialogId = BELDIALOG_EDIT_CONS_COLORS;
   GtkWidget *dialog = getPersistentDialog(bc->dialogList, dialogId);
-  
+
   if (!dialog)
     {
       char *title = g_strdup_printf("%sEdit Conservation Colors", belvuGetTitlePrefix(bc));
 
-      dialog = gtk_dialog_new_with_buttons(title, 
-                                           GTK_WINDOW(belvuWindow), 
+      dialog = gtk_dialog_new_with_buttons(title,
+                                           GTK_WINDOW(belvuWindow),
                                            (GtkDialogFlags)(GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL),
                                            GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                            GTK_STOCK_ADD, GTK_RESPONSE_APPLY,
@@ -3226,11 +3227,11 @@ static void showEditConsColorsDialog(GtkWidget *belvuWindow, const gboolean brin
                                            NULL);
 
       g_free(title);
-      
+
       /* These calls are required to make the dialog persistent... */
       addPersistentDialog(bc->dialogList, dialogId, dialog);
       g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-      
+
       g_signal_connect(dialog, "response", G_CALLBACK(onResponseConsColorsDialog), belvuWindow);
     }
   else
@@ -3238,20 +3239,20 @@ static void showEditConsColorsDialog(GtkWidget *belvuWindow, const gboolean brin
       /* Need to refresh the dialog contents, so clear and re-create content area */
       dialogClearContentArea(GTK_DIALOG(dialog));
     }
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY);
-  
+
   GtkBox *vbox = GTK_BOX(GTK_DIALOG(dialog)->vbox);
   createEditConsColorsContent(vbox, bc);
-  
+
   /* Show / bring to front */
   gtk_widget_show_all(dialog);
-  
+
   if (bringToFront)
     {
       gtk_window_present(GTK_WINDOW(dialog));
     }
-  
+
 }
 
 
@@ -3259,36 +3260,36 @@ static void showEditConsColorsDialog(GtkWidget *belvuWindow, const gboolean brin
  *                         Wrap window                     *
  ***********************************************************/
 
-/* Create a text entry with a label.  'labelText' gives the label text and 
+/* Create a text entry with a label.  'labelText' gives the label text and
  * defaultInput gives the default input to show in the text entry (may be null).
  * Adds the result to table, if given, and returns the text entry widget */
-static GtkWidget* createTextEntryWithLabel(const char *labelText, 
-                                           const char *defaultInput, 
+static GtkWidget* createTextEntryWithLabel(const char *labelText,
+                                           const char *defaultInput,
                                            GtkTable *table,
                                            const int col,
                                            const int row)
 {
   const int xpad = 2;
   const int ypad = 2;
-  
+
   /* Create the label in the given column */
   GtkWidget *label = gtk_label_new(labelText);
   gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
   gtk_table_attach(table, label, col, col + 1, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
-  
+
   /* Create the entry in the next column */
   GtkWidget *entry = gtk_entry_new();
   gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
 
   gtk_table_attach(table, entry, col + 1, col + 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_SHRINK, xpad, ypad);
-  
+
   if (defaultInput)
     {
       gtk_entry_set_text(GTK_ENTRY(entry), defaultInput);
       const int defaultLen = min((int)strlen(defaultInput) * 8, 500);
       gtk_widget_set_size_request(entry, defaultLen, -1);
     }
-  
+
   return entry;
 }
 
@@ -3299,37 +3300,37 @@ static void showWrapDialog(BelvuContext *bc, GtkWidget *belvuWindow)
 {
   char *title = g_strdup_printf("%swrap alignment", belvuGetTitlePrefix(bc));
 
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
-                                                  GTK_WINDOW(belvuWindow), 
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
+                                                  GTK_WINDOW(belvuWindow),
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                                   GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                                   GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                                   NULL);
 
   g_free(title);
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
   GtkWidget *contentArea = GTK_DIALOG(dialog)->vbox;
 
   /* Create a text entry for the line width and title */
   GtkWidget *table = gtk_table_new(2, 2, FALSE);
   gtk_box_pack_start(GTK_BOX(contentArea), table, TRUE, TRUE, 0);
-  
+
   GtkWidget *widthEntry = createTextEntryWithLabel("Line width", "80", GTK_TABLE(table), 0, 0);
   GtkWidget *titleEntry = createTextEntryWithLabel("Title", bc->Title, GTK_TABLE(table), 0, 1);
-  
+
   gtk_widget_show_all(dialog);
-  
+
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
     {
       const gchar *inputText = gtk_entry_get_text(GTK_ENTRY(widthEntry));
       const int linelen = convertStringToInt(inputText);
-      
+
       const gchar *title = gtk_entry_get_text(GTK_ENTRY(titleEntry));
-      
+
       createWrapWindow(belvuWindow, linelen, title);
     }
-  
+
   gtk_widget_destroy(dialog);
 }
 
@@ -3361,7 +3362,7 @@ static void widgetGetDrawing(GtkWidget *widget, gpointer data)
 static void setWrapWindowStyleProperties(GtkWidget *window)
 {
   gtk_widget_set_name(window, WRAPPED_BELVU_WINDOW_NAME);
-  
+
   /* Set the initial window size based on some fraction of the screen size */
   int screenWidth = 300, screenHeight = 200;
   gbtools::GUIGetTrueMonitorSize(window, &screenWidth, &screenHeight);
@@ -3379,38 +3380,38 @@ static void createWrapWindow(GtkWidget *belvuWindow, const int linelen, const gc
   /* Create the window */
   GtkWidget *wrapWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   setWrapWindowStyleProperties(wrapWindow);
-  
+
   BelvuContext *bc = windowGetContext(belvuWindow);
   char *windowTitle = g_strdup_printf("%s%s", belvuGetTitlePrefix(bc), properties->bc->Title);
   gtk_window_set_title(GTK_WINDOW(wrapWindow), windowTitle);
   g_free(windowTitle);
-  
+
   /* We must add all toplevel windows to the list of spawned windows */
   properties->bc->spawnedWindows = g_slist_prepend(properties->bc->spawnedWindows, wrapWindow);
-  
+
   /* Create the context menu and set a callback to show it */
   GtkActionGroup *actionGroup = NULL;
   GtkUIManager *uiManager = createUiManager(wrapWindow, properties->bc, &actionGroup);
   GtkWidget *contextmenu = createBelvuMenu(wrapWindow, "/WrapContextMenu", uiManager);
-  
+
   gtk_widget_add_events(wrapWindow, GDK_BUTTON_PRESS_MASK);
   g_signal_connect(G_OBJECT(wrapWindow), "button-press-event", G_CALLBACK(onButtonPressBelvu), contextmenu);
-  
+
   /* We'll place everything in a vbox */
   GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(wrapWindow), vbox);
-  
+
   /* Add the alignment section */
   GtkWidget *wrappedAlignment = createBelvuAlignment(properties->bc, title, linelen);
   gtk_box_pack_start(GTK_BOX(vbox), wrappedAlignment, TRUE, TRUE, 0);
-  
+
   /* Set properties */
   genericWindowCreateProperties(wrapWindow, properties->bc, actionGroup);
 
   /* Show window */
   gtk_widget_show_all(wrapWindow);
   gtk_window_present(GTK_WINDOW(wrapWindow));
-  
+
   /* Make sure the font size is up to date */
   onBelvuAlignmentFontSizeChanged(wrappedAlignment);
 }
@@ -3430,10 +3431,10 @@ static void setOrgsWindowStyleProperties(GtkWidget *window, BelvuContext *bc)
 
   int screenWidth = 100, screenHeight = 100;
   gbtools::GUIGetTrueMonitorSize(window, &screenWidth, &screenHeight);
-  
+
   const int maxWidth = screenWidth * MAX_ORGS_WINDOW_WIDTH_FRACTION;
   const int maxHeight = screenHeight * MAX_ORGS_WINDOW_HEIGHT_FRACTION;
-  
+
   int width = min((gdouble)maxWidth, charWidth * bc->maxNameLen + ORGS_WINDOW_XPAD * 2);
   int height = min((gdouble)maxHeight, charHeight * bc->organismArr->len + ORGS_WINDOW_YPAD * 2);
   gtk_window_set_default_size(GTK_WINDOW(window), width, height);
@@ -3453,19 +3454,19 @@ static void drawOrganisms(GtkWidget *widget, GdkDrawable *drawable, BelvuContext
   const int x = ORGS_WINDOW_XPAD;
   int i = 0;
 
-  for ( ; i < (int)bc->organismArr->len; ++i) 
+  for ( ; i < (int)bc->organismArr->len; ++i)
     {
       ALN *alnp = g_array_index(bc->organismArr, ALN*, i);
-    
+
       convertColorNumToGdkColor(alnp->color, FALSE, &color);
       gdk_gc_set_foreground(gc, &color);
-    
+
       int text_width = 0;
       drawText(widget, drawable, gc, x, y, alnp->organism, &text_width, NULL);
 
       y += charHeight;
     }
- 
+
   g_message_info("%d organisms found\n", bc->organismArr->len);
   g_object_unref(gc);
 }
@@ -3476,11 +3477,11 @@ static gboolean onExposeOrganismsView(GtkWidget *widget, GdkEventExpose *event,
 {
   GdkDrawable *window = GTK_LAYOUT(widget)->bin_window;
   BelvuContext *bc = (BelvuContext*)data;
-  
+
   if (window)
     {
       GdkDrawable *bitmap = widgetGetDrawable(widget);
-      
+
       if (!bitmap)
 	{
 	  /* There isn't a bitmap yet. Create it now. */
@@ -3489,7 +3490,7 @@ static gboolean onExposeOrganismsView(GtkWidget *widget, GdkEventExpose *event,
 	  bitmap = createBlankSizedPixmap(widget, window, width, height);
 	  drawOrganisms(widget, bitmap, bc);
 	}
-      
+
       if (bitmap)
 	{
 	  /* Push the bitmap onto the window */
@@ -3502,7 +3503,7 @@ static gboolean onExposeOrganismsView(GtkWidget *widget, GdkEventExpose *event,
 	  g_warning("Failed to draw Organisms view [%p] - could not create bitmap.\n", widget);
 	}
     }
-  
+
   return TRUE;
 }
 
@@ -3513,27 +3514,27 @@ static void createOrganismWindow(BelvuContext *bc)
   bc->orgsWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   setOrgsWindowStyleProperties(bc->orgsWindow, bc);
   g_signal_connect(bc->orgsWindow, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-  
+
   char *title = g_strdup_printf("%sOrganisms", belvuGetTitlePrefix(bc));
   gtk_window_set_title(GTK_WINDOW(bc->orgsWindow), title);
   g_free(title);
-  
+
   /* We must add all toplevel windows to the list of spawned windows */
   bc->spawnedWindows = g_slist_prepend(bc->spawnedWindows, bc->orgsWindow);
-  
+
   /* Create the context menu and set a callback to show it */
   GtkActionGroup *actionGroup = NULL;
   GtkUIManager *uiManager = createUiManager(bc->orgsWindow, bc, &actionGroup);
   GtkWidget *contextmenu = createBelvuMenu(bc->orgsWindow, "/OrgsContextMenu", uiManager);
-  
+
   gtk_widget_add_events(bc->orgsWindow, GDK_BUTTON_PRESS_MASK);
   g_signal_connect(G_OBJECT(bc->orgsWindow), "button-press-event", G_CALLBACK(onButtonPressBelvu), contextmenu);
-  
+
   /* Create a scrollable drawing area */
   GtkWidget *scrollWin = gtk_scrolled_window_new(NULL, NULL);
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollWin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
   gtk_container_add(GTK_CONTAINER(bc->orgsWindow), scrollWin);
-  
+
   GtkWidget *drawing = gtk_layout_new(NULL, NULL);
   gtk_container_add(GTK_CONTAINER(scrollWin), drawing);
   g_signal_connect(G_OBJECT(drawing), "expose-event", G_CALLBACK(onExposeOrganismsView), bc);
@@ -3552,14 +3553,14 @@ static void createOrganismWindow(BelvuContext *bc)
   /* Add some padding in the main window for space around the layout etc. It doesn't matter too
    * much if this is too small because the window is resizable */
   gtk_window_set_default_size(GTK_WINDOW(bc->orgsWindow), width * 2 + 20, height + 20) ;
-  
+
   /* Set default background color */
   GdkColor *bgColor = getGdkColor(BELCOLOR_BACKGROUND, bc->defaultColors, FALSE, FALSE);
   gtk_widget_modify_bg(drawing, GTK_STATE_NORMAL, bgColor);
-  
+
   /* Set properties */
   genericWindowCreateProperties(bc->orgsWindow, bc, actionGroup);
-  
+
   gtk_widget_show_all(bc->orgsWindow);
   gtk_window_present(GTK_WINDOW(bc->orgsWindow));
 }
@@ -3572,45 +3573,45 @@ static void createOrganismWindow(BelvuContext *bc)
 void showAnnotationWindow(BelvuContext *bc)
 {
   /* If there are no annotations, there's nothing to do */
-  if (g_slist_length(bc->annotationList) < 1) 
+  if (g_slist_length(bc->annotationList) < 1)
     return;
-  
+
   /* Loop through each annotation line */
   GString *resultStr = g_string_new("");
   int maxLen = 0;
   GSList *annItem = bc->annotationList;
-  
+
   for ( ; annItem; annItem = annItem->next)
     {
       /* Calculate the max line length */
       const char *cp = (const char*)(annItem->data);
-      
-      if ((int)strlen(cp) > maxLen) 
+
+      if ((int)strlen(cp) > maxLen)
         maxLen = strlen(cp);
-      
+
       /* Append this text to the string */
       g_string_append_printf(resultStr, "%s\n", cp);
     }
-  
+
   /* Create the dialog */
   char *title = g_strdup_printf("%sAnnotations", belvuGetTitlePrefix(bc));
 
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
-                                                  NULL, 
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
+                                                  NULL,
                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
                                                   GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT,
                                                   NULL);
 
   g_free(title);
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
   g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), NULL);
-  
+
   /* Use a fixed-width font */
   const char *fontFamily = findFixedWidthFont(dialog);
   PangoFontDescription *fontDesc = pango_font_description_from_string(fontFamily);
   pango_font_description_set_size(fontDesc, pango_font_description_get_size(dialog->style->font_desc));
-  
+
   GtkWidget *textView = createScrollableTextView(resultStr->str, FALSE, fontDesc, FALSE, NULL, NULL, NULL);
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), textView, TRUE, TRUE, 0);
 
@@ -3630,7 +3631,7 @@ void showAnnotationWindow(BelvuContext *bc)
                                   &maxWidth, &maxHeight);
   width = min(width, maxWidth);
   height = min(height, maxHeight);
-  
+
   gtk_window_set_default_size(GTK_WINDOW(dialog), width, height);
 
   gtk_widget_show_all(dialog);
@@ -3646,9 +3647,9 @@ void showAnnotationWindow(BelvuContext *bc)
 static void updateFeedbackBox(BelvuContext *bc, GtkWidget *feedbackBox)
 {
   GString *resultStr = g_string_new("");
-  
+
   char *tmpStr = NULL;
-  
+
   /* If a column is selected, display the column number */
   if (bc->selectedCol > 0)
     {
@@ -3656,16 +3657,16 @@ static void updateFeedbackBox(BelvuContext *bc, GtkWidget *feedbackBox)
       g_string_append(resultStr, tmpStr);
       g_free(tmpStr);
     }
-  
+
   /* If an alignment is selected, display info about it */
   if (bc->selectedAln && alnGetSeq(bc->selectedAln))
     {
       char *selectedSeq = alnGetSeq(bc->selectedAln);
-      
+
       tmpStr = g_strdup_printf("%s/%d-%d", bc->selectedAln->name, bc->selectedAln->start, bc->selectedAln->end);
       g_string_append(resultStr, tmpStr);
       g_free(tmpStr);
-      
+
       /* If a column is selected, display info about the selected alignment's
        * coord at that column position. */
       if (bc->selectedCol > 0)
@@ -3674,21 +3675,21 @@ static void updateFeedbackBox(BelvuContext *bc, GtkWidget *feedbackBox)
           tmpStr = g_strdup_printf("  %c = ", selectedSeq[bc->selectedCol - 1]);
           g_string_append(resultStr, tmpStr);
           g_free(tmpStr);
-          
+
           /* Loop through each column before the selected column and calculate the
            * number of gaps. Also note whether we see an asterisk in the sequence */
           gboolean hasAsterisk = FALSE;
           int numGaps = 0;
           int colIdx = 0;
-          
+
           for ( ; colIdx < bc->selectedCol; colIdx++)
             {
-              if (isGap(selectedSeq[colIdx])) 
+              if (isGap(selectedSeq[colIdx]))
                 numGaps++;
-              else if (selectedSeq[colIdx] == '*') 
+              else if (selectedSeq[colIdx] == '*')
                 hasAsterisk = TRUE;
             }
-          
+
           if (hasAsterisk)
             {
               g_string_append(resultStr, "(unknown position due to insertion)");
@@ -3700,22 +3701,22 @@ static void updateFeedbackBox(BelvuContext *bc, GtkWidget *feedbackBox)
               g_free(tmpStr);
             }
         }
-      
+
       /* Display the total number of highlighted alignments */
       const int numHighlighted = g_slist_length(bc->highlightedAlns);
-      
+
       tmpStr = g_strdup_printf(" (%d match", numHighlighted);
       g_string_append(resultStr, tmpStr);
       g_free(tmpStr);
-      
+
       if (numHighlighted != 1)
         g_string_append(resultStr, "es");
-      
+
       g_string_append(resultStr, ")");
     }
-  
+
   gtk_entry_set_text(GTK_ENTRY(feedbackBox), resultStr->str);
-  
+
   g_string_free(resultStr, TRUE);
 }
 
@@ -3726,16 +3727,16 @@ void onRowSelectionChanged(BelvuContext *bc)
   /* Redraw the alignment widget */
   belvuAlignmentRedrawAll(bc->belvuAlignment);
   centerHighlighted(bc, bc->belvuAlignment);
-  
+
   /* Redraw all of the trees */
   g_slist_foreach(bc->spawnedWindows, belvuTreeRedrawAll, NULL);
-  
+
   /* Set the status of the 'exclude highlighted' toggle menu option
    * depending on whether the newly-selected sequence is selected or not
    * (or grey it out if nothing is selected) */
   BelvuWindowProperties *properties = belvuWindowGetProperties(bc->belvuWindow);
   enableMenuAction(properties->actionGroup, "excludeHighlighted", bc->selectedAln != NULL);
-  
+
   if (bc->selectedAln)
     {
       setToggleMenuStatus(properties->actionGroup, "excludeHighlighted", bc->selectedAln->nocolor);
@@ -3759,7 +3760,7 @@ void onRowSelectionChanged(BelvuContext *bc)
 
   /* Update the feedback box */
   updateFeedbackBox(properties->bc, properties->feedbackBox);
-  
+
   /* If the current sort method is by similarity/id to the selected sequence,
    * this has effectively been 'invalidated' by the fact that the selected
    * sequence has changed. We don't undo the sort, but we must set the sort
@@ -3775,7 +3776,7 @@ void onColSelectionChanged(BelvuContext *bc)
   /* Update the feedback box */
   BelvuWindowProperties *properties = belvuWindowGetProperties(bc->belvuWindow);
   updateFeedbackBox(properties->bc, properties->feedbackBox);
-  
+
   /* Refresh the alignment widget */
   belvuAlignmentRefreshAll(bc->belvuAlignment);
 }
@@ -3809,7 +3810,7 @@ static gboolean onKeyPressEscape(BelvuContext *bc)
       BelvuWindowProperties *properties = belvuWindowGetProperties(bc->belvuWindow);
       setToggleMenuStatus(properties->actionGroup, "rmMany", !bc->removingSeqs);
     }
-  
+
   return TRUE;
 }
 
@@ -3839,7 +3840,7 @@ static gboolean onKeyPressLeftRight(BelvuContext *bc, const gboolean left, const
       /* Scroll to the top/bottom of the alignment list */
       hScrollPageLeftRight(bc->belvuAlignment, left);
     }
-  
+
   return TRUE;
 }
 
@@ -3855,7 +3856,7 @@ static gboolean onKeyPressUpDown(BelvuContext *bc, const gboolean up, const gboo
       /* Scroll one page up/down */
       vScrollPageUpDown(bc->belvuAlignment, up);
     }
-  
+
   return TRUE;
 }
 
@@ -3873,7 +3874,7 @@ static gboolean onKeyPressCommaPeriod(BelvuContext *bc, const gboolean comma, co
       /* Scroll left/right by one character */
       hScrollLeftRight(bc->belvuAlignment, comma, 1);
     }
-  
+
   return TRUE;
 }
 
@@ -3891,7 +3892,7 @@ static gboolean onKeyPressPlusMinus(BelvuContext *bc, const gboolean plus, const
     incrementFontSize(bc);
   else
     decrementFontSize(bc);
-    
+
   return TRUE;
 }
 
@@ -3904,31 +3905,31 @@ static gboolean onKeyPressPlusMinus(BelvuContext *bc, const gboolean plus, const
 gboolean onKeyPressBelvu(GtkWidget *window, GdkEventKey *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   BelvuContext *bc = (BelvuContext*)data;
 
-  const gboolean ctrl = (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;	
-  const gboolean shift = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;	
-  
+  const gboolean ctrl = (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
+  const gboolean shift = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
+
   switch (event->keyval)
     {
       case GDK_Escape:    handled = onKeyPressEscape(bc);                          break;
-        
+
       case GDK_Home:      handled = onKeyPressHomeEnd(bc, TRUE, ctrl, shift);      break;
       case GDK_End:       handled = onKeyPressHomeEnd(bc, FALSE, ctrl, shift);     break;
       case GDK_Page_Up:   handled = onKeyPressPageUpDown(bc, TRUE, ctrl, shift);   break;
       case GDK_Page_Down: handled = onKeyPressPageUpDown(bc, FALSE, ctrl, shift);  break;
-        
+
       case GDK_Left:      handled = onKeyPressLeftRight(bc, TRUE, ctrl, shift);    break;
       case GDK_Right:     handled = onKeyPressLeftRight(bc, FALSE, ctrl, shift);   break;
       case GDK_Up:        handled = onKeyPressUpDown(bc, TRUE, ctrl, shift);       break;
       case GDK_Down:      handled = onKeyPressUpDown(bc, FALSE, ctrl, shift);      break;
-        
+
       case GDK_less:      /* fall through */
       case GDK_comma:     handled = onKeyPressCommaPeriod(bc, TRUE, ctrl, shift);  break;
       case GDK_greater:   /* fall through */
       case GDK_period:    handled = onKeyPressCommaPeriod(bc, FALSE, ctrl, shift); break;
-        
+
       case GDK_Insert:    handled = onKeyPressInsDel(bc, TRUE, ctrl, shift);       break;
       case GDK_Delete:    handled = onKeyPressInsDel(bc, FALSE, ctrl, shift);      break;
 
@@ -3939,7 +3940,7 @@ gboolean onKeyPressBelvu(GtkWidget *window, GdkEventKey *event, gpointer data)
 
       default: break;
     };
-  
+
   return handled;
 }
 
@@ -3948,10 +3949,10 @@ gboolean onKeyPressBelvu(GtkWidget *window, GdkEventKey *event, gpointer data)
 gboolean onButtonPressBelvu(GtkWidget *window, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->type == GDK_BUTTON_PRESS && event->button == 3) /* right click */
     {
-      /* For the main window, if we're removing sequences, then just cancel that mode. 
+      /* For the main window, if we're removing sequences, then just cancel that mode.
        * Otherwise (and for any other window type) show the context menu. */
       if (stringsEqual(gtk_widget_get_name(window), MAIN_BELVU_WINDOW_NAME, TRUE))
 	{
@@ -3970,7 +3971,7 @@ gboolean onButtonPressBelvu(GtkWidget *window, GdkEventButton *event, gpointer d
 	  handled = TRUE;
 	}
     }
-  
+
   return handled;
 }
 
@@ -3984,19 +3985,19 @@ static GtkWidget* createFeedbackBox(GtkToolbar *toolbar)
   /* Bit of a hack, but add some space before the feedback box, just
    * to avoid the toolbar being too cluttered. */
   addToolbarWidget(toolbar, gtk_label_new("    "), -1);
-  
+
   GtkWidget *feedbackBox = gtk_entry_new();
-  
+
   /* User can copy text out but not edit contents */
   gtk_editable_set_editable(GTK_EDITABLE(feedbackBox), FALSE);
-  
+
   GtkToolItem *item = addToolbarWidget(toolbar, feedbackBox, -1);
-  gtk_tool_item_set_expand(item, TRUE); 
-  
-  /* We want the box to be printed, so connect the expose function that will 
+  gtk_tool_item_set_expand(item, TRUE);
+
+  /* We want the box to be printed, so connect the expose function that will
    * draw to a pixmap for printing */
   g_signal_connect(G_OBJECT(feedbackBox), "expose-event", G_CALLBACK(onExposePrintable), NULL);
-  
+
   return feedbackBox;
 }
 
@@ -4010,10 +4011,10 @@ static void setStyleProperties(GtkWidget *window, GtkToolbar *toolbar)
                                   &width, &height);
 
   gtk_window_set_default_size(GTK_WINDOW(window), width, height);
-  
-  gtk_container_set_border_width (GTK_CONTAINER(window), DEFAULT_WINDOW_BORDER_WIDTH); 
+
+  gtk_container_set_border_width (GTK_CONTAINER(window), DEFAULT_WINDOW_BORDER_WIDTH);
   gtk_window_set_mnemonic_modifier(GTK_WINDOW(window), GDK_MOD1_MASK); /* MOD1 is ALT on most systems */
-  
+
     /* Set toolbar style properties */
   gtk_toolbar_set_style(toolbar, GTK_TOOLBAR_ICONS);
   gtk_toolbar_set_icon_size(toolbar, GTK_ICON_SIZE_SMALL_TOOLBAR);
@@ -4023,7 +4024,7 @@ static void setStyleProperties(GtkWidget *window, GtkToolbar *toolbar)
 gboolean createBelvuWindow(BelvuContext *bc, BlxMessageData *msgData)
 {
   gboolean ok = TRUE;
-  
+
   GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_widget_set_name(window, MAIN_BELVU_WINDOW_NAME);
 
@@ -4034,7 +4035,7 @@ gboolean createBelvuWindow(BelvuContext *bc, BlxMessageData *msgData)
   char *title = g_strdup_printf("%s%s", belvuGetTitlePrefix(bc), bc->Title);
   gtk_window_set_title(GTK_WINDOW(window), title);
   g_free(title);
-  
+
   /* Create the status bar */
   GtkWidget *statusBar = gtk_statusbar_new();
   gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(statusBar), TRUE);
@@ -4048,22 +4049,22 @@ gboolean createBelvuWindow(BelvuContext *bc, BlxMessageData *msgData)
   /* Create the menu and toolbar */
   GtkActionGroup *actionGroup = NULL;
   GtkUIManager *uiManager = createUiManager(window, bc, &actionGroup);
-  
+
   GtkWidget *menubar = createBelvuMenu(window, "/MenuBar", uiManager);
   GtkWidget *contextmenu = createBelvuMenu(window, "/ContextMenu", uiManager);
   GtkWidget *toolbar = createBelvuMenu(window, "/Toolbar", uiManager);
-  
+
   addToolbarWidget(GTK_TOOLBAR(toolbar), gtk_label_new("    "), 0); /* hacky way to add some space at start of toolbar */
 
   /* Create the feedback box on the toolbar */
   GtkWidget *feedbackBox = createFeedbackBox(GTK_TOOLBAR(toolbar));
-  
+
   /* Set the style properties */
   setStyleProperties(window, GTK_TOOLBAR(toolbar));
 
   /* Create the alignment section. Store it in the context so that we can update it. */
   bc->belvuAlignment = createBelvuAlignment(bc, NULL, UNSET_INT);
-  
+
   /* We'll put everything in a vbox */
   GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(vbox));
@@ -4073,7 +4074,7 @@ gboolean createBelvuWindow(BelvuContext *bc, BlxMessageData *msgData)
   gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
   gtk_box_pack_start(GTK_BOX(hbox), menubar, FALSE, FALSE, 0);
   gtk_box_pack_start(GTK_BOX(hbox), toolbar, TRUE, TRUE, 0);
-  
+
   gtk_box_pack_start(GTK_BOX(vbox), bc->belvuAlignment, TRUE, TRUE, 0);
   gtk_box_pack_start(GTK_BOX(vbox), statusBar, FALSE, FALSE, 0);
 
@@ -4091,11 +4092,11 @@ gboolean createBelvuWindow(BelvuContext *bc, BlxMessageData *msgData)
   /* Show the main window (unless we only want the tree) */
   if (!bc->onlyTree)
     gtk_widget_show_all(window);
-  
+
   /* If the BELVU_FONT_SIZE environment variable is set, we'll use it to set the
    * default font size for all the widgets. */
   const gchar *env = g_getenv(FONT_SIZE_ENV_VAR);
-  
+
   if (env)
     {
       if (bc->belvuWindow)
@@ -4109,7 +4110,7 @@ gboolean createBelvuWindow(BelvuContext *bc, BlxMessageData *msgData)
   if (env)
     {
       const int height = convertStringToInt(env);
-      
+
       /* If too small, hide the statusbar */
       if (height < MIN_FONT_SIZE)
         gtk_widget_hide_all(statusBar);
@@ -4118,7 +4119,7 @@ gboolean createBelvuWindow(BelvuContext *bc, BlxMessageData *msgData)
     }
 
   /* Make sure the alignment font size isup to date. Note: do this before
-   * creating the tree, because the tree flushes all pending gtk calls and 
+   * creating the tree, because the tree flushes all pending gtk calls and
    * we must update the font size before the alignment is realised. */
   onBelvuAlignmentFontSizeChanged(bc->belvuAlignment);
 
@@ -4128,24 +4129,24 @@ gboolean createBelvuWindow(BelvuContext *bc, BlxMessageData *msgData)
       createAndShowBelvuTree(bc, TRUE);
       onBelvuTreeFontSizeChanged(bc->belvuTree);
     }
-  
+
   if (!bc->onlyTree)
     {
       gtk_window_present(GTK_WINDOW(window));
-      
+
       if (bc->sortType)
         setRadioMenuStatus(actionGroup, "unsorted", bc->sortType);
-      
+
       setToggleMenuStatus(actionGroup, "displayColors", bc->displayColors);
 
       if (bc->schemeType == BELVU_SCHEME_TYPE_RESIDUE)
         setRadioMenuStatus(actionGroup, "colorSchemeStandard", bc->residueScheme);
       else
         setRadioMenuStatus(actionGroup, "colorSchemeStandard", bc->consScheme);
-      
+
       if (bc->initTree)
         belvuAlignmentRedrawAll(bc->belvuAlignment); /* redraw, because tree creation removes markup which can mess this up */
     }
-  
+
   return ok;
 }
diff --git a/src/belvuApp/belvuWindow.hpp b/src/belvuApp/belvuWindow.hpp
index 4b07bd0cc4f4e6d381e611b3c84c4319d0ea81a2..e7b591484b09756e290bdcaf7d91dde077994822 100644
--- a/src/belvuApp/belvuWindow.hpp
+++ b/src/belvuApp/belvuWindow.hpp
@@ -1,5 +1,6 @@
 /*  File: belvuWindow.h
  *  Author: Gemma Barson, 2011-04-11
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
diff --git a/src/belvuApp/belvu_.hpp b/src/belvuApp/belvu_.hpp
index 1abf2101c793b2e1e13f28cfa30fc96e8aa36ba8..0e2875b4d64a0a5d29dcfb136e058f54da20b289 100644
--- a/src/belvuApp/belvu_.hpp
+++ b/src/belvuApp/belvu_.hpp
@@ -1,5 +1,6 @@
 /*  File: belvu_.h
  *  Author: Gemma Barson, 2011-03-06
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -98,7 +99,7 @@
 
 
 /* List of color ids. Must be kept in sync with colorNames in belvu.c */
-enum Colour    
+enum Colour
 {
   WHITE, BLACK, LIGHTGRAY, DARKGRAY,
   RED, GREEN, BLUE,
@@ -130,9 +131,9 @@ typedef enum _BelvuFileFormat
   BELVU_FILE_MSF,		/* MSF file format */
   BELVU_FILE_ALIGNED_FASTA,	/* Aligned FASTA file format */
   BELVU_FILE_UNALIGNED_FASTA,	/* Unaligned FASTA file format */
-  
+
   BELVU_NUM_FILE_FORMATS	/* must be last in list */
-} BelvuFileFormat;  
+} BelvuFileFormat;
 
 
 /* Tree picking methods */
@@ -159,21 +160,21 @@ typedef enum _BelvuDistCorr
   STORMSONN,
   SCOREDIST,
   JUKESCANTOR
-} BelvuDistCorr; 
+} BelvuDistCorr;
 
 
 /* The following are used to define default colors for certain types of features in Belvu.
- * One of several different actual colors from the BlxColor struct may be used depending 
- * on state, e.g. we use a different color if "print colors" (i.e. black and 
+ * One of several different actual colors from the BlxColor struct may be used depending
+ * on state, e.g. we use a different color if "print colors" (i.e. black and
  * white mode) is on. */
 typedef enum _BelvuColorId
   {
     BELCOLOR_MIN,                             /* dummy value so that we don't get a zero ID */
-    
+
     BELCOLOR_BACKGROUND,                      /* default background color for general widgets */
     BELCOLOR_ALIGN_TEXT,                      /* text color for alignments */
     BELCOLOR_COLUMN_HIGHLIGHT,                /* highlight colour for the currently-selected column */
-    
+
     BELCOLOR_TREE_BACKGROUND,                 /* background color for trees */
     BELCOLOR_TREE_LINE,                       /* default line color for the tree */
     BELCOLOR_TREE_TEXT,                       /* default text color for the tree */
@@ -190,7 +191,7 @@ typedef enum _BelvuColorId
 typedef enum _BelvuSortType
   {
     BELVU_UNSORTED,	       /* Not sorted */
-  
+
     BELVU_SORT_SCORE,          /* Sort by score */
     BELVU_SORT_ALPHA,          /* Sort alphabetically */
     BELVU_SORT_ORGANISM,       /* Sort by organism */
@@ -218,9 +219,9 @@ typedef enum _BelvuColorSchemes
     BELVU_SCHEME_CGP,               /* Cys/Gly/Pro */
     BELVU_SCHEME_CGPH,              /* Cys/Gly/Pro/His */
     BELVU_SCHEME_CUSTOM,            /* Custom color scheme (this is activated after colors have been edited) */
-    
+
     NUM_RESIDUE_SCHEMES,            /* this allows us to identify whether a scheme is a color-by-residue or -by-conservation mode scheme */
-    
+
     BELVU_SCHEME_BLOSUM,            /* Average similarity by BLOSUM62 */
     BELVU_SCHEME_ID,                /* Percent identity */
     BELVU_SCHEME_ID_BLOSUM          /* Percent ID and BLOSUM62 */
@@ -255,7 +256,7 @@ typedef struct alnStruct {
 } ALN;
 
 
-typedef struct _TreeNode 
+typedef struct _TreeNode
 {
   double dist;			/* Absolute distance position */
   double branchlen;		/* Length of branch to higher node */
@@ -279,7 +280,7 @@ typedef struct _Tree
 
 /* Struct to store bootstrap group */
 typedef struct BootstrapGroupStruct
-{   
+{
   TreeNode *node;    /* Points to node in original tree (for incrementing) */
   char *s;           /* Sorted concatenation of all sequences in node, to be inserted in list */
 } BootstrapGroup;
@@ -301,7 +302,7 @@ typedef struct SegStruct
 typedef enum
   {
     BELDIALOG_NOT_PERSISTENT = 0,   /* Reserved for dialogs that do not have an entry in the array */
-    
+
     BELDIALOG_MAKE_TREE,            /* The make-tree dialog */
     BELDIALOG_EDIT_RESIDUE_COLORS,  /* The edit-residue-colors dialog */
     BELDIALOG_EDIT_CONS_COLORS,     /* The edit-conservation-colors dialog */
@@ -325,7 +326,7 @@ typedef struct BelvuContextStruct
   GdkCursor *removeSeqsCursor;     /* cursor to use when removing sequences */
 
   GArray *defaultColors;           /* Default colors used by Belvu */
-  
+
   GArray *alignArr;
   GArray *organismArr;
   GArray *markupAlignArr;
@@ -367,18 +368,18 @@ typedef struct BelvuContextStruct
   int maxbgPrintColor;
   int midbgPrintColor;
   int lowbgPrintColor;
-  
+
   BelvuSchemeType schemeType;	      /* Current colour scheme mode (color-by-residue or -by-conservation) */
   BelvuColorScheme residueScheme;     /* Which color-by-residue color scheme is selected */
   BelvuColorScheme consScheme;	      /* Which color-by-conservation color scheme is selected */
-  
+
   BelvuBuildMethod treeMethod;        /* Default building method for trees */
   BelvuDistCorr treeDistCorr;         /* Default distance correction method for trees */
   BelvuPickMode treePickMode;         /* Default action when picking a node in a tree */
-  
+
   BelvuSortType sortType;             /* What data to sort the alignments by */
   BelvuFileFormat saveFormat;	      /* Which file format to use for saving alignments */
-  
+
   double treeBestBalance;
   double treeBestBalance_subtrees;
   double tree_y;
@@ -389,10 +390,10 @@ typedef struct BelvuContextStruct
   double midSimCutoff;                /* %id cutoff for medium colour */
   double maxSimCutoff;                /* %id cutoff for maximum colour */
   double colorByResIdCutoff;          /* Cutoff when only coloring residues above a given %ID */
-  double mksubfamilies_cutoff; 
+  double mksubfamilies_cutoff;
   double treeScale;                   /* Default scale to use for drawing the tree */
   double treeLineWidth;               /* Default line width of the branch lines in trees */
-  
+
   char gapChar;
   char saveSeparator;
   char treeDistString[50];
@@ -401,14 +402,14 @@ typedef struct BelvuContextStruct
   char *fileName;		   /* Default file name for file browser */
   char *dirName;		   /* Default directory for file browser */
   char organismLabel[3];
-  
+
   int **conservCount;              /* Matrix of conservation values (1st index is amino acid code; 2nd index is column index; value is the number of that residue in that column) - 21 x maxLen */
   int **colorMap;                  /* Matrix of conservation colours - 21 x maxLen */
   int *conservResidues;            /* Array of number of residues present in each column */
   double *conservation;            /* The max conservation in each column [0..maxLen] */
 
   GSList *annotationList;	   /* List of annotation lines from the input file */
-  
+
   gboolean treeCoordsOn;
   gboolean treeReadDistancesOn;
   gboolean treePrintDistances;
@@ -418,7 +419,7 @@ typedef struct BelvuContextStruct
   gboolean displayScores;
   gboolean outputBootstrapTrees;   /* Output the individual bootstrap trees */
   gboolean treebootstrapsDisplay;  /* Display bootstrap trees on screen */
-  gboolean treeColorsOn;           
+  gboolean treeColorsOn;
   gboolean treeShowOrganism;       /* whether to display the organism name in the tree */
   gboolean treeShowBranchlen;      /* whether to display the branch length in the tree */
   gboolean matchFooter;
@@ -441,7 +442,7 @@ typedef struct BelvuContextStruct
   gboolean abbrevTitle;            /* Abbreviate window title prefixes */
 
   GtkWidget *dialogList[BELDIALOG_NUM_DIALOGS];   /* Array of all the persistent dialogs in the application */
-  
+
 } BelvuContext;
 
 
@@ -452,7 +453,7 @@ const char*                               belvuGetCopyrightString(void);
 const char*                               belvuGetWebSiteString(void);
 const char*                               belvuGetCommentsString(void);
 const char*                               belvuGetLicenseString(void);
-const char*                               belvuGetVersionString(void);       
+const char*                               belvuGetVersionString(void);
 
 BelvuContext*                             createBelvuContext();
 void                                      destroyBelvuContext(BelvuContext **bc);
@@ -483,14 +484,14 @@ void                                      setOrganismColors(GArray *organismArr)
 
 void                                      parseMulLine(BelvuContext *bc, char *line, ALN *aln);
 
-void                                      readMatch(BelvuContext *bc, FILE *fil);                
+void                                      readMatch(BelvuContext *bc, FILE *fil);
 void                                      checkAlignment(BelvuContext *bc);
 void                                      setConsSchemeColors(BelvuContext *bc);
 void					  updateSchemeColors(BelvuContext *bc);
 void                                      saveCustomColors(BelvuContext *bc);
 void                                      initResidueColors(BelvuContext *bc);
-void                                      initMarkupColors(void);              
-void                                      initCustomColors(void);              
+void                                      initMarkupColors(void);
+void                                      initCustomColors(void);
 gboolean				  colorByConservation(BelvuContext *bc);
 gboolean				  colorByResidue(BelvuContext *bc);
 gboolean				  colorBySimilarity(BelvuContext *bc);
@@ -504,7 +505,7 @@ void                                      setExcludeFromConsCalc(BelvuContext *b
 void                                      readLabels(BelvuContext *bc, FILE *fil);
 
 void                                      mkNonRedundant(BelvuContext *bc, double cutoff);
-void                                      rmPartialSeqs(BelvuContext *bc);         
+void                                      rmPartialSeqs(BelvuContext *bc);
 void                                      rmEmptyColumns(BelvuContext *bc, double cutoff);
 void                                      rmGappySeqs(BelvuContext *bc, double cutoff);
 void                                      rmFinaliseGapRemoval(BelvuContext *bc);
@@ -524,11 +525,11 @@ void                                      reInsertMarkupLines(BelvuContext *bc);
 Tree*                                     treeMake(BelvuContext *bc, const gboolean doBootstrap, const gboolean displayFeedback);
 
 void                                      outputProbs(BelvuContext *bc, FILE *fil);
-void                                      mksubfamilies(BelvuContext *bc, double cutoff);        
+void                                      mksubfamilies(BelvuContext *bc, double cutoff);
 
-void                                      treeDisplay(BelvuContext *bc);       
+void                                      treeDisplay(BelvuContext *bc);
 
-void                                      colorSim(BelvuContext *bc);          
+void                                      colorSim(BelvuContext *bc);
 
 char                                      b2aIndex(const int idx);
 int                                       getMarkupColor(const char inputChar);
diff --git a/src/blixemApp/bigpicture.cpp b/src/blixemApp/bigpicture.cpp
index 0e7be2ce99ff92f026327c82aa762303b81ab5cf..4137f574174c9ba8aca1e8584dde818df1c9c799 100644
--- a/src/blixemApp/bigpicture.cpp
+++ b/src/blixemApp/bigpicture.cpp
@@ -1,5 +1,6 @@
 /*  File: bigpicture.c
  *  Author: Gemma Barson, 2009-11-23
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -81,14 +82,14 @@ static void                         drawBigPictureGridHeader(GtkWidget *header,
 void bigPictureRedrawAll(GtkWidget *bigPicture)
 {
   BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
-  
+
   widgetClearCachedDrawable(properties->header, NULL);
   widgetClearCachedDrawable(properties->fwdStrandGrid, NULL);
   widgetClearCachedDrawable(properties->revStrandGrid, NULL);
   widgetClearCachedDrawable(properties->fwdExonView, NULL);
   widgetClearCachedDrawable(properties->revExonView, NULL);
   properties->coverageViewProperties()->redraw();
-  
+
   gtk_widget_queue_draw(bigPicture);
 }
 
@@ -113,12 +114,12 @@ void calculateBigPictureCellSize(GtkWidget *bigPicture, BigPictureProperties *pr
   BlxContext *bc = blxWindowGetContext(properties->blxWindow());
   GtkWidget *header = properties->header;
   GridHeaderProperties *headerProperties = gridHeaderGetProperties(header);
-  
+
   /* Calculate the number of bases per cell and round it to a "nice" value from our stored list */
   const int displayStart = convertDisplayIdxToDnaIdx(properties->displayRange.min(), bc->seqType, 1, 1, bc->numFrames, bc->displayRev, &bc->refSeqRange);
   const int displayEnd = convertDisplayIdxToDnaIdx(properties->displayRange.max(), bc->seqType, 1, 1, bc->numFrames, bc->displayRev, &bc->refSeqRange);
   const int displayWidth = abs(displayEnd - displayStart); /* use abs because can be negative if display reversed */
-  
+
   const int defaultBasesPerCell = ceil((double)(displayWidth) / DEFAULT_GRID_NUM_HOZ_CELLS);
   properties->basesPerCell = roundToValueFromList(defaultBasesPerCell, properties->roundValues, &properties->roundTo);
 
@@ -126,35 +127,35 @@ void calculateBigPictureCellSize(GtkWidget *bigPicture, BigPictureProperties *pr
   const double defaultCellWidth = (double)(headerProperties->headerRect.width) / DEFAULT_GRID_NUM_HOZ_CELLS;
   const double actualCellWidth = (defaultCellWidth * properties->basesPerCell) / defaultBasesPerCell;
   properties->numHCells = ceil((double)headerProperties->headerRect.width / actualCellWidth);
-  
+
   DEBUG_EXIT("calculateBigPictureCellSize returning");
 }
 
 
-/* Utility to convert the given decimal number (percent) to text 
+/* Utility to convert the given decimal number (percent) to text
  * returned in 'text'). showDecimal indicates whether it should be
- * shown as a decimal or not. If abbrev is true, 1000 is abbreviated 
+ * shown as a decimal or not. If abbrev is true, 1000 is abbreviated
  * as 1k etc. 'unit' is a string displayed after the text and can be
  * an empty string. */
-static void drawNumericLabel(char *text, 
+static void drawNumericLabel(char *text,
                              const gdouble percent,
-                             const gboolean showDecimal, 
-                             const gboolean abbrev, 
+                             const gboolean showDecimal,
+                             const gboolean abbrev,
                              const char *unit)
 {
   if (!text)
     {
       return;
     }
-  
+
   if (showDecimal)
     {
       sprintf(text, "%1.1f%s", percent, unit);
     }
-  else 
+  else
     {
       sprintf(text, "%d%s", (int)percent, unit);
-    
+
       if (abbrev)
         {
           /* Abbreviate the number so 1000 becomes 1k, 1000000 becomes 1M etc. */
@@ -177,7 +178,7 @@ static void drawNumericLabel(char *text,
                   case 24: suffix = 'Y'; break;
                   default: break;
                 };
-  
+
               if (suffix && text[len-i]=='0' && text[len-i+1]=='0' && text[len-i+2]=='0')
                 {
                   text[len-i] = suffix;
@@ -189,28 +190,28 @@ static void drawNumericLabel(char *text,
 }
 
 
-static void drawVerticalGridLineHeaders(GtkWidget *header, 
-					GtkWidget *bigPicture, 
+static void drawVerticalGridLineHeaders(GtkWidget *header,
+					GtkWidget *bigPicture,
                                         GdkDrawable *drawable,
-					GdkGC *gc, 
-					const GdkColor* const textColor, 
+					GdkGC *gc,
+					const GdkColor* const textColor,
 					const GdkColor* const lineColor,
                                         const gboolean abbrev)
 {
   BlxContext *bc = bigPictureGetContext(bigPicture);
   GridHeaderProperties *headerProperties = gridHeaderGetProperties(header);
   BigPictureProperties *bpProperties = bigPictureGetProperties(bigPicture);
-  
+
   /* Get the display range in dna coords */
   IntRange dnaDispRange;
   convertDisplayRangeToDnaRange(&bpProperties->displayRange, bc->seqType, bc->numFrames, bc->displayRev, &bc->refSeqRange, &dnaDispRange);
 
   const int direction = bc->displayRev ? -1 : 1; /* to subtract instead of add when display reversed */
-  
-  /* Get the first base index and round it to a nice round number. We'll offset all of the gridlines 
+
+  /* Get the first base index and round it to a nice round number. We'll offset all of the gridlines
    * by the distance between this and the real start coord. */
   const int firstBaseIdx = roundToValue(bc->displayRev ? dnaDispRange.max() : dnaDispRange.min(), bpProperties->roundTo);
-  
+
   /* Calculate the top and bottom heights for the lines. */
   const gint bottomBorder = headerProperties->headerRect.y + headerProperties->headerRect.height;
   const gint topBorder = bottomBorder - headerProperties->markerHeight;
@@ -227,13 +228,13 @@ static void drawVerticalGridLineHeaders(GtkWidget *header,
       int baseIdx = firstBaseIdx + (numBasesFromLeft * direction);
 
       const int x = convertBaseIdxToRectPos(baseIdx, &headerProperties->headerRect, &dnaDispRange, TRUE, bc->displayRev, TRUE);
-      
+
       if (x > minX && x < maxX)
 	{
           /* If we're displaying negative coords, negate the base index */
           if (bc->displayRev && bc->flags[BLXFLAG_NEGATE_COORDS])
             baseIdx *= -1;
-            
+
 	  gdk_gc_set_foreground(gc, textColor);
 	  gchar text[numDigitsInInt(baseIdx) + 1];
           drawNumericLabel(text, baseIdx, FALSE, abbrev, "");
@@ -241,7 +242,7 @@ static void drawVerticalGridLineHeaders(GtkWidget *header,
 	  PangoLayout *layout = gtk_widget_create_pango_layout(header, text);
 	  gdk_draw_layout(drawable, gc, x, 0, layout);
 	  g_object_unref(layout);
-	  
+
 	  /* Draw a marker line (small cosmetic touch to better join the label to the grid below) */
 	  gdk_gc_set_foreground(gc, lineColor);
 	  gdk_draw_line (drawable, gc, x, topBorder, x, bottomBorder);
@@ -262,30 +263,30 @@ void drawVerticalGridLines(GdkRectangle *drawingRect,
   /* Get the display range in dna coords */
   IntRange dnaDispRange;
   convertDisplayRangeToDnaRange(&bpProperties->displayRange, bc->seqType, bc->numFrames, bc->displayRev, &bc->refSeqRange, &dnaDispRange);
-  
+
   const int direction = bc->displayRev ? -1 : 1; /* to subtract instead of add when display reversed */
-  
+
   /* Get the first base index (in terms of the nucleotide coords) and round it to a nice round
    * number. We'll offset all of the gridlines by the distance between this and the real start coord. */
   const int realFirstBaseIdx = convertDisplayIdxToDnaIdx(bpProperties->displayRange.min(), bc->seqType, 1, 1, bc->numFrames, bc->displayRev, &bc->refSeqRange);
   const int firstBaseIdx = roundToValue(realFirstBaseIdx, bpProperties->roundTo);
-  
+
   /* Calculate the top and bottom heights for the lines. */
   const gint topBorder = highlightRect->y - yPadding;
   const gint bottomBorder = drawingRect->y + drawingRect->height;
-  
+
   const int minX = drawingRect->x;
   const int maxX = drawingRect->x + drawingRect->width;
-  
+
   gint hCell = 0;
   for ( ; hCell <= bpProperties->numHCells; ++hCell)
     {
       /* Get the base index for this grid line and calc its x coord */
       int numBasesFromLeft = bpProperties->basesPerCell * hCell;
       int baseIdx = firstBaseIdx + (numBasesFromLeft * direction);
-      
+
       const int x = convertBaseIdxToRectPos(baseIdx, drawingRect, &dnaDispRange, TRUE, bc->displayRev, TRUE);
-      
+
       if (x > minX && x < maxX)
 	{
 	  GdkGC *gc = gdk_gc_new(drawable);
@@ -293,7 +294,7 @@ void drawVerticalGridLines(GdkRectangle *drawingRect,
 	  GdkColor *lineColor = getGdkColor(BLXCOLOR_GRID_LINE, bc->defaultColors, FALSE, bc->usePrintColors);
 	  gdk_gc_set_foreground(gc, lineColor);
 	  gdk_draw_line (drawable, gc, x, topBorder, x, bottomBorder);
-          
+
           g_object_unref(gc);
 	}
     }
@@ -316,50 +317,50 @@ void drawHorizontalGridLines(GtkWidget *widget,
 			     BlxContext *bc,
 			     BigPictureProperties *bpProperties,
 			     GdkDrawable *drawable,
-			     const gint numCells, 
-			     const gdouble rangePerCell, 
+			     const gint numCells,
+			     const gdouble rangePerCell,
 			     const gdouble maxVal,
                              const gboolean abbrev,
 			     const char *unit)
 {
   const gint rightBorder = drawingRect->x + drawingRect->width;
-  
+
   GdkColor *textColor = getGdkColor( BLXCOLOR_GRID_TEXT, bc->defaultColors, FALSE, bc->usePrintColors);
   GdkGC *textGc = gdk_gc_new(drawable);
   gdk_gc_set_foreground(textGc, textColor);
-  
+
   GdkColor *lineColor = getGdkColor(BLXCOLOR_GRID_LINE, bc->defaultColors, FALSE, bc->usePrintColors);
   GdkGC *lineGc = gdk_gc_new(drawable);
   gdk_gc_set_foreground(lineGc, lineColor);
-  
+
   /* Show decimal places if the range per cell is a fraction of a percent */
   const gboolean showDecimal = (rangePerCell < 1.0);
   const int cellHeight = bigPictureGetCellHeight(bigPicture);
-  
+
   gint vCell = 0;
   for ( ; vCell <= numCells; ++vCell)
     {
       gint y = drawingRect->y + (gint)((gdouble)vCell * cellHeight);
       gint x = drawingRect->x - DEFAULT_LABEL_X_PADDING;
-      
+
       /* Label this gridline with the %ID */
       gdouble percent = maxVal - (rangePerCell * vCell);
       char text[bpProperties->leftBorderChars + 3]; /* +3 to include decimal point, 1dp, and terminating nul */
 
       drawNumericLabel(text, percent, showDecimal, abbrev, unit);
-      
+
       PangoLayout *layout = gtk_widget_create_pango_layout(widget, text);
-      
+
       int width = UNSET_INT;
       pango_layout_get_pixel_size(layout, &width, NULL);
 
       gdk_draw_layout(drawable, textGc, x - width, y - cellHeight/2, layout);
       g_object_unref(layout);
-      
+
       /* Draw the gridline */
       gdk_draw_line (drawable, lineGc, drawingRect->x, y, rightBorder, y);
     }
-  
+
   g_object_unref(lineGc);
   g_object_unref(textGc);
 }
@@ -380,7 +381,7 @@ static void redrawBigPictureGridHeader(GtkWidget *header)
 
       /* Clear the bitmap to the background color */
       GdkGC *gc = gdk_gc_new(bitmap);
-      
+
       GtkStyle *style = gtk_widget_get_style(header);
       GdkColor *bgColor = &style->bg[GTK_STATE_NORMAL];
       gdk_gc_set_foreground(gc, bgColor);
@@ -388,7 +389,7 @@ static void redrawBigPictureGridHeader(GtkWidget *header)
 
       /* Draw the header */
       drawBigPictureGridHeader(header, bitmap, gc);
-      
+
       g_object_unref(gc);
     }
 }
@@ -400,25 +401,25 @@ static void drawBigPictureGridHeader(GtkWidget *header, GdkDrawable *drawable, G
 {
   GridHeaderProperties *properties = gridHeaderGetProperties(header);
   BlxContext *bc = bigPictureGetContext(properties->bigPicture);
-  
+
   /* Set the drawing properties */
   gdk_gc_set_subwindow(gc, GDK_INCLUDE_INFERIORS);
-  
+
   /* First, highlight any assembly gaps */
   /* Get the display range in dna coords */
   const IntRange* const displayRange = bigPictureGetDisplayRange(properties->bigPicture);
   IntRange bpRange;
   convertDisplayRangeToDnaRange(displayRange, bc->seqType, bc->numFrames, bc->displayRev, &bc->refSeqRange, &bpRange);
-  
+
   GdkColor *gapColor = getGdkColor(BLXCOLOR_ASSEMBLY_GAP, bc->defaultColors, FALSE, bc->usePrintColors);
   drawAssemblyGaps(header, drawable, gapColor, bc->displayRev, &properties->headerRect, &bpRange, bc->featureLists[BLXMSP_GAP]);
-  
+
   /* Draw the grid headers */
-  drawVerticalGridLineHeaders(header, 
-			      properties->bigPicture, 
+  drawVerticalGridLineHeaders(header,
+			      properties->bigPicture,
                               drawable,
 			      gc,
-			      getGdkColor(BLXCOLOR_GRID_TEXT, bc->defaultColors, FALSE, bc->usePrintColors), 
+			      getGdkColor(BLXCOLOR_GRID_TEXT, bc->defaultColors, FALSE, bc->usePrintColors),
 			      getGdkColor(BLXCOLOR_GRID_LINE, bc->defaultColors, FALSE, bc->usePrintColors),
                               FALSE);
 }
@@ -429,17 +430,17 @@ void calculateGridHeaderBorders(GtkWidget *header)
 {
   GridHeaderProperties *properties = gridHeaderGetProperties(header);
   BigPictureProperties *bigPictureProperties = bigPictureGetProperties(properties->bigPicture);
-  
+
   /* Calculate the size of the grid header (zero height if it does not have one) */
   properties->headerRect.x = roundNearest(bigPictureProperties->contentXPos());
   properties->headerRect.y = 0;
   properties->headerRect.width = bigPictureProperties->contentWidth();
   properties->headerRect.height = properties->refButton->allocation.height + (properties->headerYPad * 2);
-  
+
   properties->markerHeight = properties->headerRect.height - roundNearest(bigPictureProperties->charHeight() * (gdouble)properties->numHeaderLines);
   if (properties->markerHeight < 0)
     properties->markerHeight = 0;
-  
+
   gtk_layout_set_size(GTK_LAYOUT(header), header->allocation.width, properties->headerRect.height);
   gtk_widget_set_size_request(header, 0, properties->headerRect.height);
 }
@@ -458,7 +459,7 @@ static void addChildToBigPicture(GtkWidget *container, GtkWidget *child, gboolea
 
 /* This function removes the grids from the big picture and re-adds them in the
  * correct order according to the displayRev flag. It should be called every
- * time the strands are toggled. It assumes the two grids are both already in the 
+ * time the strands are toggled. It assumes the two grids are both already in the
  * bigPicture container, and that the properties have been set for all 3 widgets. */
 void refreshGridOrder(GtkWidget *bigPicture)
 {
@@ -469,14 +470,14 @@ void refreshGridOrder(GtkWidget *bigPicture)
   GtkWidget *fwdExonView = bigPictureGetFwdExonView(bigPicture);
   GtkWidget *revExonView = bigPictureGetRevExonView(bigPicture);
   GtkWidget *coverageView = bpProperties->coverageView();
-  
+
   /* Increase the reference count to make sure the widgets aren't destroyed when we remove them. */
   g_object_ref(fwdStrandGrid);
   g_object_ref(revStrandGrid);
   g_object_ref(fwdExonView);
   g_object_ref(revExonView);
   g_object_ref(coverageView);
-  
+
   /* Find the direct container of the grids etc and remove them */
   GtkWidget *bpContainer = getNamedChildWidget(bigPicture, BIG_PICTURE_WIDGET_NAME);
   gtk_container_remove(GTK_CONTAINER(bpContainer), fwdStrandGrid);
@@ -484,7 +485,7 @@ void refreshGridOrder(GtkWidget *bigPicture)
   gtk_container_remove(GTK_CONTAINER(bpContainer), fwdExonView);
   gtk_container_remove(GTK_CONTAINER(bpContainer), revExonView);
   gtk_container_remove(GTK_CONTAINER(bpContainer), coverageView);
-  
+
   /* Add them back, with the forward-strand grid at the top and the reverse-strand grid
    * at the bottom, or vice versa if the strands are toggled. */
   if (bigPictureGetDisplayRev(bigPicture))
@@ -504,18 +505,18 @@ void refreshGridOrder(GtkWidget *bigPicture)
 
   /* Coverage view is always at the bottom for now because it covers both strands */
   addChildToBigPicture(bpContainer, coverageView, FALSE);
-  
+
   /* Decrease the ref count again */
   g_object_unref(fwdStrandGrid);
   g_object_unref(revStrandGrid);
   g_object_unref(fwdExonView);
   g_object_unref(revExonView);
-  
+
   /* Must show all child widgets because some of them may not have been in this parent before.
    * (Just calling gtk_widget_show on the individual trees doesn't seem to work.)
    * However, we then need to re-hide any that may have been previously hidden by the user. */
   gtk_widget_show_all(bigPicture);
-  gtk_container_foreach(GTK_CONTAINER(bigPicture), hideUserHiddenWidget, NULL);  
+  gtk_container_foreach(GTK_CONTAINER(bigPicture), hideUserHiddenWidget, NULL);
 }
 
 
@@ -525,7 +526,7 @@ static void updateHighlightBox(GtkWidget *bigPicture, BigPictureProperties *prop
 {
   callFuncOnAllBigPictureGrids(bigPicture, (gpointer)calculateGridHighlightBoxBorders);
   callFuncOnAllBigPictureExonViews(bigPicture, (gpointer)calculateExonViewHighlightBoxBorders);
-  
+
   properties->coverageViewProperties()->calculateHighlightBoxBorders();
 }
 
@@ -541,7 +542,7 @@ static void onBigPictureRangeChanged(GtkWidget *bigPicture, BigPictureProperties
   /* We must force a resize, because the size-allocate signal does not
    * get emitted if the exon views have shrunk, only if they have expanded. */
   forceResize(bigPicture);
-      
+
   /* Do a complete redraw */
   bigPictureRedrawAll(bigPicture);
 
@@ -553,9 +554,9 @@ static void onBigPictureRangeChanged(GtkWidget *bigPicture, BigPictureProperties
 /* Set the display range for the big picture, based on the given width (i.e. number of
  * bases wide). Keeps the display centred on the same range that is shown in the detail view.
  * If recalcHighlightBox is true, the highlight box borders are recalculated. */
-static void setBigPictureDisplayRange(GtkWidget *bigPicture, 
-                                      BigPictureProperties *properties, 
-                                      int width, 
+static void setBigPictureDisplayRange(GtkWidget *bigPicture,
+                                      BigPictureProperties *properties,
+                                      int width,
                                       const gboolean keepCentered)
 {
   DEBUG_ENTER("setBigPictureDisplayRange");
@@ -565,10 +566,10 @@ static void setBigPictureDisplayRange(GtkWidget *bigPicture,
 
   IntRange *displayRange = &properties->displayRange;
   IntRange *fullRange = blxWindowGetFullRange(properties->blxWindow());
-  
+
   int detailViewWidth = detailViewRange->max() - detailViewRange->min();
   int maxWidth = fullRange->max() - fullRange->min();
-  
+
   gboolean changedRange = FALSE;
 
   if (width < detailViewWidth)
@@ -594,13 +595,13 @@ static void setBigPictureDisplayRange(GtkWidget *bigPicture,
 
       displayRange->setMin(newcentre - offset);
       displayRange->setMax(displayRange->min() + width); // uses updated min
-      
+
       changedRange = TRUE;
     }
-  
+
   if (!changedRange) /* i.e. not already done */
     {
-      /* See if we need to scroll the big picture range so that it completely 
+      /* See if we need to scroll the big picture range so that it completely
        * contains the detail-view range.
        * NB We use a shorter big picture range so that we never get the highlight
        * box bumped right up against the edge of the big picture; UNLESS the
@@ -612,18 +613,18 @@ static void setBigPictureDisplayRange(GtkWidget *bigPicture,
 
       if (detailViewRange->length() > width - (2 * border))
         border = 0;
-      
+
       int offset = (displayRange->min() + border) - detailViewRange->min();
-      
+
       if (offset > 0)
         {
           displayRange->setMin(displayRange->min() - offset);
           displayRange->setMax(displayRange->min() + width); //uses the updated min
           changedRange = TRUE;
         }
-      
+
       offset = detailViewRange->max() - (displayRange->max() - border);
-      
+
       if (offset > 0)
         {
           displayRange->setMax(displayRange->max() + offset);
@@ -637,7 +638,7 @@ static void setBigPictureDisplayRange(GtkWidget *bigPicture,
       displayRange->boundsLimit(fullRange, TRUE);
       onBigPictureRangeChanged(bigPicture, properties);
     }
-  
+
   updateHighlightBox(bigPicture, properties);
   bigPictureRefreshAll(bigPicture);
 
@@ -645,7 +646,7 @@ static void setBigPictureDisplayRange(GtkWidget *bigPicture,
 }
 
 
-/* This function should be called every time the detail view display range has 
+/* This function should be called every time the detail view display range has
  * changed. It updates the position of the highlight box on the big picture and,
  * if necessary, scrolls to keep the highlight box in range. */
 void refreshBigPictureDisplayRange(GtkWidget *bigPicture, const gboolean keepCentered)
@@ -654,18 +655,18 @@ void refreshBigPictureDisplayRange(GtkWidget *bigPicture, const gboolean keepCen
 
   BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
   properties->refreshDisplayRange(keepCentered);
-  
+
   DEBUG_EXIT("refreshBigPictureDisplayRange returning");
 }
 
 
-/* Given the centre x coord of a rectangle and its width, find the x coord of the 
+/* Given the centre x coord of a rectangle and its width, find the x coord of the
  * right edge. If an outer rectangle is given, limit the coord so that the
  * rectangle lies entirely within the outer rect. */
 int getRightCoordFromCentre(const int centreCoord, const int width, const GdkRectangle *outerRect)
 {
   int rightCoord = centreCoord + roundNearest((double)width / 2.0);
-  
+
   if (outerRect)
     {
       if (rightCoord > outerRect->x + outerRect->width)
@@ -673,14 +674,14 @@ int getRightCoordFromCentre(const int centreCoord, const int width, const GdkRec
       else
 	{
 	  int rightCoordMin = outerRect->x + width;
-	  
-	  if (rightCoord < rightCoordMin) 
+
+	  if (rightCoord < rightCoordMin)
 	    {
 	      rightCoord = rightCoordMin;
 	    }
 	}
     }
-  
+
   return rightCoord;
 }
 
@@ -691,7 +692,7 @@ void zoomBigPicture(GtkWidget *bigPicture, const gboolean zoomIn)
   BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
   IntRange *displayRange = &properties->displayRange;
   int newWidth = UNSET_INT;
-  
+
   if (zoomIn)
     {
       newWidth = roundNearest(((double)(displayRange->max() - displayRange->min())) / 2.0);
@@ -712,7 +713,7 @@ void zoomWholeBigPicture(GtkWidget *bigPicture)
   BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
   IntRange *displayRange = &properties->displayRange;
   IntRange *fullRange = blxWindowGetFullRange(properties->blxWindow());
-  
+
   /* Check we're not already showing the whole range */
   if (displayRange->min() != fullRange->min() || displayRange->max() != fullRange->max())
     {
@@ -727,21 +728,21 @@ void zoomWholeBigPicture(GtkWidget *bigPicture)
 void calculateNumVCells(GtkWidget *bigPicture)
 {
   BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
-  
+
   if (properties->idPerCell == 0.0)
     {
       g_warning("%%ID per cell setting is 0. Cannot calculate number of cells.\n");
       return;
     }
-  
+
   const double idRangeLen = properties->percentIdRange.max - properties->percentIdRange.min;
-  properties->numVCells = ceil(idRangeLen / properties->idPerCell); 
+  properties->numVCells = ceil(idRangeLen / properties->idPerCell);
 
   if (properties->numVCells < MIN_NUM_V_CELLS)
     {
       properties->numVCells = MIN_NUM_V_CELLS;
     }
-  
+
   properties->percentIdRange.min = properties->percentIdRange.max - (properties->numVCells * properties->idPerCell);
 }
 
@@ -753,29 +754,29 @@ static void updateOnPercentIdChanged(GtkWidget *bigPicture)
   if (bigPicture)
     {
       BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
-  
+
       if (properties)
         {
           calculateNumVCells(bigPicture);
-  
+
           callFuncOnAllBigPictureGrids(bigPicture, (gpointer)calculateGridBorders);
           callFuncOnAllBigPictureGrids(bigPicture, (gpointer)calculateGridHighlightBoxBorders);
           properties->coverageViewProperties()->calculateBorders();
-  
+
           bigPictureRedrawAll(bigPicture);
         }
     }
 }
 
 
-/* Prepare the big picture for printing - this draws normally-transient 
+/* Prepare the big picture for printing - this draws normally-transient
  * components onto the cached drawable so that they get included in the print.
- * bigPictureRedrawAll should be called afterwards to remove the transient 
+ * bigPictureRedrawAll should be called afterwards to remove the transient
  * components. */
 void bigPicturePrepareForPrinting(GtkWidget *bigPicture)
 {
   BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
-  
+
   callFuncOnAllBigPictureGrids(bigPicture, (gpointer)gridPrepareForPrinting);
   callFuncOnAllBigPictureExonViews(bigPicture, (gpointer)exonViewPrepareForPrinting);
   properties->coverageViewProperties()->prepareForPrinting();
@@ -810,7 +811,7 @@ static void onZoomWholeBigPicture(GtkButton *button, gpointer data)
 static gboolean onExposeGridHeader(GtkWidget *header, GdkEventExpose *event, gpointer data)
 {
   GdkDrawable *window = GTK_LAYOUT(header)->bin_window;
-  
+
   if (window)
     {
       /* Just push the stored bitmap onto the screen */
@@ -822,7 +823,7 @@ static gboolean onExposeGridHeader(GtkWidget *header, GdkEventExpose *event, gpo
 	  redrawBigPictureGridHeader(header);
 	  bitmap = widgetGetDrawable(header);
         }
-      
+
       if (bitmap)
         {
           GdkGC *gc = gdk_gc_new(window);
@@ -830,7 +831,7 @@ static gboolean onExposeGridHeader(GtkWidget *header, GdkEventExpose *event, gpo
           g_object_unref(gc);
         }
     }
-  
+
   return TRUE;
 }
 
@@ -840,9 +841,9 @@ void scrollBigPictureLeftStep(GtkWidget *bigPicture)
 {
   BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
   BlxContext *bc = bigPictureGetContext(bigPicture);
-  
+
   IntRange *displayRange = &properties->displayRange;
-  
+
   if (displayRange->min() > bc->fullDisplayRange.min())
     {
       /* Check we can scroll the full increment amount. If not, scroll to the end of the full range */
@@ -870,9 +871,9 @@ void scrollBigPictureRightStep(GtkWidget *bigPicture)
 {
   BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
   BlxContext *bc = bigPictureGetContext(bigPicture);
-  
+
   IntRange *displayRange = &properties->displayRange;
-  
+
   /* Check we're not already at the max of the full range. */
   if (displayRange->max() < bc->fullDisplayRange.max())
     {
@@ -903,7 +904,7 @@ static int getBigPictureChildrenHeights(GtkWidget *widget, const int heightIn)
   GList *children = gtk_container_get_children(GTK_CONTAINER(widget));
   GList *child = children;
   int height = heightIn;
-  
+
   for ( ; child; child = child->next)
     {
       GtkWidget *childWidget = GTK_WIDGET(child->data);
@@ -911,8 +912,8 @@ static int getBigPictureChildrenHeights(GtkWidget *widget, const int heightIn)
       if (GTK_WIDGET_VISIBLE(childWidget))
 	{
 	  const gchar *name = gtk_widget_get_name(childWidget);
-      
-	  if (stringsEqual(name, BIG_PICTURE_GRID_NAME, TRUE) || 
+
+	  if (stringsEqual(name, BIG_PICTURE_GRID_NAME, TRUE) ||
 	      stringsEqual(name, BIG_PICTURE_EXON_VIEW_NAME, TRUE) ||
 	      stringsEqual(name, BIG_PICTURE_GRID_HEADER_NAME, TRUE))
 	    {
@@ -926,7 +927,7 @@ static int getBigPictureChildrenHeights(GtkWidget *widget, const int heightIn)
     }
 
   g_list_free(children);
-    
+
   return height;
 }
 
@@ -935,7 +936,7 @@ static int getBigPictureChildrenHeights(GtkWidget *widget, const int heightIn)
  * but don't go greater than the maximum. This is called when the exon view or grids change size
  * etc. to make sure we only use as much space as necessary. Note that because the big picture
  * is in a paned window this does not have an effect if the user has changed (i.e. specifically
- * set) the pane size, which makes sense but it would be nice to have some way to be able to 
+ * set) the pane size, which makes sense but it would be nice to have some way to be able to
  * revert to the original behaviour */
 static void bigPictureRecalculateSize(GtkWidget *bigPicture)
 {
@@ -946,10 +947,10 @@ static void bigPictureRecalculateSize(GtkWidget *bigPicture)
 
   GtkWidget *blxWindow = bigPictureGetBlxWindow(bigPicture);
   int maxHeight = blxWindow->allocation.height * MAX_BIG_PICTURE_HEIGHT_RATIO;
-  
+
   height = min(height, maxHeight);
   gtk_widget_set_size_request(bigPicture, -1, height);
-  
+
   DEBUG_EXIT("bigPictureRecalculateSize returning");
 }
 
@@ -960,12 +961,12 @@ static void onSizeAllocateBigPicture(GtkWidget *bigPicture, GtkAllocation *alloc
   DEBUG_ENTER("onSizeAllocateBigPicture");
 
   /* Recalculate the widget size based on its child widget sizes. Note that we
-   * don't need to do anything else here because onScrollPosChanged will be 
+   * don't need to do anything else here because onScrollPosChanged will be
    * called, which does all the updating of the big picture range. */
   bigPictureRecalculateSize(bigPicture);
-  
+
   bigPictureRedrawAll(bigPicture);
-  
+
   DEBUG_EXIT("onSizeAllocateBigPicture returning");
 }
 
@@ -974,11 +975,11 @@ static void onSizeAllocateBigPicture(GtkWidget *bigPicture, GtkAllocation *alloc
  *                 Class member functions                  *
  ***********************************************************/
 
-BigPictureProperties::BigPictureProperties(GtkWidget *bigPicture_in, 
-                                           GtkWidget *blxWindow_in, 
+BigPictureProperties::BigPictureProperties(GtkWidget *bigPicture_in,
+                                           GtkWidget *blxWindow_in,
                                            BlxContext *bc_in,
-                                           CoverageViewProperties *coverageViewP_in, 
-                                           GtkWidget *header_in, 
+                                           CoverageViewProperties *coverageViewP_in,
+                                           GtkWidget *header_in,
                                            GtkWidget *fwdStrandGrid_in,
                                            GtkWidget *revStrandGrid_in,
                                            GtkWidget *fwdExonView_in,
@@ -999,7 +1000,7 @@ BigPictureProperties::BigPictureProperties(GtkWidget *bigPicture_in,
   numHCells = UNSET_INT;
   basesPerCell = UNSET_INT;
   roundTo = 25;
-      
+
   numVCells = UNSET_INT;
   idPerCell = DEFAULT_PERCENT_ID_PER_CELL;
   percentIdRange.min = lowestId_in;
@@ -1008,12 +1009,12 @@ BigPictureProperties::BigPictureProperties(GtkWidget *bigPicture_in,
   leftBorderChars = numDigitsInInt(DEFAULT_GRID_PERCENT_ID_MAX) + 2; /* Extra fudge factor because
                                                                         char width is approx */
   initialZoom = initialZoom_in;
-      
+
   if (initRange_in->isSet())
     displayRange.set(initRange_in);
   else
     displayRange.set(fullRange_in);
-      
+
   /* Create the list of "nice round values" to round the grid header values to.
    * Create the list in reverse order (i.e. highest values first). */
   roundValues = NULL;
@@ -1058,7 +1059,7 @@ double BigPictureProperties::contentWidth() const
 }
 
 
-/* Return the range that should be highlighted by the highlight box, i.e. the 
+/* Return the range that should be highlighted by the highlight box, i.e. the
  * detail-view range */
 const IntRange *BigPictureProperties::highlightRange() const
 {
@@ -1075,10 +1076,10 @@ const IntRange *BigPictureProperties::highlightRange() const
 void BigPictureProperties::refreshDisplayRange(const bool keepCentered)
 {
   IntRange *bpRange = &displayRange;
-  
+
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow());
   IntRange *dvRange = detailViewGetDisplayRange(detailView);
-  
+
   if (!bpRange->isSet())
     {
       /* This is the first time we've refreshed the detail view range. Set the
@@ -1113,10 +1114,10 @@ BigPictureProperties* bigPictureGetProperties(GtkWidget *bigPicture)
 {
   /* optimisation: cache result, because we know there is only ever one big picture */
   static BigPictureProperties *properties = NULL;
-  
+
   if (!properties && bigPicture)
     properties = (BigPictureProperties*)(g_object_get_data(G_OBJECT(bigPicture), "BigPictureProperties"));
-  
+
   return properties;
 }
 
@@ -1130,10 +1131,10 @@ static GridHeaderProperties* gridHeaderGetProperties(GtkWidget *gridHeader)
 {
   /* optimisation: cache result, because we know there is only ever one grid header */
   static GridHeaderProperties *properties = NULL;
-  
+
   if (!properties && gridHeader)
     properties = (GridHeaderProperties*)(g_object_get_data(G_OBJECT(gridHeader), "GridHeaderProperties"));
-  
+
   return properties;
 }
 
@@ -1141,7 +1142,7 @@ static GridHeaderProperties* gridHeaderGetProperties(GtkWidget *gridHeader)
 static void onDestroyBigPicture(GtkWidget *bigPicture)
 {
   BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
-  
+
   if (properties)
     {
       delete properties;
@@ -1150,11 +1151,11 @@ static void onDestroyBigPicture(GtkWidget *bigPicture)
 }
 
 
-static BigPictureProperties* bigPictureCreateProperties(GtkWidget *bigPicture, 
-                                                        GtkWidget *blxWindow, 
+static BigPictureProperties* bigPictureCreateProperties(GtkWidget *bigPicture,
+                                                        GtkWidget *blxWindow,
                                                         BlxContext *bc,
-                                                        CoverageViewProperties *coverageViewP, 
-                                                        GtkWidget *header, 
+                                                        CoverageViewProperties *coverageViewP,
+                                                        GtkWidget *header,
                                                         GtkWidget *fwdStrandGrid,
                                                         GtkWidget *revStrandGrid,
                                                         GtkWidget *fwdExonView,
@@ -1168,12 +1169,12 @@ static BigPictureProperties* bigPictureCreateProperties(GtkWidget *bigPicture,
   BigPictureProperties *properties = NULL;
 
   if (bigPicture)
-    { 
-      properties = new BigPictureProperties(bigPicture, 
-                                            blxWindow, 
+    {
+      properties = new BigPictureProperties(bigPicture,
+                                            blxWindow,
                                             bc,
-                                            coverageViewP, 
-                                            header, 
+                                            coverageViewP,
+                                            header,
                                             fwdStrandGrid,
                                             revStrandGrid,
                                             fwdExonView,
@@ -1183,9 +1184,9 @@ static BigPictureProperties* bigPictureCreateProperties(GtkWidget *bigPicture,
                                             fullRange,
                                             initialZoom,
                                             lowestId);
-      
+
       g_object_set_data(G_OBJECT(bigPicture), "BigPictureProperties", properties);
-      g_signal_connect(G_OBJECT(bigPicture), "destroy", G_CALLBACK(onDestroyBigPicture), NULL); 
+      g_signal_connect(G_OBJECT(bigPicture), "destroy", G_CALLBACK(onDestroyBigPicture), NULL);
     }
 
   return properties;
@@ -1195,7 +1196,7 @@ static BigPictureProperties* bigPictureCreateProperties(GtkWidget *bigPicture,
 static void onDestroyGridHeader(GtkWidget *bigPicture)
 {
   GridHeaderProperties *properties = gridHeaderGetProperties(bigPicture);
-  
+
   if (properties)
     {
       delete properties;
@@ -1215,7 +1216,7 @@ static void gridHeaderCreateProperties(GtkWidget *gridHeader, GtkWidget *bigPict
       properties->refButton = refButton;
       properties->numHeaderLines = DEFAULT_GRID_NUM_HEADER_LINES;
       properties->headerYPad = DEFAULT_GRID_HEADER_Y_PAD;
-      
+
       g_object_set_data(G_OBJECT(gridHeader), "GridHeaderProperties", properties);
       g_signal_connect(G_OBJECT(gridHeader), "destroy", G_CALLBACK(onDestroyGridHeader), NULL);
     }
@@ -1333,7 +1334,7 @@ gboolean bigPictureSetIdPerCell(GtkWidget *bigPicture, const gdouble idPerCell)
 {
   gboolean result = FALSE;
   BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
-  
+
   if (idPerCell < GRID_SCALE_MIN_ID_PER_CELL)
     {
       g_critical("Cannot set ID per cell less than %1.1f.\n", GRID_SCALE_MIN_ID_PER_CELL);
@@ -1344,7 +1345,7 @@ gboolean bigPictureSetIdPerCell(GtkWidget *bigPicture, const gdouble idPerCell)
       updateOnPercentIdChanged(bigPicture);
       result = TRUE;
     }
-  
+
   return result;
 }
 
@@ -1364,7 +1365,7 @@ gboolean bigPictureSetMaxPercentId(GtkWidget *bigPicture, const gdouble newValue
 {
   gboolean result = FALSE;
   BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
-  
+
   if (newValue < GRID_SCALE_MIN)
     {
       g_critical("Cannot set grid scale less than %d.\n", GRID_SCALE_MIN);
@@ -1383,18 +1384,18 @@ gboolean bigPictureSetMaxPercentId(GtkWidget *bigPicture, const gdouble newValue
       updateOnPercentIdChanged(bigPicture);
       result = TRUE;
     }
-  
+
   return result;
 }
 
 gboolean bigPictureSetMinPercentId(GtkWidget *bigPicture, const gdouble newValue)
 {
   gboolean result = FALSE;
-  
+
   if (bigPicture && newValue != -1) /* -1 means unset */
     {
       BigPictureProperties *properties = bigPictureGetProperties(bigPicture);
-      
+
       if (properties)
         {
           if (newValue < GRID_SCALE_MIN)
@@ -1410,7 +1411,7 @@ gboolean bigPictureSetMinPercentId(GtkWidget *bigPicture, const gdouble newValue
               g_critical("Cannot set grid minimum to %1.1f because this is greater than the grid maximum of %1.1f.\n", (double)newValue, (double)properties->percentIdRange.max);
             }
           else
-            {    
+            {
               properties->percentIdRange.min = newValue;
               updateOnPercentIdChanged(bigPicture);
               result = TRUE;
@@ -1430,14 +1431,14 @@ static GtkWidget* createButton(GtkWidget *container, const char *label, const ch
 {
   GtkWidget *eventBox = gtk_event_box_new();
   gtk_box_pack_start(GTK_BOX(container), eventBox, FALSE, FALSE, 0);
-  
+
   GtkWidget *button = gtk_button_new_with_label(label);
   gtk_container_add(GTK_CONTAINER(eventBox), button);
-  
+
   /* gtk_widget_set_tooltip_text(button, tooltip); */ /* not in pre-GTK-2.12 */
-  
+
   g_signal_connect(GTK_OBJECT(button), "clicked", callback_func, data);
-  
+
   return button;
 }
 
@@ -1450,54 +1451,54 @@ static GtkWidget *createBigPictureGridHeader(GtkWidget *bigPicture)
 {
   GtkWidget *header = gtk_layout_new(NULL, NULL);
   gtk_widget_set_name(header, BIG_PICTURE_GRID_HEADER_NAME);
-  
+
   /* Create the header buttons. Put them in an hbox */
   GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
   gtk_layout_put(GTK_LAYOUT(header), hbox, 0, 0);
-  
+
   /* Store a ref to the first button so we can find out the height of the
    * buttons when we come to calculate the grid borders */
   GtkWidget *refButton = createButton(hbox, "Zoom in", "Zoom in (Ctrl-=)", (GtkSignalFunc)onZoomInBigPicture, bigPicture);
   createButton(hbox, "Zoom out", "Zoom out (Ctrl--)", (GtkSignalFunc)onZoomOutBigPicture, bigPicture);
   createButton(hbox, "Whole", "Zoom out to whole width (Shift-Ctrl--_", (GtkSignalFunc)onZoomWholeBigPicture, bigPicture);
-  
+
   /* Create the header properties */
   gridHeaderCreateProperties(header, bigPicture, refButton);
-  
+
   /* Conect signals */
   g_signal_connect(G_OBJECT(header), "expose-event", G_CALLBACK(onExposeGridHeader), NULL);
-  
+
   return header;
 }
 
 
-GtkWidget* createBigPicture(GtkWidget *blxWindow, 
+GtkWidget* createBigPicture(GtkWidget *blxWindow,
                             BlxContext *bc,
 			    GtkContainer *parent,
-			    GtkWidget **fwdStrandGrid, 
+			    GtkWidget **fwdStrandGrid,
 			    GtkWidget **revStrandGrid,
                             const IntRange* const initRange,
                             const IntRange* const fullRange,
 			    const int initialZoom,
 			    const gdouble lowestId)
 {
-  /* Create the main big picture widget, which will contain all of the 
+  /* Create the main big picture widget, which will contain all of the
    * individual big-picture grids, plus a header, in a scrollable vbox. */
   GtkWidget *bigPicture = gtk_scrolled_window_new(NULL, NULL);
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(bigPicture), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
   gtk_container_add(parent, bigPicture);
-   
+
   GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
   gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(bigPicture), vbox);
   gtk_widget_set_name(vbox, BIG_PICTURE_WIDGET_NAME);
-  
+
   /* Our big picture needs to have a header plus 4 panes:
    * 1. the top grid (fwd strand)
    * 2. the exon view
-   * 3. bottom grid (reverse strand) 
-   * 4. coverage view 
+   * 3. bottom grid (reverse strand)
+   * 4. coverage view
    */
-  
+
   GtkWidget *header = createBigPictureGridHeader(bigPicture);
   addChildToBigPicture(vbox, header, FALSE);
 
@@ -1508,7 +1509,7 @@ GtkWidget* createBigPicture(GtkWidget *blxWindow,
 
   /* Create the coverage view. */
   CoverageViewProperties *coverageViewP = createCoverageView(blxWindow, bc);
-  
+
   /* By default, make the forward strand the top grid */
   addChildToBigPicture(vbox, *fwdStrandGrid, FALSE);
   addChildToBigPicture(vbox, fwdExonView, FALSE);
@@ -1519,11 +1520,11 @@ GtkWidget* createBigPicture(GtkWidget *blxWindow,
   g_signal_connect(G_OBJECT(bigPicture), "size-allocate", G_CALLBACK(onSizeAllocateBigPicture), NULL);
 
   /* Create the big picture properties. */
-  BigPictureProperties *properties = bigPictureCreateProperties(bigPicture, 
+  BigPictureProperties *properties = bigPictureCreateProperties(bigPicture,
                                                                 blxWindow,
                                                                 bc,
                                                                 coverageViewP,
-                                                                header, 
+                                                                header,
                                                                 *fwdStrandGrid,
                                                                 *revStrandGrid,
                                                                 fwdExonView,
@@ -1536,9 +1537,6 @@ GtkWidget* createBigPicture(GtkWidget *blxWindow,
 
   /* Set a pointer to the parent big picture panel */
   coverageViewP->setPanel(properties);
-  
+
   return bigPicture;
 }
-
-
-
diff --git a/src/blixemApp/bigpicture.hpp b/src/blixemApp/bigpicture.hpp
index a2d41f3ff4adaf3890928752b5fef9818f7dce63..82059c5705fe5c07cbb226c2e8d8c5866c87f517 100644
--- a/src/blixemApp/bigpicture.hpp
+++ b/src/blixemApp/bigpicture.hpp
@@ -1,5 +1,6 @@
 /*  File: bigpicture.h
  *  Author: Gemma Barson, 2009-11-23
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -35,7 +36,7 @@
  *              Alignments are shown as lines and are placed in a scaled grid
  *              (one for each strand) against their %ID (see bigpicturegrid.h).
  *
- *              Exons and introns are drawn in standard notation in the 
+ *              Exons and introns are drawn in standard notation in the
  *              transcript section (see exonview.h).
  *----------------------------------------------------------------------------
  */
@@ -54,11 +55,11 @@ class BigPictureProperties : public BlxPanel
 {
 public:
   // Constructors
-  BigPictureProperties(GtkWidget *bigPicture_in, 
-                       GtkWidget *blxWindow_in, 
+  BigPictureProperties(GtkWidget *bigPicture_in,
+                       GtkWidget *blxWindow_in,
                        BlxContext *bc,
-                       CoverageViewProperties *coverageViewP_in, 
-                       GtkWidget *header_in, 
+                       CoverageViewProperties *coverageViewP_in,
+                       GtkWidget *header_in,
                        GtkWidget *fwdStrandGrid_in,
                        GtkWidget *revStrandGrid_in,
                        GtkWidget *fwdExonView_in,
@@ -88,10 +89,10 @@ public:
   GtkWidget *revStrandGrid;	/* The grid that displays the reverse ref seq strand */
   GtkWidget *fwdExonView;	/* The section showing the exons for the forward ref seq strand */
   GtkWidget *revExonView;	/* The section showing the exons for the reverse ref seq strand */
-    
+
   GSList *roundValues;	        /* List of "nice" values to round to, for the display values in the grid header */
   int initialZoom;		/* Multiple to multiply the detail view display range by to get the initial big picture display range */
-    
+
   int numHCells;		/* The number of cells in the grid horizontally */
   int basesPerCell;		/* The number of bases show per horizontal cell */
   int roundTo;	           	/* The number of bases to round grid lines to the nearest multiple of */
@@ -101,7 +102,7 @@ public:
   DoubleRange percentIdRange;	/* The max and min %ID values displayed */
 
   int leftBorderChars;          /* The number of characters in the left border of the big picture grids */
-    
+
 };
 
 class GridHeaderProperties
@@ -110,7 +111,7 @@ public:
   GtkWidget *widget;          /* The grid header widget */
   GtkWidget *bigPicture;      /* The big picture view that this header belongs to */
   GtkWidget *refButton;       /* A reference button, so we can query properties like its height */
-    
+
   GdkRectangle headerRect;    /* The actual drawing area where we'll draw the labels */
   int numHeaderLines;	      /* The number of lines of text in the header labels */
   int markerHeight;	      /* The height of the marker lines between the grid and the header labels */
@@ -162,20 +163,20 @@ void                          scrollBigPictureRightStep(GtkWidget *bigPicture);
 gint			      bigPictureGetCellHeight(GtkWidget *bigPicture);
 
 void			      drawVerticalGridLines(GdkRectangle *drawingRect, GdkRectangle *highlightRect,
-						    const int yPadding, BlxContext *bc, 
+						    const int yPadding, BlxContext *bc,
 						    BigPictureProperties *bpProperties, GdkDrawable *drawable);
 
 void			      drawHorizontalGridLines(GtkWidget *widget, GtkWidget *bigPicture,
 						      GdkRectangle *drawingRect, BlxContext *bc,
 						      BigPictureProperties *bpProperties, GdkDrawable *drawable,
-						      const gint numCells, const gdouble rangePerCell, 
+						      const gint numCells, const gdouble rangePerCell,
 						      const gdouble maxVal, const gboolean abbrev, const char *unit);
 
 void			      zoomBigPicture(GtkWidget *bigPicture, const gboolean zoomIn);
 void			      zoomWholeBigPicture(GtkWidget *bigPicture);
 
-int			      getRightCoordFromCentre(const int centreCoord, 
-						      const int width, 
+int			      getRightCoordFromCentre(const int centreCoord,
+						      const int width,
 						      const GdkRectangle *outerRect);
 
 void			      refreshGridOrder(GtkWidget *bigPicture);
@@ -183,7 +184,7 @@ void			      refreshGridOrder(GtkWidget *bigPicture);
 GtkWidget*		      createBigPicture(GtkWidget *blxWindow,
                                                BlxContext *bc,
 					       GtkContainer *parent,
-					       GtkWidget **fwdStrandGrid, 
+					       GtkWidget **fwdStrandGrid,
 					       GtkWidget **revStrandGrid,
                                                const IntRange* const initRange,
                                                const IntRange* const fullRange,
diff --git a/src/blixemApp/bigpicturegrid.cpp b/src/blixemApp/bigpicturegrid.cpp
index f8667897dc32a297980bca91641b11c5238eefbc..2e22d463e749d24c07212e93052d4821f373e3f2 100644
--- a/src/blixemApp/bigpicturegrid.cpp
+++ b/src/blixemApp/bigpicturegrid.cpp
@@ -1,5 +1,6 @@
 /*  File: bigpicturegrid.c
  *  Author: Gemma Barson, 2009-11-23
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -63,7 +64,7 @@ typedef struct _DrawGridData
   gboolean drawColinearityLines;
 } DrawGridData;
 
-  
+
 
 /* Local function declarations */
 static BlxContext*	    gridGetContext(GtkWidget *grid);
@@ -76,8 +77,8 @@ static void                 drawBigPictureGrid(GtkWidget *grid, GdkDrawable *dra
  *                     Utility functions	           *
  ***********************************************************/
 
-/* Calls the given function (passed as the data pointer) on the given widget 
- * if it is a grid in the big picture view, or, if it is a container, 
+/* Calls the given function (passed as the data pointer) on the given widget
+ * if it is a grid in the big picture view, or, if it is a container,
  * calls the function on all children/grandchildren/etc that are grids */
 void callFuncOnAllBigPictureGrids(GtkWidget *widget, gpointer data)
 {
@@ -106,10 +107,10 @@ gint convertValueToGridPos(GtkWidget *grid, const gdouble value)
 {
   /* The top line of the grid is drawn one cell height down from the top of the grid border */
   GridProperties *properties = gridGetProperties(grid);
-  
+
   DoubleRange *valRange = bigPictureGetPercentIdRange(properties->bigPicture);
   gdouble percent = (valRange->max - value) / (valRange->max - valRange->min);
-  
+
   /* Make sure we do the multiplication on doubles before rounding to int */
   gint result = properties->gridRect.y + roundNearest((gdouble)properties->gridRect.height * percent);
   return result;
@@ -118,12 +119,12 @@ gint convertValueToGridPos(GtkWidget *grid, const gdouble value)
 
 /* Calculates the size and position of an MSP line in the given grid. Return
  * args can be null if not required. */
-static void calculateMspLineDimensions(GtkWidget *grid, 
-                                       const MSP* const msp, 
+static void calculateMspLineDimensions(GtkWidget *grid,
+                                       const MSP* const msp,
                                        gboolean clip,
-                                       int *x, 
-                                       int *y, 
-                                       int *width, 
+                                       int *x,
+                                       int *y,
+                                       int *width,
                                        int *height)
 {
   BlxContext *bc = gridGetContext(grid);
@@ -136,23 +137,23 @@ static void calculateMspLineDimensions(GtkWidget *grid,
   /* The grid pos for coords gives the left edge of the coord, so draw to max + 1 to be inclusive */
   const int mspMin = msp->qRange.min(true, bc->displayRev);
   const int mspMax = msp->qRange.max(true, bc->displayRev);
-  
+
   const int x1 = convertBaseIdxToRectPos(mspMin, &gridProperties->gridRect, &dnaDispRange, TRUE, bc->displayRev, TRUE);
   const int x2 = convertBaseIdxToRectPos(mspMax, &gridProperties->gridRect, &dnaDispRange, TRUE, bc->displayRev, TRUE);
-  
+
   const int xMin = min(x1, x2);
   const int xMax = max(x1, x2);
-  
+
   if (x)
     *x = xMin;
-    
+
   if (width)
     *width = max((xMax - xMin), MIN_MSP_LINE_WIDTH);
-  
+
   /* Find where in the y axis we should draw the line, based on the %ID value */
   if (y)
     *y = convertValueToGridPos(grid, msp->id);
-    
+
   if (height)
     *height = gridProperties->mspLineHeight;
 }
@@ -162,7 +163,7 @@ static void calculateMspLineDimensions(GtkWidget *grid,
  * strand, is not an intron or exon, and (if checkRange is true) is not out of range */
 static gboolean mspShownInGrid(const MSP* const msp, GtkWidget *grid, gboolean checkRange)
 {
-  gboolean result = FALSE ; 
+  gboolean result = FALSE ;
 
   list<const SequenceGroup*> groups ;
   BlxContext *bc = NULL ;
@@ -177,7 +178,7 @@ static gboolean mspShownInGrid(const MSP* const msp, GtkWidget *grid, gboolean c
       groups = bc->getSequenceGroups(msp->sSequence) ;
       result = bc->isGroupVisible(groups, msp->sSequence->type) ;
     }
-  
+
   if (result)
     {
       if (checkRange)
@@ -193,7 +194,7 @@ static gboolean mspShownInGrid(const MSP* const msp, GtkWidget *grid, gboolean c
           result = TRUE;
         }
     }
-  
+
   return result;
 }
 
@@ -206,22 +207,22 @@ static void drawMspLine(const MSP* const msp, DrawGridData *drawData)
     {
       gdk_gc_set_subwindow(drawData->gc, GDK_INCLUDE_INFERIORS);
       gdk_gc_set_foreground(drawData->gc, drawData->color);
-      
+
       /* Calculate where it should go */
       int x, y, width, height;
       calculateMspLineDimensions(drawData->grid, msp, TRUE, &x, &y, &width, &height);
-      
+
       /* Draw a block rectangle */
       gdk_draw_rectangle(drawData->drawable, drawData->gc, TRUE, x, y, width, height);
-      
+
       /* Draw a drop-shadow, to make sure it is always visible even in the paler highlight colors */
       const int shadowHt = 1;
       gdk_gc_set_foreground(drawData->gc, drawData->shadowColor);
       gdk_gc_set_line_attributes(drawData->gc, shadowHt, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
-      
+
       int yBottom = y + height - shadowHt;
       gdk_draw_line(drawData->drawable, drawData->gc, x, yBottom, x + width, yBottom);
-      
+
       /* only draw the right-hand-side if the width is great enough to fit it and still be visible */
       if (width > shadowHt + 1)
       {
@@ -238,7 +239,7 @@ static void drawColinearityLines(GList *mspListItem, DrawGridData *drawData)
   g_return_if_fail(drawData);
 
   BlxContext *bc = gridGetContext(drawData->grid);
-  
+
   if (drawData->drawColinearityLines && mspListItem && mspListItem->next && bc->flags[BLXFLAG_SHOW_COLINEARITY])
     {
       const IntRange* const displayRange = gridGetDisplayRange(drawData->grid);
@@ -288,7 +289,7 @@ static void drawColinearityLines(GList *mspListItem, DrawGridData *drawData)
               IntRange lineXRange(x1 + width1, x2);
               IntRange lineYRange(y1 + height1 / 2, y2 + height2 / 2);
 
-              gdk_draw_line(drawData->drawable, drawData->gc, 
+              gdk_draw_line(drawData->drawable, drawData->gc,
                             lineXRange.min(), lineYRange.min(), lineXRange.max(), lineYRange.max());
             }
         }
@@ -300,12 +301,12 @@ static void drawColinearityLines(GList *mspListItem, DrawGridData *drawData)
 static void drawSequenceMspLines(gpointer listItemData, gpointer data)
 {
   const BlxSequence *seq = (const BlxSequence*)listItemData;
-  
+
   /* Only applicable to alignments and transcripts */
   if (!blxSequenceShownInGrid(seq))
     return;
-  
-  DrawGridData *drawData = (DrawGridData*)data;  
+
+  DrawGridData *drawData = (DrawGridData*)data;
   GList *mspListItem = seq->mspList;
 
   for ( ; mspListItem; mspListItem = mspListItem->next)
@@ -340,7 +341,7 @@ static void drawGroupedMspLines(gpointer listItemData, gpointer data)
       GdkColor shadowColor;
       getDropShadowColor(drawData->color, &shadowColor);
       drawData->shadowColor = &shadowColor;
-      
+
       g_list_foreach(seqGroup->seqList, drawSequenceMspLines, drawData);
 
       /* Set the draw data back to its original values */
@@ -351,7 +352,7 @@ static void drawGroupedMspLines(gpointer listItemData, gpointer data)
     {
       g_list_foreach(seqGroup->seqList, drawSequenceMspLines, drawData);
     }
-  
+
 }
 
 
@@ -360,23 +361,23 @@ static void drawMspLines(GtkWidget *grid, GdkDrawable *drawable)
 {
   BlxContext *bc = gridGetContext(grid);
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   DrawGridData drawData = {
-    grid, 
-    drawable, 
-    gc, 
-    gridGetMspLineColor(grid, FALSE), 
+    grid,
+    drawable,
+    gc,
+    gridGetMspLineColor(grid, FALSE),
     gridGetMspLineColor(grid, FALSE),
     FALSE
   };
-  
-  /* Draw all MSPs for this grid */ 
-  g_list_foreach(bc->matchSeqs, drawSequenceMspLines, &drawData);  
+
+  /* Draw all MSPs for this grid */
+  g_list_foreach(bc->matchSeqs, drawSequenceMspLines, &drawData);
 
   /* Now draw MSPs that are in groups (to do: it would be good to do this in reverse
    * Sort Order, so that those ordered first get drawn last and therefore appear on top) */
   g_list_foreach(bc->sequenceGroups, drawGroupedMspLines, &drawData);
-  
+
   /* Finally, draw selected sequences. These will appear on top of everything else and will have
    * colinearity lines displayed (we only ever display colinearity lines for selected sequences
    * in the grid because it would be too cluttered otherwise). */
@@ -386,7 +387,7 @@ static void drawMspLines(GtkWidget *grid, GdkDrawable *drawable)
   drawData.shadowColor = &shadowColor;
   drawData.drawColinearityLines = TRUE;
   g_list_foreach(bc->selectedSeqs, drawSequenceMspLines, &drawData);
-  
+
   g_object_unref(gc);
 }
 
@@ -407,17 +408,17 @@ static void drawBigPictureGrid(GtkWidget *grid, GdkDrawable *drawable)
   /* Get the display range in dna coords */
   IntRange bpRange;
   convertDisplayRangeToDnaRange(&bpProperties->displayRange, bc->seqType, bc->numFrames, bc->displayRev, &bc->refSeqRange, &bpRange);
-  
+
   GdkColor *color = getGdkColor(BLXCOLOR_ASSEMBLY_GAP, bc->defaultColors, FALSE, bc->usePrintColors);
 
   drawAssemblyGaps(grid, drawable, color, bc->displayRev,
-                   &properties->gridRect, &bpRange, 
+                   &properties->gridRect, &bpRange,
                    bc->featureLists[BLXMSP_GAP]);
-  
+
   /* Draw the grid lines */
   drawVerticalGridLines(&properties->gridRect, &properties->highlightRect, properties->gridYPadding, bc, bpProperties, drawable);
   drawHorizontalGridLines(grid, properties->bigPicture, &properties->gridRect, bc, bpProperties, drawable, numVCells, percentPerCell, bpProperties->percentIdRange.max, FALSE, "%");
-  
+
   /* Draw lines corresponding to the MSPs */
   drawMspLines(grid, drawable);
 }
@@ -428,7 +429,7 @@ static void drawBigPictureGrid(GtkWidget *grid, GdkDrawable *drawable)
 void gridPrepareForPrinting(GtkWidget *grid)
 {
   GdkDrawable *drawable = widgetGetDrawable(grid);
-  
+
   if (drawable)
     {
       GridProperties *properties = gridGetProperties(grid);
@@ -453,7 +454,7 @@ void calculateGridHighlightBoxBorders(GtkWidget *grid)
   IntRange *dvRange = detailViewGetDisplayRange(detailView);
 
   bc->highlightBoxCalcBorders(&properties->gridRect,
-                              &properties->highlightRect, 
+                              &properties->highlightRect,
                               bpRange,
                               dvRange,
                               properties->mspLineHeight);
@@ -466,33 +467,33 @@ void calculateGridBorders(GtkWidget *grid)
   GridProperties *properties = gridGetProperties(grid);
   BigPictureProperties *bigPictureProperties = bigPictureGetProperties(properties->bigPicture);
   int numVCells = gridGetNumVCells(grid);
-  
+
   /* Get some info about the size of the layout and the font used */
   guint layoutWidth, layoutHeight;
   gtk_layout_get_size(GTK_LAYOUT(grid), &layoutWidth, &layoutHeight);
-  
+
   properties->displayRect.x = 0;
   properties->displayRect.y = 0;
   properties->displayRect.width = grid->allocation.width;
-  
+
   /* Get the boundaries of the grid */
   properties->gridRect.x = roundNearest(bigPictureProperties->contentXPos());
   properties->gridRect.y = HIGHLIGHT_BOX_Y_PAD + properties->gridYPadding;
   properties->gridRect.width = bigPictureProperties->contentWidth();
   properties->gridRect.height = bigPictureGetCellHeight(properties->bigPicture) * numVCells;
-  
+
   /* Get the boundaries of the highlight box */
   calculateGridHighlightBoxBorders(grid);
-  
+
   /* Get the total display height required. Set the layout size to fit. */
   const int newHeight = properties->highlightRect.height;
-  
+
   if (newHeight != properties->displayRect.height)
     {
       DEBUG_OUT("Setting new grid height = %d\n", newHeight);
       properties->displayRect.height = newHeight;
       gtk_layout_set_size(GTK_LAYOUT(grid), properties->displayRect.width, properties->displayRect.height);
-  
+
       /* Set the size request to our desired height. We want a fixed heigh but don't set the
        * width, because we want the user to be able to resize that. */
       gtk_widget_set_size_request(grid, 0, properties->displayRect.height);
@@ -516,14 +517,14 @@ static gboolean onExposeGrid(GtkWidget *grid, GdkEventExpose *event, gpointer da
   if (window)
     {
       GdkDrawable *bitmap = widgetGetDrawable(grid);
-      
+
       if (!bitmap)
         {
           /* There isn't a bitmap yet. Create it now. */
 	  bitmap = createBlankPixmap(grid);
           drawBigPictureGrid(grid, bitmap);
         }
-      
+
       if (bitmap)
         {
           /* Push the bitmap onto the window */
@@ -537,7 +538,7 @@ static gboolean onExposeGrid(GtkWidget *grid, GdkEventExpose *event, gpointer da
 
           GdkColor *highlightBoxColor = getGdkColor(BLXCOLOR_HIGHLIGHT_BOX, bc->defaultColors, FALSE, bc->usePrintColors);
           drawHighlightBox(window, &properties->highlightRect, HIGHLIGHT_BOX_MIN_WIDTH, highlightBoxColor);
-          
+
           /* Draw the preview box too, if set */
           BigPictureProperties *bpProperties = bigPictureGetProperties(properties->bigPicture);
           bpProperties->drawPreviewBox(window, &properties->gridRect, &properties->highlightRect);
@@ -547,7 +548,7 @@ static gboolean onExposeGrid(GtkWidget *grid, GdkEventExpose *event, gpointer da
 	  g_warning("Failed to draw grid [%p] - could not create bitmap.\n", grid);
 	}
     }
-  
+
   return TRUE;
 }
 
@@ -560,41 +561,41 @@ static void onSizeAllocateBigPictureGrid(GtkWidget *grid, GtkAllocation *allocat
   /* Recalculate the borders for the grids and the header */
   GridProperties *properties = gridGetProperties(grid);
   BigPictureProperties *bigPictureProperties = bigPictureGetProperties(properties->bigPicture);
-  
+
   calculateGridHeaderBorders(bigPictureProperties->header);
   calculateGridBorders(grid);
-  
+
   DEBUG_EXIT("onSizeAllocateBigPictureGrid returning");
 }
 
 
 /* Mark the given MSP's sequence as selected if this MSP line contains the given coords.
  * Returns true if it was selected. */
-static gboolean selectMspIfContainsCoords(GtkWidget *grid, 
+static gboolean selectMspIfContainsCoords(GtkWidget *grid,
 					  const MSP *msp,
 					  const int x,
 					  const int y,
 					  gboolean deselectOthers)
 {
   gboolean wasSelected = FALSE;
-  
+
   if (mspShownInGrid(msp, grid, TRUE))
     {
       int mspX, mspY, mspWidth, mspHeight;
       calculateMspLineDimensions(grid, msp, TRUE, &mspX, &mspY, &mspWidth, &mspHeight);
-      
+
       if (x >= mspX && x <= mspX + mspWidth && y >= mspY && y <= mspY + mspHeight)
 	{
 	  /* It's a hit. Select this sequence. */
 	  GtkWidget *blxWindow = gridGetBlxWindow(grid);
-	  
+
 	  if (deselectOthers)
 	    {
 	      blxWindowDeselectAllSeqs(blxWindow);
 	    }
-	  
+
 	  blxWindowSelectSeq(blxWindow, msp->sSequence);
-	  
+
 	  /* Update the selected strand */
 	  GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
 	  detailViewSetSelectedStrand(detailView, gridGetStrand(grid));
@@ -605,7 +606,7 @@ static gboolean selectMspIfContainsCoords(GtkWidget *grid,
 	  wasSelected = TRUE;
 	}
     }
-  
+
   return wasSelected;
 }
 
@@ -632,32 +633,32 @@ static gboolean selectClickedMspLines(GtkWidget *grid, GdkEventButton *event, co
 static gboolean onButtonPressGrid(GtkWidget *grid, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   /* left button */
   if (event->button == 1)
     {
       /* If we clicked on top of an msp line, select that msp */
       const gboolean ctrlModifier = (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
       const gboolean shiftModifier = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
-      
+
       handled = selectClickedMspLines(grid, event, ctrlModifier, shiftModifier);
     }
-  
+
   /* Middle button: always show the preview box; left button: show
    * preview box if we double-clicked, or if we clicked in the highlight
-   * box (i.e. left button selects and drags the highlight box; middle 
+   * box (i.e. left button selects and drags the highlight box; middle
    * button or double-click makes the highlight box jump) */
   GridProperties *properties = gridGetProperties(grid);
-  
-  if (event->button == 2 || 
-      (event->button == 1 && !handled && 
-       (event->type == GDK_2BUTTON_PRESS || 
+
+  if (event->button == 2 ||
+      (event->button == 1 && !handled &&
+       (event->type == GDK_2BUTTON_PRESS ||
         clickedInRect(event, &properties->highlightRect, HIGHLIGHT_BOX_MIN_WIDTH))))
     {
-      /* If dragging the highlight box (left button), then centre the preview 
+      /* If dragging the highlight box (left button), then centre the preview
        * box on the existing highlight box centre; otherwise, centre it on the click pos */
       int x = event->x;
-      
+
       if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
         x = properties->highlightRect.x + properties->highlightRect.width / 2;
 
@@ -665,7 +666,7 @@ static gboolean onButtonPressGrid(GtkWidget *grid, GdkEventButton *event, gpoint
       bpProperties->startPreviewBox(event->x, TRUE, x - event->x);
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -678,7 +679,7 @@ static gboolean onButtonReleaseGrid(GtkWidget *grid, GdkEventButton *event, gpoi
       BigPictureProperties *bpProperties = bigPictureGetProperties(properties->bigPicture);
       bpProperties->finishPreviewBox(event->x, &properties->gridRect, &properties->highlightRect);
     }
-  
+
   return TRUE;
 }
 
@@ -689,7 +690,7 @@ static gboolean onButtonReleaseGrid(GtkWidget *grid, GdkEventButton *event, gpoi
 static gboolean onScrollGrid(GtkWidget *grid, GdkEventScroll *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   switch (event->direction)
     {
       case GDK_SCROLL_LEFT:
@@ -698,7 +699,7 @@ static gboolean onScrollGrid(GtkWidget *grid, GdkEventScroll *event, gpointer da
 	  handled = TRUE;
 	  break;
 	}
-	
+
       case GDK_SCROLL_RIGHT:
 	{
           scrollBigPictureRightStep(gridGetBigPicture(grid));
@@ -712,7 +713,7 @@ static gboolean onScrollGrid(GtkWidget *grid, GdkEventScroll *event, gpointer da
 	  break;
 	}
     };
-  
+
   return handled;
 }
 
@@ -726,7 +727,7 @@ static gboolean onMouseMoveGrid(GtkWidget *grid, GdkEventMotion *event, gpointer
       BigPictureProperties *bpProperties = bigPictureGetProperties(gridGetBigPicture(grid));
       bpProperties->startPreviewBox(event->x, FALSE, 0);
     }
-  
+
   return TRUE;
 }
 
@@ -749,7 +750,7 @@ static BlxContext* gridGetContext(GtkWidget *grid)
 static void onDestroyGrid(GtkWidget *widget)
 {
   GridProperties *properties = gridGetProperties(widget);
-  
+
   if (properties)
     {
       delete properties;
@@ -759,7 +760,7 @@ static void onDestroyGrid(GtkWidget *widget)
 }
 
 
-GridProperties::GridProperties(GtkWidget *widget_in, 
+GridProperties::GridProperties(GtkWidget *widget_in,
                                GtkWidget *bigPicture_in,
                                gulong exposeHandlerId_in,
                                BlxStrand strand_in)
@@ -786,25 +787,25 @@ GridProperties::GridProperties(GtkWidget *widget_in,
 }
 
 
-static void gridCreateProperties(GtkWidget *widget, 
+static void gridCreateProperties(GtkWidget *widget,
 				 GtkWidget *bigPicture,
 				 gulong exposeHandlerId,
 				 BlxStrand strand)
 {
   if (widget)
-    { 
+    {
       /* Work out how many characters we need to display in the left border for
-       * the vertical grid axis label.  This is the number of digits in the 
+       * the vertical grid axis label.  This is the number of digits in the
        * largest label value plus one (for a '%' character)
-       * Add a fudge factor to give more space to allow for the fact that 
+       * Add a fudge factor to give more space to allow for the fact that
        * the calculated char width is approximate and may not give enough space */
-      GridProperties *properties = new GridProperties(widget, 
+      GridProperties *properties = new GridProperties(widget,
                                                       bigPicture,
                                                       exposeHandlerId,
                                                       strand);
-      
+
       g_object_set_data(G_OBJECT(widget), "GridProperties", properties);
-      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyGrid), NULL); 
+      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyGrid), NULL);
     }
 }
 
@@ -849,27 +850,25 @@ GtkWidget* createBigPictureGrid(GtkWidget *bigPicture, BlxStrand strand)
 {
   /* Create a layout area for the grid */
   GtkWidget *grid = gtk_layout_new(NULL, NULL);
-  
+
   /* Grid style properties */
   gtk_widget_set_redraw_on_allocate(grid, FALSE);
   gtk_widget_set_name(grid, BIG_PICTURE_GRID_NAME);
-  
+
   /* Connect signals */
   gtk_widget_add_events(grid, GDK_BUTTON_PRESS_MASK);
   gtk_widget_add_events(grid, GDK_BUTTON_RELEASE_MASK);
   gtk_widget_add_events(grid, GDK_POINTER_MOTION_MASK);
-  
-  gulong exposeHandlerId = g_signal_connect(G_OBJECT(grid), "expose-event", G_CALLBACK(onExposeGrid), NULL);  
+
+  gulong exposeHandlerId = g_signal_connect(G_OBJECT(grid), "expose-event", G_CALLBACK(onExposeGrid), NULL);
   g_signal_connect(G_OBJECT(grid), "size-allocate",	    G_CALLBACK(onSizeAllocateBigPictureGrid), NULL);
   g_signal_connect(G_OBJECT(grid), "button-press-event",    G_CALLBACK(onButtonPressGrid),	      NULL);
   g_signal_connect(G_OBJECT(grid), "button-release-event",  G_CALLBACK(onButtonReleaseGrid),	      NULL);
   g_signal_connect(G_OBJECT(grid), "motion-notify-event",   G_CALLBACK(onMouseMoveGrid),	      NULL);
   g_signal_connect(G_OBJECT(grid), "scroll-event",	    G_CALLBACK(onScrollGrid),		      NULL);
-  
+
   /* Set required data in the grid. We can't set the tree yet because it hasn't been created yet. */
   gridCreateProperties(grid, bigPicture, exposeHandlerId, strand);
-  
+
   return grid;
 }
-
-
diff --git a/src/blixemApp/bigpicturegrid.hpp b/src/blixemApp/bigpicturegrid.hpp
index cf353582c5f5ce8f52f0d37982ca4303f543e9fa..7aa71745e280cf2742aa91238aa2b4175777ba66 100644
--- a/src/blixemApp/bigpicturegrid.hpp
+++ b/src/blixemApp/bigpicturegrid.hpp
@@ -1,5 +1,6 @@
 /*  File: bigpicturegrid.h
  *  Author: Gemma Barson, 2009-11-23
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -32,7 +33,7 @@
  *              alignments on a particular strand of the reference sequence.
  *              The x coord of the grid is the reference sequence coord and the
  *              y coord is the %ID of the alignment. An alignment is shown as
- *              a horizontal line between the start and end coords of the 
+ *              a horizontal line between the start and end coords of the
  *              match, at the y coord corresponding to the relevant %ID.
  *----------------------------------------------------------------------------
  */
@@ -52,23 +53,23 @@
 class GridProperties
 {
 public:
-  GridProperties(GtkWidget *widget_in, 
+  GridProperties(GtkWidget *widget_in,
                  GtkWidget *bigPicture_in,
                  gulong exposeHandlerId_in,
                  BlxStrand strand_in);
 
   GtkWidget *widget;       /* The grid widget */
   GtkWidget *bigPicture;   /* The big picture that this grid belongs to */
-    
+
   BlxStrand strand;	     /* Whether this grid shows the fwd or rev strand of the ref sequence. */
-    
+
   int mspLineHeight;	     /* The height of the msp lines */
-    
+
   int gridYPadding;	     /* The y padding around the grid */
-    
+
   gulong exposeHandlerId;  /* The handler ID for the expose event */
   gboolean ignoreSizeAlloc; /* Flag to indicate that we should ignore size allocation events */
-    
+
   GdkRectangle gridRect;
   GdkRectangle displayRect;
   GdkRectangle highlightRect;
@@ -83,15 +84,15 @@ GtkWidget*	    gridGetBigPicture(GtkWidget *grid);
 void		    calculateGridBorders(GtkWidget *grid);
 void		    calculateGridHighlightBoxBorders(GtkWidget *grid);
 
-void		    callFuncOnAllBigPictureGrids(GtkWidget *widget, 
+void		    callFuncOnAllBigPictureGrids(GtkWidget *widget,
 						 gpointer data);
 
-gint		    convertValueToGridPos(GtkWidget *grid, 
+gint		    convertValueToGridPos(GtkWidget *grid,
 					  const gdouble value);
 
 void                gridPrepareForPrinting(GtkWidget *grid);
 
-GtkWidget*	    createBigPictureGrid(GtkWidget *bigPicture, 
+GtkWidget*	    createBigPictureGrid(GtkWidget *bigPicture,
 					 BlxStrand strand);
 
 #endif /* _big_picture_grid_included_ */
diff --git a/src/blixemApp/blixem_.hpp b/src/blixemApp/blixem_.hpp
index 2ac43bb706f8f94163f880f257b6e267cfeaabb4..59502d04c96b1794ac1cff93be078b09468b50d0 100644
--- a/src/blixemApp/blixem_.hpp
+++ b/src/blixemApp/blixem_.hpp
@@ -1,5 +1,6 @@
 /*  File: blixem_.h
  *  Author: Ed Griffiths, 2001-11-29
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -87,7 +88,7 @@ class BlxContext;
 #define BLXCOL_TISSUE_TYPE_WIDTH        100   /* default width for tissue-type column  */
 
 
-/* 
+/*
  * config file groups/keywords, these should not be changed willy nilly as they
  * are used external programs and users when constructing config files.
  * If you change things or add additional groups or values, then you should
@@ -113,7 +114,7 @@ class BlxContext;
 
 #define PIPE_FETCH_LOCATION       "command"
 #define PIPE_FETCH_ARGS           "args"
-#endif 
+#endif
 
 /* Required keys for socket-fetch groups */
 #define SOCKET_FETCH_LOCATION     "command"
@@ -145,7 +146,7 @@ class BlxContext;
 /* For settings */
 #define BLIXEM_SETTINGS_FILE             ".blixemrc"  /* default file name for saving blixem settings to */
 #define SETTINGS_GROUP                   "user-settings"
-#define STYLES_FILE_KEY                  "stylesfile" /* styles-file key in the [blixem] group */  
+#define STYLES_FILE_KEY                  "stylesfile" /* styles-file key in the [blixem] group */
 
 #define SETTING_NAME_INVERT_SORT "invert-sort"
 #define SETTING_NAME_HIGHLIGHT_DIFFS "highlight-diffs"
@@ -216,16 +217,16 @@ typedef void(*FetchFunc)(const char *seqName, gpointer fetchMethod, const gboole
 
 
 /* The following are used to define default colors for certain types of features in Blixem.
- * One of several different actual colors from the BlxColor struct may be used depending 
- * on state, e.g. we use a different color if "print colors" (i.e. black and 
+ * One of several different actual colors from the BlxColor struct may be used depending
+ * on state, e.g. we use a different color if "print colors" (i.e. black and
  * white mode) is on. */
 
-typedef enum 
+typedef enum
   {
     BLXCOLOR_MIN,           /* dummy value so that we don't get a zero ID */
-  
+
     BLXCOLOR_BACKGROUND,    /* background color of the widgets */
-    BLXCOLOR_REF_SEQ,       /* default background color for the reference sequence */  
+    BLXCOLOR_REF_SEQ,       /* default background color for the reference sequence */
     BLXCOLOR_MATCH,         /* background color for an exact match */
     BLXCOLOR_CONS,          /* background color for a conserved match */
     BLXCOLOR_MISMATCH,      /* background color for a mismatch */
@@ -271,13 +272,13 @@ typedef enum
 
     BLXCOL_NUM_COLORS
   } BlxColorId;
-  
+
 
 /* Utility struct to pass around a set of colors from a styles file */
 typedef struct _BlxStyleColors
 {
   char *fillColor;
-  char *lineColor; 
+  char *lineColor;
   char *fillColorSelected;
   char *lineColorSelected;
   char *fillColorCds;
@@ -288,12 +289,12 @@ typedef struct _BlxStyleColors
   gboolean cdsFound;
 } BlxStyleColors;
 
-  
+
 /* This enum contains a list of all the boolean options that the user can toggle on/off */
 typedef enum
   {
     BLXFLAG_MIN,                    /* Start index for looping through flags */
-  
+
     BLXFLAG_INVERT_SORT,            /* Inverts the default sort order */
     BLXFLAG_HIGHLIGHT_DIFFS,        /* Hides matching bases and highlights mis-matching ones */
     BLXFLAG_HIGHLIGHT_VARIATIONS,   /* Whether to highlight bases that have variations in the reference sequence */
@@ -315,12 +316,12 @@ typedef enum
     BLXFLAG_LINK_FEATURES,          /* whether features with the same name should be linked */
     BLXFLAG_SHOW_COLINEARITY,       /* whether to show colinearity lines between alignment blocks */
     BLXFLAG_SHOW_COLINEARITY_SELECTED, /* whether to show colinearity lines for selected sequence only */
-    
+
     BLXFLAG_NUM_FLAGS               /* Total number of flags e.g. for creating arrays and loops etc */
   } BlxFlag;
 
 
-/* Structure representing a group of sequences. This groups several BlxSequences together and 
+/* Structure representing a group of sequences. This groups several BlxSequences together and
  * sets various flags so that we can hide/highlight/etc all of the sequences in a group. */
 typedef struct _SequenceGroup
   {
@@ -352,7 +353,7 @@ typedef enum
     BLXOPT_HSP_GAPS = 7,          /* 'G' for HSP gaps mode; blank otherwise (blxparser.c) */
     BLXOPT_SORT_MODE = 8,         /* Initial sort mode: i=ID, n=name, p=position, s=score, t=tissue type, m=strain, g=gene name, o=organism;
                                    * OR: set to 'd' to automatically dotter the first sequence; blank otherwise (blxselect.c) */
-    
+
     BLXOPT_NUM_OPTS               /* Total number of options (must always be last in list) */
   } BlxOptsIdx ;
 
@@ -363,7 +364,7 @@ typedef enum
 typedef enum
   {
     BLXDIALOG_NOT_PERSISTENT = 0,   /* Reserved for dialogs that do not have an entry in the array */
-    
+
     BLXDIALOG_HELP,                 /* The Help dialog */
     BLXDIALOG_SETTINGS,             /* The Settings dialog */
     BLXDIALOG_SORT,                 /* The Sort dialog */
@@ -371,7 +372,7 @@ typedef enum
     BLXDIALOG_GROUPS,               /* The Groups dialog */
     BLXDIALOG_VIEW,                 /* The View dialog */
     BLXDIALOG_DOTTER,               /* The Dotter dialog */
-    
+
     BLXDIALOG_NUM_DIALOGS           /* The number of dialogs. Must always be the last entry in this enum */
   } BlxDialogId;
 
@@ -394,7 +395,7 @@ typedef enum
 
 
 /* This enum gives access into the depthArray for the specific counter (i.e. per-base or all) */
-typedef enum 
+typedef enum
   {
     DEPTHCOUNTER_NONE,
 
@@ -431,7 +432,7 @@ public:
   MSP *mspList;                   /* the list of alignments */
   GList *columnList;              /* the list of display columns */
   char **geneticCode;             /* the genetic code */
-  
+
   BlxStrand activeStrand;         /* which strand will initially be the active one */
   gboolean negateCoords;          /* if this option is true, the display will show coords as negative when the reverse strand is active */
   gboolean zoomWhole;             /* whether to zoom out to view the entire big picture range on startup */
@@ -449,9 +450,9 @@ public:
   gboolean saveTempFiles;         /* save any temporary files that blixem creates */
   gboolean coverageOn;            /* show the coverage view on start-up */
   gboolean abbrevTitle;           /* if true, use a abbreviated window titles to save space */
-  
-  gboolean mspFlagDefaults[MSPFLAG_NUM_FLAGS]; /* default values for MSP flags */     
-  
+
+  gboolean mspFlagDefaults[MSPFLAG_NUM_FLAGS]; /* default values for MSP flags */
+
   BlxBlastMode blastMode;         /* the blast match mode */
   BlxSeqType seqType;             /* whether the display shows sequences as peptides or nucleotides */
   int numFrames;                  /* the number of reading frames */
@@ -556,7 +557,7 @@ public:
             MSP **mspList,
             BlxBlastMode *blastMode,
             GArray* featureLists[],
-            GSList *supportedTypes, 
+            GSList *supportedTypes,
             GSList *styles,
             int refSeqOffset,
             IntRange* const refSeqRange,
@@ -579,7 +580,7 @@ public:
 
 private:
 
-  void regionFetchFeature(const MSP* const msp, 
+  void regionFetchFeature(const MSP* const msp,
                           const BlxFetchMethod* const fetchMethod,
                           const char *script,
                           const char *dataset,
@@ -597,7 +598,7 @@ private:
   MSP **mspList;
   BlxBlastMode *blastMode;
   GArray** featureLists;
-  GSList *supportedTypes; 
+  GSList *supportedTypes;
   GSList *styles;
   int refSeqOffset;
   IntRange* refSeqRange;
@@ -618,10 +619,10 @@ private:
 /* Function to show blixem window, can be called from any application. */
 gboolean                            blxview(CommandLineOptions *options,
                                             GArray* featureLists[],
-                                            GList *seqList, 
+                                            GList *seqList,
                                             GSList *supportedTypes,
-                                            PfetchParams *pfetch, 
-                                            char *align_types, 
+                                            PfetchParams *pfetch,
+                                            char *align_types,
                                             gboolean External,
                                             GSList *styles,
                                             GHashTable *lookupTable) ;
@@ -643,8 +644,8 @@ const IntRange*                    mspGetFullDisplayRange(const MSP* const msp,
 void                               mspCalculateFullExtents(MSP *msp, const BlxContext* const bc, const int numUnalignedBases);
 void                               cacheMspDisplayRanges(const BlxContext* const bc, const int numUnalignedBases);
 
-gboolean                           mspGetMatchCoord(const MSP *msp, 
-                                                    const int qIdx, 
+gboolean                           mspGetMatchCoord(const MSP *msp,
+                                                    const int qIdx,
                                                     const gboolean seqSelected,
                                                     const int numUnalignedBases,
                                                     BlxContext *bc,
@@ -655,7 +656,7 @@ void                               drawAssemblyGaps(GtkWidget *widget,
                                                     GdkDrawable *drawable,
                                                     GdkColor *color,
                                                     const gboolean displayRev,
-                                                    GdkRectangle *rect, 
+                                                    GdkRectangle *rect,
                                                     const IntRange* const dnaRange,
                                                     const GArray *mspArray);
 
@@ -669,13 +670,13 @@ const char*                        blxGetCopyrightString();
 const char*                        blxGetWebSiteString();
 char*                              blxGetCommentsString();
 const char*                        blxGetLicenseString();
-const char*                        blxGetVersionString();        
+const char*                        blxGetVersionString();
 
 /* dotter.c */
 //void                               selectFeatures(void);
 
 /* blxparser.c */
-gboolean                           mspHasFs(const MSP *msp);  
+gboolean                           mspHasFs(const MSP *msp);
 char*                              readFastaSeq(FILE *seqfile, char *qname, int *startCoord, int *endCoord, const BlxSeqType seqType);
 
 /* blxFetch.c */
diff --git a/src/blixemApp/blxFetch.cpp b/src/blixemApp/blxFetch.cpp
index 51047b77904c1f5e411f6c91b0eabd3bbcb88c93..4526e4caef50532c76a819ce16eaa6620f340fc5 100644
--- a/src/blixemApp/blxFetch.cpp
+++ b/src/blixemApp/blxFetch.cpp
@@ -1,5 +1,6 @@
 /*  File: blxFetch.c
  *  Author: Ed Griffiths, 2008-06-17
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -30,7 +31,7 @@
  *
  * Description: Blixem functions for control of sequence fetching and
  *              display.
- *              
+ *
  *              Compiling with -DPFETCH_HTML includes code to issue
  *              pfetch requests to a proxy pfetch server using html.
  *              This requires libs libpfetch and libcurlobj
@@ -57,7 +58,7 @@
 #include <blixemApp/blixem_.hpp>
 #include <blixemApp/blxcontext.hpp>
 
-#ifdef PFETCH_HTML 
+#ifdef PFETCH_HTML
 #include <gbtools/gbtoolsPfetch.hpp>
 #endif
 
@@ -91,9 +92,9 @@ typedef enum
 class ProgressBarStruct
 {
 public:
-  ProgressBarStruct() 
+  ProgressBarStruct()
     : top_level(NULL), progress(NULL), label(NULL),
-      widget_destroy_handler_id(0), cancelled(false), seq_total(0), 
+      widget_destroy_handler_id(0), cancelled(false), seq_total(0),
       fetch_mode(BLXFETCH_MODE_NONE)
   {};
 
@@ -117,8 +118,8 @@ enum {RCVBUFSIZE = 256} ;               /* size of receive buffer for socket fet
 typedef struct GeneralFetchDataStructType
 {
   const BlxFetchMethod* fetchMethod;      /* details about the fetch method */
-  GList *columnList;                      /* list of BlxColumnInfo structs */ 
-  
+  GList *columnList;                      /* list of BlxColumnInfo structs */
+
   char *buffer;                           /* receive buffer */
   int lenReceived;                        /* number of chars received into the buffer */
   BlxSequence *currentSeq;                /* the current sequence that we're processing */
@@ -143,7 +144,7 @@ typedef struct GeneralFetchDataStructType
 
 
 
-#ifdef PFETCH_HTML 
+#ifdef PFETCH_HTML
 #define PFETCH_READ_SIZE 80     /* about a line */
 #define PFETCH_FAILED_PREFIX "PFetch failed:"
 
@@ -191,7 +192,7 @@ typedef struct
 
 
 /* Local function declarations */
-#ifdef PFETCH_HTML 
+#ifdef PFETCH_HTML
 
 static bool pfetch_reader_func(char *text, guint *actual_read, char **error, gpointer user_data) ;
 static bool pfetch_error_func(char *text, guint *actual_read, char **error, gpointer user_data) ;
@@ -257,9 +258,9 @@ static GKeyFile *blx_config_G = NULL ;
 const char *fetchModeStr(const BlxFetchMode fetchMode)
 {
   /* Values must be in the same order as BlxFetchMode */
-  static const gchar* fetchModeNames[] = 
+  static const gchar* fetchModeNames[] =
     {
-#ifdef PFETCH_HTML 
+#ifdef PFETCH_HTML
       "http",
       "pipe",
 #endif
@@ -270,15 +271,15 @@ const char *fetchModeStr(const BlxFetchMode fetchMode)
       "internal",
       "none",
       NULL
-    }; 
-  
+    };
+
   g_assert(g_strv_length((gchar**)fetchModeNames) == BLXFETCH_NUM_MODES);
 
   const char *result = NULL;
-  
+
   if (fetchMode < BLXFETCH_NUM_MODES)
     result = fetchModeNames[fetchMode];
-  
+
   return result;
 }
 
@@ -287,7 +288,7 @@ const char *fetchModeStr(const BlxFetchMode fetchMode)
 const char *outputTypeStr(const BlxFetchOutputType outputType)
 {
   /* Values must be in the same order as BlxFetchMode */
-  static const gchar* outputNames[] = 
+  static const gchar* outputNames[] =
     {
       "<invalid>",
       "raw",
@@ -296,51 +297,51 @@ const char *outputTypeStr(const BlxFetchOutputType outputType)
       "list",
       "gff",
       NULL
-    }; 
-  
+    };
+
   g_assert(g_strv_length((gchar**)outputNames) == BLXFETCH_NUM_OUTPUT_TYPES);
 
   const char *result = NULL;
-  
+
   if (outputType < BLXFETCH_NUM_OUTPUT_TYPES)
     result = outputNames[outputType];
-  
+
   return result;
 }
 
 
 /* Process a single substitution character. Returns false if it's not
  * a known substitution char. */
-static gboolean doFetchStringSubstitutionChar(const char substitution_char, 
+static gboolean doFetchStringSubstitutionChar(const char substitution_char,
                                           MatchSequenceData *match_data,
-                                          GString *result, 
+                                          GString *result,
                                           GString *errorMsg)
 {
   gboolean ok = TRUE;
-  
+
   switch (substitution_char)
     {
-    case 'p': 
+    case 'p':
       g_string_append(result, g_get_prgname());
       break;
-    case 'h': 
+    case 'h':
       g_string_append(result, g_get_host_name());
       break;
-    case 'u': 
+    case 'u':
       g_string_append(result, g_get_user_name());
       break;
-    case 'm': 
+    case 'm':
       if (match_data->match_name)
         g_string_append(result, match_data->match_name);
       break;
-    case 'r': 
+    case 'r':
       if (match_data->ref_name)
         g_string_append(result, match_data->ref_name);
       break;
-    case 's': 
+    case 's':
       g_string_append_printf(result, "%d", match_data->match_start);
       break;
-    case 'e': 
+    case 'e':
       g_string_append_printf(result, "%d", match_data->match_end);
       break;
     case 'd':
@@ -362,10 +363,10 @@ static gboolean doFetchStringSubstitutionChar(const char substitution_char,
       break;
     default:
       ok = FALSE;
-      
+
       if (!errorMsg)
         errorMsg = g_string_new("");
-      
+
       g_string_append_printf(errorMsg, "  Unknown substitution character '%%%c'\n", substitution_char);
       break;
     };
@@ -375,12 +376,12 @@ static gboolean doFetchStringSubstitutionChar(const char substitution_char,
 
 
 /* Process a single substitution keyword. Its format should be:
- *    %(<keyword>) 
- * where <keyword> is a column name e.g. Source or a key value to 
+ *    %(<keyword>)
+ * where <keyword> is a column name e.g. Source or a key value to
  * look up in the source stanza in the config file. */
-static int doFetchStringSubstitutionKeyword(const char* input_string, 
+static int doFetchStringSubstitutionKeyword(const char* input_string,
                                             MatchSequenceData *match_data,
-                                            GString *result, 
+                                            GString *result,
                                             GString *errorMsg)
 {
   int len = 0;
@@ -391,69 +392,69 @@ static int doFetchStringSubstitutionKeyword(const char* input_string,
   if (input_string && *input_string == '(')
     {
       const char *cp = strchr(input_string, ')');
-      
+
       if (cp)
         {
           len = cp - input_string - 1;
-          
+
           if (len > 0)
             {
               char *key = g_strdup_printf("%s", input_string + 1);
               key[len] = '\0';
-              
+
               /*! \todo Ideally we'd allow the keyword to be a known column name in which case
-               * we'd need to add a check here. Needs a bit of code reorganisation to 
+               * we'd need to add a check here. Needs a bit of code reorganisation to
                * create the columnList before we parse & fetch sequences - currently the columnList
                * is only created when the window is created, i.e. after parsing & fetching is complete. */
-              
+
               /* See if it's a field in this match's source stanza */
               if (match_data->source)
                 {
                   GKeyFile *key_file = blxGetConfig();
-                  
+
                   if (key_file)
                     {
                       char *value = g_key_file_get_string(key_file, match_data->source, key, NULL);
-                      
+
                       if (value)
                         {
                           g_string_append(result, value);
                           ok = TRUE;
-                          
+
                           g_free(value);
                         }
                     }
                 }
-              
+
               g_free(key);
             }
-        }        
+        }
     }
 
   if (!ok)
     {
       if (!errorMsg)
         errorMsg = g_string_new("");
-     
+
       g_string_append_printf(errorMsg, "  Failed to process substitution string '%s'\n", input_string);
     }
-  
+
   return len;
 }
 
 
-/* Process the fetch string, substituting the special substitution characters 
+/* Process the fetch string, substituting the special substitution characters
  * for the actual data */
 static GString* doFetchStringSubstitutions(const char *command,
                                            MatchSequenceData *match_data,
                                            GError **error)
 {
   GString *result = g_string_new("");
-  
+
   /* Loop through the command and substitute any special chars with the relevant info  */
   GString *errorMsg = NULL;
   const char *c = command;
-      
+
   while (c && *c)
     {
       /* If it's preceded by the special char, substitute it for the real value */
@@ -461,7 +462,7 @@ static GString* doFetchStringSubstitutions(const char *command,
         {
           /* Move to the next char, which should tell us what type of substitution to make */
           ++c;
-          
+
           if (c && *c)
             {
               switch (*c) {
@@ -476,7 +477,7 @@ static GString* doFetchStringSubstitutions(const char *command,
                   int len = doFetchStringSubstitutionKeyword(c, match_data, result, errorMsg);
                   if (len > 0)
                     c += len + 2; /* progress past the len of the keyword plus the two brackets */
-                  else 
+                  else
                     ++c; /* failed; just increment past the current char */
                   break;
                 }
@@ -546,7 +547,7 @@ GString* doGetFetchCommand(const BlxFetchMethod* const fetchMethod,
         {
           /* Compile the command and args into a single string */
           char *command = NULL;
-      
+
           /* For http methods, append the args (i.e. the request) after a '?'.
            * For other methods, append the args after a space. */
           if (fetchMethod->location && fetchMethod->args && fetchMethodUsesHttp(fetchMethod))
@@ -559,9 +560,9 @@ GString* doGetFetchCommand(const BlxFetchMethod* const fetchMethod,
             command = g_strdup(fetchMethod->args);
           else
             return result;
-          
+
           result = doFetchStringSubstitutions(command, match_data, error);
-          
+
           /* Clean up */
           g_free(command);
         }
@@ -569,7 +570,7 @@ GString* doGetFetchCommand(const BlxFetchMethod* const fetchMethod,
 
   if (tmpError)
     g_propagate_error(error, tmpError);
-  
+
   return result;
 }
 
@@ -581,7 +582,7 @@ GString* getFetchArgsMultiple(const BlxFetchMethod* const fetchMethod, GList *se
   GList *seqItem = seqsToFetch;
 
   const char *separator = fetchMethod->separator ? fetchMethod->separator : " ";
-  
+
   for ( ; seqItem; seqItem = seqItem->next)
     {
       BlxSequence *blxSeq = (BlxSequence*)(seqItem->data);
@@ -592,17 +593,17 @@ GString* getFetchArgsMultiple(const BlxFetchMethod* const fetchMethod, GList *se
   GString *result = doGetFetchArgs(fetchMethod, &match_data, error);
 
   g_string_free(seq_string, TRUE);
-  
+
   return result;
 }
 
 
 /* Get the command to call for the given fetch method. Parses
  * the command and arguments and substitutes the following
- * characters with values from the given sequence/msp. Note that 
+ * characters with values from the given sequence/msp. Note that
  * either blxSeq or msp must be given, but not both. '%%' is used
  * to represent a normal '%' character.
- * 
+ *
  *   %p:      program name
  *   %h:      host name
  *   %u:      user name
@@ -614,7 +615,7 @@ GString* getFetchArgsMultiple(const BlxFetchMethod* const fetchMethod, GList *se
  *   %S:      feature source
  *   %f:      file name
  *   %g:      supported GFF version
- * 
+ *
  * Returns the command and args compiled into a single string.
  * The caller must free the result with g_string_free.
  * Returns an empty string if the command/args are empty.
@@ -637,7 +638,7 @@ GString* getFetchCommand(const BlxFetchMethod* const fetchMethod,
   const char *name = blxSequenceGetName(blxSeq);
   if (!name) name = mspGetSName(msp);
   if (!name) name = "";
-  
+
   const char *source = blxSeq ? blxSequenceGetSource(blxSeq) : NULL;
   const char *filename = msp && msp->filename ? g_quark_to_string(msp->filename) : NULL;
   int startCoord = msp ? mspGetQStart(msp) : blxSequenceGetStart(blxSeq, blxSeq->strand);
@@ -650,7 +651,7 @@ GString* getFetchCommand(const BlxFetchMethod* const fetchMethod,
   /* Do the substitutions */
   MatchSequenceData match_data = {name, refSeqName, startCoord, endCoord, dataset, source, filename};
   GString *result = doGetFetchCommand(fetchMethod, &match_data, error);
-  
+
   return result;
 }
 
@@ -684,7 +685,7 @@ GString* getFetchArgs(const BlxFetchMethod* const fetchMethod,
       if (!name) name = mspGetSName(msp);
       if (!name) name = "";
     }
-  
+
   const char *source = blxSeq ? blxSequenceGetSource(blxSeq) : NULL;
   const char *filename = msp && msp->filename ? g_quark_to_string(msp->filename) : NULL;
   int startCoord = blxSeq ? blxSequenceGetStart(blxSeq, blxSeq->strand) : mspGetQStart(msp);
@@ -697,7 +698,7 @@ GString* getFetchArgs(const BlxFetchMethod* const fetchMethod,
   /* Do the substitutions */
   MatchSequenceData match_data = {name, refSeqName, startCoord, endCoord, dataset, source, filename};
   GString *result = doGetFetchArgs(fetchMethod, &match_data, error);
-  
+
   return result;
 }
 
@@ -712,19 +713,19 @@ static gboolean stringInArray(const char *str, GArray *array)
     {
       const int len1 = strlen(str);
       int i = 0;
-      
+
       for ( ; !found && i < (int)array->len; ++i)
         {
           GQuark curQuark = g_array_index(array, GQuark, i);
           const char *curStr = g_quark_to_string(curQuark);
-          
+
           int len = min((int)strlen(curStr), len1);
-          
+
           if (strncasecmp(curStr, str, len) == 0)
             found = TRUE;
         }
     }
-  
+
   return found;
 }
 
@@ -734,13 +735,13 @@ static void checkFetchMethodNonNull(const BlxFetchMethod* const fetchMethod, GEr
 {
   if (!fetchMethod)
     {
-      g_set_error(error, BLX_CONFIG_ERROR, BLX_CONFIG_ERROR_INVALID_FETCH_METHOD, 
+      g_set_error(error, BLX_CONFIG_ERROR, BLX_CONFIG_ERROR_INVALID_FETCH_METHOD,
                   "Program error: fetch method is null\n");
     }
 }
 
 
-/* Check that the given fetch method's executable is in the path; set 
+/* Check that the given fetch method's executable is in the path; set
  * the error if not */
 static void checkFetchMethodExecutable(const BlxFetchMethod* const fetchMethod, GError **error)
 {
@@ -752,23 +753,23 @@ static void checkFetchMethodExecutable(const BlxFetchMethod* const fetchMethod,
       if (!fetchMethod->location || !g_find_program_in_path(fetchMethod->location))
         {
           g_set_error(error, BLX_CONFIG_ERROR, BLX_CONFIG_ERROR_NO_EXE,
-                      "[%s]: Executable '%s' not found in path: %s\n", 
+                      "[%s]: Executable '%s' not found in path: %s\n",
                       g_quark_to_string(fetchMethod->name), fetchMethod->location, getenv("PATH"));
         }
     }
 }
 
 
-#ifdef PFETCH_HTML 
+#ifdef PFETCH_HTML
 // Fetch the given list of sequences from an http proxy server. This enables
-// blixem to be run and get sequences from anywhere that can see the http 
+// blixem to be run and get sequences from anywhere that can see the http
 // proxy server
 //
-// NOTE, this function blocks until the sequences have been fetched which 
+// NOTE, this function blocks until the sequences have been fetched which
 // means fetch_data can be on the stack and that we can clear up at the end
 // of this function instead of some callback routine.
-// 
-gboolean BulkFetch::httpFetchList(GList *seqsToFetch, 
+//
+gboolean BulkFetch::httpFetchList(GList *seqsToFetch,
                                   const BlxFetchMethod* const fetchMethod,
                                   GError **error)
 {
@@ -804,10 +805,10 @@ gboolean BulkFetch::httpFetchList(GList *seqsToFetch,
 
 
   // progress bar is popped up to give user feedback that something is happening.
-  fetch_data.fetchData.bar = makeProgressBar(fetch_data.fetchData.numRequested, fetchMethod->mode) ;  
+  fetch_data.fetchData.bar = makeProgressBar(fetch_data.fetchData.numRequested, fetchMethod->mode) ;
   g_signal_connect(G_OBJECT(fetch_data.fetchData.bar->top_level), "destroy",
                    G_CALLBACK(sequence_dialog_closed), &fetch_data) ;
-  
+
   // Make the pfetch object, pipe or html.
   if (fetchMethod->mode == BLXFETCH_MODE_PIPE)
     {
@@ -848,16 +849,16 @@ gboolean BulkFetch::httpFetchList(GList *seqsToFetch,
             }
 
           status = fetch_data.fetchData.status ;
-      
+
           if (!status)
             {
               if (fetch_data.fetchData.parserState != PARSING_CANCELLED)
                 {
                   g_critical("Sequence fetch from http server failed: %s\n",
                              (fetch_data.err_txt ? fetch_data.err_txt : "no error")) ;
-                  
+
                   if (fetch_data.err_txt)
-                    { 
+                    {
                       g_free(fetch_data.err_txt) ;
                     }
                 }
@@ -890,7 +891,7 @@ gboolean BulkFetch::httpFetchList(GList *seqsToFetch,
 
   delete fetch_data.pfetch ;
 
-  
+
   return status ;
 }
 #endif
@@ -900,7 +901,7 @@ gboolean BulkFetch::httpFetchList(GList *seqsToFetch,
 
 
 /* Fetch a list of sequences using sockets.
- * 
+ *
  * adapted from Tony Cox's code pfetch.c
  *
  *  - this version incorporates a progress monitor as a window,
@@ -908,10 +909,10 @@ gboolean BulkFetch::httpFetchList(GList *seqsToFetch,
  *  - can be called after the fasta sequence data is already populated:
  *    in that case it will ignore the sequence data and just populate
  *    the additional data.
- *  - sequence data will also be ignored for sequences that do not 
+ *  - sequence data will also be ignored for sequences that do not
  *    require sequence data
  */
-gboolean BulkFetch::socketFetchList(GList *seqsToFetch, 
+gboolean BulkFetch::socketFetchList(GList *seqsToFetch,
                                     const BlxFetchMethod* const fetchMethod,
                                     GError **error)
 {
@@ -929,7 +930,7 @@ gboolean BulkFetch::socketFetchList(GList *seqsToFetch,
   fetchData.seqType = seqType,
   fetchData.status = (tmpError == NULL);
 
-  /* Get the sequences back. They will be returned in the same order that we asked for them, i.e. 
+  /* Get the sequences back. They will be returned in the same order that we asked for them, i.e.
    * in the order they are in our list. */
   fetchData.currentSeqItem = seqsToFetch;
   fetchData.currentSeq = (BlxSequence*)(fetchData.currentSeqItem->data);
@@ -949,19 +950,19 @@ gboolean BulkFetch::socketFetchList(GList *seqsToFetch,
       fetchData.sectionId[2] = '\0';
       fetchData.tagName = g_string_new("");
       fetchData.currentResult = g_string_new("");
-      fetchData.foundEndQuote = FALSE;      
-     
+      fetchData.foundEndQuote = FALSE;
+
       while (fetchData.status &&
              !tmpError &&
-             fetchData.parserState != PARSING_CANCELLED && 
+             fetchData.parserState != PARSING_CANCELLED &&
              fetchData.parserState != PARSING_FINISHED)
         {
           /* Receive and parse the next buffer */
           checkProgressBar(fetchData.bar, &fetchData.parserState, &fetchData.status);
           fetchData.lenReceived = socketFetchReceiveBuffer(&fetchData, RCVBUFSIZE, sock);
-          
+
           if (fetchMethod->outputType == BLXFETCH_OUTPUT_EMBL)
-            {              
+            {
               parseEmblBuffer(&fetchData, &tmpError);
             }
           else if (fetchMethod->outputType == BLXFETCH_OUTPUT_RAW)
@@ -970,18 +971,18 @@ gboolean BulkFetch::socketFetchList(GList *seqsToFetch,
             }
           else
             {
-              g_set_error(error, BLX_ERROR, 1, "Invalid output format for fetch method %s (expected '%s' or '%s')\n", 
+              g_set_error(error, BLX_ERROR, 1, "Invalid output format for fetch method %s (expected '%s' or '%s')\n",
                           g_quark_to_string(fetchMethod->name),
                           outputTypeStr(BLXFETCH_OUTPUT_RAW),
                           outputTypeStr(BLXFETCH_OUTPUT_EMBL));
             }
         }
-      
+
       /* Finish up */
       shutdown(sock, SHUT_RDWR);
       destroyProgressBar(fetchData.bar);
       fetchData.bar = NULL ;
-      
+
       if (fetchData.tagName)
         g_string_free(fetchData.tagName, TRUE);
 
@@ -1014,7 +1015,7 @@ gboolean BulkFetch::socketFetchList(GList *seqsToFetch,
 
 
 /* Get the contents of the given config file. Returns the contents in
- * a string which must be freed by the caller. Optionally return the 
+ * a string which must be freed by the caller. Optionally return the
  * length of the string. */
 static gchar* getConfigFileContent(const char *config_file, gsize *len)
 {
@@ -1023,10 +1024,10 @@ static gchar* getConfigFileContent(const char *config_file, gsize *len)
   if (g_file_test(config_file, G_FILE_TEST_EXISTS))
     {
       GKeyFile *keyFile = g_key_file_new();
-      
+
       if (g_key_file_load_from_file(keyFile, config_file, G_KEY_FILE_NONE, NULL))
         content = g_key_file_to_data(keyFile, len, NULL);
-      
+
       g_key_file_free(keyFile);
     }
 
@@ -1036,7 +1037,7 @@ static gchar* getConfigFileContent(const char *config_file, gsize *len)
 
 
 /* Set/Get global config, necessary because we don't have some blixem context pointer....
- * To do: we do have a context now, so this should be moved to there. 
+ * To do: we do have a context now, so this should be moved to there.
  * Sets the error if there were any problems. Note that the error is not set if the
  * config file does not exist or is empty  */
 void blxInitConfig(const char *config_file, CommandLineOptions *options, GError **error)
@@ -1069,7 +1070,7 @@ void blxInitConfig(const char *config_file, CommandLineOptions *options, GError
       len = len1 + len2 + 2; /* need 2 extra chars for the sprintf below (newline and terminating nul) */
       content = (gchar*)g_malloc(len);
       sprintf(content, "%s\n%s", content1, content2);
-      
+
       /* Free the original strings */
       g_free(content1);
       g_free(content2);
@@ -1085,7 +1086,7 @@ void blxInitConfig(const char *config_file, CommandLineOptions *options, GError
       content = content2;
     }
 
-  /* Now load the content into the key file, if we have any */  
+  /* Now load the content into the key file, if we have any */
   if (content)
     {
       if (g_key_file_load_from_data(key_file, content, len, G_KEY_FILE_NONE, NULL))
@@ -1115,7 +1116,7 @@ GKeyFile *blxGetConfig(void)
 }
 
 
-/* 
+/*
  *                        Internal functions.
  */
 
@@ -1139,14 +1140,14 @@ static int socketConstruct(const char *ipAddress, int port, gboolean External, G
   /* Construct the server address structure */
   servAddr = new struct sockaddr_in;
   hp = gethostbyname(ipAddress) ;
-  
+
   if (!hp)
     {
       g_set_error(error, BLX_FETCH_ERROR, BLX_FETCH_ERROR_HOST,
                   "Unknown host \"%s\"\n", ipAddress);
       return -1;
     }
-  
+
   servAddr->sin_family = AF_INET ;                          /* Internet address family */
   bcopy((char*)hp->h_addr, (char*) &(servAddr->sin_addr.s_addr), hp->h_length) ;
                                                             /* Server IP address */
@@ -1156,7 +1157,7 @@ static int socketConstruct(const char *ipAddress, int port, gboolean External, G
   /* Establish the connection to the server */
   if (connect(sock, (struct sockaddr *) servAddr, sizeof(struct sockaddr_in)) < 0)
     {
-      g_set_error(error, BLX_FETCH_ERROR, BLX_FETCH_ERROR_CONNECT, 
+      g_set_error(error, BLX_FETCH_ERROR, BLX_FETCH_ERROR_CONNECT,
                   "Error connecting socket to host '%s'\n", ipAddress) ;
       sock = -1 ;
     }
@@ -1225,7 +1226,7 @@ static void socketSend (int sock, const char *text, GError **error)
 
 
 
-#ifdef PFETCH_HTML 
+#ifdef PFETCH_HTML
 
 // Callbacks for user-triggered single pfetch - called from UserFetch::httpFetchSequence()
 //
@@ -1339,7 +1340,7 @@ static bool sequence_pfetch_reader(char *text, guint *actual_read, char **error,
   PFetchSequence fetch_data = (PFetchSequence)user_data ;
   ProgressBar bar = fetch_data->fetchData.bar ;
 
-  if (fetch_data->fetchData.parserState != PARSING_FINISHED && 
+  if (fetch_data->fetchData.parserState != PARSING_FINISHED &&
       fetch_data->fetchData.parserState != PARSING_CANCELLED)
     {
       if (!(*text) || *actual_read <= 0)
@@ -1356,7 +1357,7 @@ static bool sequence_pfetch_reader(char *text, guint *actual_read, char **error,
             {
               fetch_data->fetchData.status = FALSE ;
               fetch_data->fetchData.parserState = PARSING_CANCELLED ;
-      
+
               status = false ;
             }
           else if (!parsePfetchHtmlBuffer(fetch_data->fetchData.fetchMethod, text, *actual_read, fetch_data))
@@ -1441,7 +1442,7 @@ static void pfetchHtmlRecordStats(const char *read_text, const int length, PFetc
       fetch_data->total_bytes += length ;
 
       fetch_data->total_reads++ ;
-  
+
       if (length < 100)
         {
           char *str ;
@@ -1473,9 +1474,9 @@ static gboolean parsePfetchHtmlBuffer(const BlxFetchMethod* const fetchMethod,
   /* Validate input and record stats, if requested */
   g_assert(fetch_data && fetch_data->fetchData.currentSeqItem && fetch_data->fetchData.currentSeqItem->data);
   pfetchHtmlRecordStats(read_text, length, fetch_data);
-  
+
   GError *error = NULL;
-  
+
   fetch_data->fetchData.buffer = read_text;
   fetch_data->fetchData.lenReceived = length;
 
@@ -1489,24 +1490,24 @@ static gboolean parsePfetchHtmlBuffer(const BlxFetchMethod* const fetchMethod,
       /* The fetched entries just contain the FASTA sequence */
       parseRawSequenceBuffer(&fetch_data->fetchData, &error);
     }
-  else 
+  else
     {
-      g_set_error(&error, BLX_CONFIG_ERROR, BLX_CONFIG_ERROR_INVALID_OUTPUT_FORMAT, 
+      g_set_error(&error, BLX_CONFIG_ERROR, BLX_CONFIG_ERROR_INVALID_OUTPUT_FORMAT,
                   "Invalid output format specified for fetch method '%s'; expected '%s' or '%s'\n",
-                  g_quark_to_string(fetch_data->fetchData.fetchMethod->name), 
-                  outputTypeStr(BLXFETCH_OUTPUT_EMBL), 
+                  g_quark_to_string(fetch_data->fetchData.fetchMethod->name),
+                  outputTypeStr(BLXFETCH_OUTPUT_EMBL),
                   outputTypeStr(BLXFETCH_OUTPUT_RAW));
     }
-  
+
   if (error)
     {
       fetch_data->err_txt = g_strdup(error->message);
       g_error_free(error);
       error = NULL;
     }
-  
+
   status = fetch_data->fetchData.status ;
-  
+
   return status;
 }
 
@@ -1526,7 +1527,7 @@ static ProgressBar makeProgressBar(int seq_total, const BlxFetchMode fetch_mode)
   bar->cancelled = FALSE;
   bar->widget_destroy_handler_id = 0;
   bar->fetch_mode = fetch_mode;
-  
+
   gdk_color_parse("blue", &(bar->blue_bar_fg)) ;
   gdk_color_parse("red", &(bar->red_bar_fg)) ;
 
@@ -1545,7 +1546,7 @@ static ProgressBar makeProgressBar(int seq_total, const BlxFetchMode fetch_mode)
   GtkWidget *vbox = gtk_vbox_new(FALSE, 5) ;
   gtk_container_add(GTK_CONTAINER(frame), vbox) ;
 
-  bar->progress = gtk_progress_bar_new() ; 
+  bar->progress = gtk_progress_bar_new() ;
 
   gtk_widget_modify_fg(bar->progress, GTK_STATE_NORMAL, &(bar->blue_bar_fg)) ;
 
@@ -1571,7 +1572,7 @@ static ProgressBar makeProgressBar(int seq_total, const BlxFetchMode fetch_mode)
     gtk_widget_set_tooltip_text(cancel_button, "Cancel the current operation and continue to start up the program");
 
   gtk_widget_show_all(bar->top_level) ;
-  
+
   while (gtk_events_pending())
     {
       gtk_main_iteration() ;
@@ -1592,7 +1593,7 @@ static void updateProgressBar(ProgressBar bar, const char *sequence, int numFetc
   label_text = g_strdup_printf("%s - %s", sequence, fetch_ok ? "Fetched" : "Not found") ;
   gtk_label_set_text(GTK_LABEL(bar->label), label_text) ;
   g_free(label_text) ;
-  
+
   gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(bar->progress),
                                 (double)((double)numFetched / (double)(bar->seq_total))) ;
 
@@ -1612,7 +1613,7 @@ static gboolean isCancelledProgressBar(ProgressBar bar)
 static void destroyProgressBar(ProgressBar bar)
 {
   gtk_widget_destroy(bar->top_level) ;
-  
+
   return ;
 }
 
@@ -1657,13 +1658,13 @@ static void cancelCB(GtkWidget *widget, gpointer cb_data)
 
 
 
-/* 
+/*
  *            Configuration file reading.
  */
 
 /* Get default blixem options from the "blixem" stanza */
 static void readBlixemStanza(GKeyFile *key_file,
-                             const char *group, 
+                             const char *group,
                              CommandLineOptions *options,
                              GError **error)
 {
@@ -1697,7 +1698,7 @@ static void readBlixemStanza(GKeyFile *key_file,
       GError *tmpError = NULL;
       const char *key = mspFlagGetConfigKey((MspFlag)flag);
       gboolean value = g_key_file_get_boolean(key_file, group, key, &tmpError);
-      
+
       /* If found, set it as the default */
       if (!tmpError)
         mspFlagSetDefault((MspFlag)flag, value);
@@ -1719,7 +1720,7 @@ static BlxFetchOutputType readFetchOutputType(GKeyFile *key_file, const char *gr
     {
       /* Loop through all output types looking for one with this name */
       int outputType = 0;
-      
+
       for ( ; outputType < BLXFETCH_NUM_OUTPUT_TYPES; ++outputType)
         {
           if (stringsEqual(outputTypeName, outputTypeStr((BlxFetchOutputType)outputType), FALSE))
@@ -1728,19 +1729,19 @@ static BlxFetchOutputType readFetchOutputType(GKeyFile *key_file, const char *gr
               break;
             }
         }
-      
+
       if (result == BLXFETCH_OUTPUT_INVALID)
         {
           g_set_error(&tmpError, BLX_CONFIG_ERROR, BLX_CONFIG_ERROR_INVALID_OUTPUT_FORMAT,
                       "Invalid output type '%s' for fetch method '%s'", outputTypeName, group);
         }
     }
-  
+
   if (tmpError && error && *error)
     postfixError(*error, "; %s", tmpError->message);
   else if (tmpError)
     g_propagate_error(error, tmpError);
- 
+
   g_free(outputTypeName);
 
   return result;
@@ -1752,7 +1753,7 @@ static BlxFetchOutputType readFetchOutputType(GKeyFile *key_file, const char *gr
 static char* configGetString(GKeyFile *key_file, const char *group, const char *key, GError **error)
 {
   GError *tmpError = NULL;
-  
+
   char *result = g_key_file_get_string(key_file, group, key, &tmpError);
 
   if (result)
@@ -1763,7 +1764,7 @@ static char* configGetString(GKeyFile *key_file, const char *group, const char *
       /* remove any delimiters */
       result = removeDelimiters(result);
     }
-  
+
   if (tmpError && error && *error)
     postfixError(*error, "; %s", tmpError->message);
   else if (tmpError)
@@ -1828,14 +1829,14 @@ static long configGetIpresolve(GKeyFile *key_file, const char *group, const char
 
   return result;
 }
-#endif 
+#endif
 
 
-/* Get details about the given fetch method stanza and add it to 
+/* Get details about the given fetch method stanza and add it to
  * the list of fetch methods in 'options' */
-static void readFetchMethodStanza(GKeyFile *key_file, 
-                                  const char *group, 
-                                  CommandLineOptions *options, 
+static void readFetchMethodStanza(GKeyFile *key_file,
+                                  const char *group,
+                                  CommandLineOptions *options,
                                   GError **error)
 {
   BlxFetchMethod *result = NULL;
@@ -1900,7 +1901,7 @@ static void readFetchMethodStanza(GKeyFile *key_file,
           result->args = configGetString(key_file, group, DB_FETCH_QUERY, &tmpError);
           result->errors = keyFileGetCsv(key_file, group, FETCH_ERRORS, NULL);
           result->outputType = readFetchOutputType(key_file, group, &tmpError);
-          
+
           /* Hard code the separator */
           result->separator = g_strdup("','");
         }
@@ -1922,7 +1923,7 @@ static void readFetchMethodStanza(GKeyFile *key_file,
           result->mode = BLXFETCH_MODE_NONE;
         }
     }
-  
+
   /* Add result to list */
   if (!tmpError && result)
     {
@@ -1934,7 +1935,7 @@ static void readFetchMethodStanza(GKeyFile *key_file,
       /* Fetch method details are incomplete, so delete it. */
       delete result;
     }
-  
+
   /* Clean up */
   g_free(fetchMode);
 
@@ -1944,7 +1945,7 @@ static void readFetchMethodStanza(GKeyFile *key_file,
 }
 
 
-/* Tries to load values for this group if it is a standard, recognised group or 
+/* Tries to load values for this group if it is a standard, recognised group or
  * group type. If any required values are missing, sets the error. */
 static void readConfigGroup(GKeyFile *key_file, const char *group, CommandLineOptions *options, GError **error)
 {
@@ -1957,7 +1958,7 @@ static void readConfigGroup(GKeyFile *key_file, const char *group, CommandLineOp
     {
       /* Check if this is a fetch method; if it is it the group will have a fetch-mode key */
       char *fetchMode = configGetString(key_file, group, FETCH_MODE_KEY, NULL);
-      
+
       if (fetchMode)
         readFetchMethodStanza(key_file, group, options, error);
 
@@ -1977,13 +1978,13 @@ static void readConfigFile(GKeyFile *key_file, CommandLineOptions *options, GErr
   char **groups = g_key_file_get_groups(key_file, (gsize*)(&num_groups));
   char **group = groups;
   int i = 0;
-  
+
   for ( ; i < (int)num_groups ; i++, group++)
     {
       /* Read in the data in this stanza */
       GError *tmpError = NULL;
       readConfigGroup(key_file, *group, options, &tmpError) ;
-      
+
       if (tmpError && error)
         {
           /* Compile all errors into one message */
@@ -1993,7 +1994,7 @@ static void readConfigFile(GKeyFile *key_file, CommandLineOptions *options, GErr
             postfixError(*error, "  [%s]: %s\n", *group, tmpError->message);
         }
     }
-  
+
   /* For backwards compatibility with config files that do not set the optional-fetch
    * field: If the default optional-fetch method is not set then find any fetch methods that
    * have an output type of 'embl'. gb10: we may wish to remove this once we no longer have these
@@ -2027,11 +2028,11 @@ static void readConfigFile(GKeyFile *key_file, CommandLineOptions *options, GErr
  *******************************************************************/
 
 
-/* Initialise a pfetch connection with the given options and calls pfetch on each of the 
+/* Initialise a pfetch connection with the given options and calls pfetch on each of the
  * sequences in the given list. */
 static void socketFetchInit(const BlxFetchMethod* const fetchMethod,
-                            GList *seqsToFetch, 
-                            gboolean External, 
+                            GList *seqsToFetch,
+                            gboolean External,
                             int *sock,
                             GError **error)
 {
@@ -2042,29 +2043,29 @@ static void socketFetchInit(const BlxFetchMethod* const fetchMethod,
     {
       *sock = socketConstruct(fetchMethod->node, fetchMethod->port, External, &tmpError) ;
     }
-  
+
   /* send the command/names to the server */
   if (!tmpError)
     {
       GString *command = getFetchArgsMultiple(fetchMethod, seqsToFetch, &tmpError);
       socketSend(*sock, command->str, &tmpError);
-      
+
       if (command)
         g_string_free(command, TRUE);
     }
-  
+
 //  if (!tmpError)
 //    {
 //      /* For each sequence, send a command to fetch that sequence, in the order that they are in our list */
 //      GList *seqItem = seqsToFetch;
-//      
+//
 //      for ( ; seqItem && !tmpError ; seqItem = seqItem->next)
 //        {
 //          BlxSequence *blxSeq = (BlxSequence*)(seqItem->data);
 //          socketSend(*sock, blxSequenceGetName(blxSeq), &tmpError);
 //        }
 //    }
-  
+
   if (!tmpError)
     {
       /* send a final newline to flush the socket */
@@ -2098,15 +2099,15 @@ static void checkProgressBar(ProgressBar bar, BlxSeqParserState *parserState, gb
 static int socketFetchReceiveBuffer(GeneralFetchData fetchData, const int bufferSize, const int sock)
 {
   int lenReceived = 0;
-  
+
   if (fetchData->status == FALSE)
     {
       return lenReceived;
     }
-  
+
   /* Ask for the next chunk of data to be put into our buffer */
   lenReceived = recv(sock, fetchData->buffer, bufferSize, 0);
-  
+
   if (lenReceived < 0)
     {
       /* Problem with this one - skip to the next */
@@ -2120,7 +2121,7 @@ static int socketFetchReceiveBuffer(GeneralFetchData fetchData, const int buffer
       /* No more data, so quit out of the loop */
       fetchData->parserState = PARSING_FINISHED;
     }
-  
+
   return lenReceived;
 }
 
@@ -2136,7 +2137,7 @@ static void pfetchGetNextSequence(GeneralFetchData fetchData, const gboolean pfe
       if (fetchData->currentSeqItem->next)
         {
           updateProgressBar(fetchData->bar, blxSequenceGetName(fetchData->currentSeq), fetchData->numFetched, pfetch_ok) ;
-          
+
           /* Move to the next BlxSequence */
           fetchData->currentSeqItem = fetchData->currentSeqItem->next;
           fetchData->currentSeq = (BlxSequence*)(fetchData->currentSeqItem->data);
@@ -2151,8 +2152,8 @@ static void pfetchGetNextSequence(GeneralFetchData fetchData, const gboolean pfe
 
 
 /* Parse the given buffer that contains an arbitrary section
- * of data from a fasta file (or concatenation of multiple 
- * fasta files). The parserState indicates on entry what 
+ * of data from a fasta file (or concatenation of multiple
+ * fasta files). The parserState indicates on entry what
  * state we are in and is updated on exit with the new state,
  * if it has changed. */
 static void parseRawSequenceBuffer(GeneralFetchData fetchData, GError **error)
@@ -2161,22 +2162,22 @@ static void parseRawSequenceBuffer(GeneralFetchData fetchData, GError **error)
     {
       return;
     }
-  
+
   /* Loop through each character in the buffer */
   int i = 0;
-  
+
   for ( ; i < fetchData->lenReceived && fetchData->status; ++i)
     {
       /* Check for user cancellation again */
       checkProgressBar(fetchData->bar, &fetchData->parserState, &fetchData->status);
-      
+
       if (fetchData->parserState == PARSING_CANCELLED)
         {
           break;
         }
 
       const char curChar = fetchData->buffer[i];
-      
+
       if (curChar == '\n')
         {
           /* finish up this sequence and move to the next one */
@@ -2197,7 +2198,7 @@ static void parseRawSequenceBuffer(GeneralFetchData fetchData, GError **error)
 static gboolean isEmblTerminator(GQuark value)
 {
   static GQuark terminator = 0;
-  
+
   if (!terminator)
     terminator = g_quark_from_string("//");
 
@@ -2210,7 +2211,7 @@ static void pfetchGetParserStateFromId(GeneralFetchData fetchData)
 {
   GQuark sectionId = g_quark_from_string(fetchData->sectionId);
 
-  /* First, check if the section id is the terminator string, in 
+  /* First, check if the section id is the terminator string, in
    * which case finish this sequence */
   if (isEmblTerminator(sectionId))
     {
@@ -2219,15 +2220,15 @@ static void pfetchGetParserStateFromId(GeneralFetchData fetchData)
     }
 
   /* Loop through all the columns and check if there's a column with
-   * an embl ID that matches the current section ID. If not, then there's 
+   * an embl ID that matches the current section ID. If not, then there's
    * nothing to do for this tag (so default to parsing_ignore if not found) */
   GList *item = fetchData->columnList;
   fetchData->parserState = PARSING_IGNORE;
-  
+
   for ( ; item; item = item->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)(item->data);
-      
+
       if (columnInfo->emblId && columnInfo->emblId == sectionId)
         {
           /* First, check if we need to bother getting the info for this column */
@@ -2239,7 +2240,7 @@ static void pfetchGetParserStateFromId(GeneralFetchData fetchData)
                   /* The column has an embl tag; continue parsing to find the
                    * tag. (Note that multiple columns may have this section ID so
                    * the next step may end up finding a different column depending
-                   * on the embl tag; at this point, we're just finding out if any 
+                   * on the embl tag; at this point, we're just finding out if any
                    * column has an embl tag that we need to continue parsing for,
                    * so we don't set the currentColumn yet). */
                   fetchData->parserState = PARSING_TAG_SEARCH;
@@ -2278,7 +2279,7 @@ static void pfetchProcessEmblBufferChar(GeneralFetchData fetchData, const char c
         fetchData->parserState = PARSING_ID;
         break;
       }
-        
+
       case PARSING_ID:
       {
         /* Read the second (and last) character from the ID. */
@@ -2286,7 +2287,7 @@ static void pfetchProcessEmblBufferChar(GeneralFetchData fetchData, const char c
         pfetchGetParserStateFromId(fetchData);
         break;
       }
-        
+
       case PARSING_SEQUENCE:
       {
         /* Look out for the terminating "//" characters. We ignore newlines in the sequence
@@ -2306,54 +2307,54 @@ static void pfetchProcessEmblBufferChar(GeneralFetchData fetchData, const char c
                 appendCharToString(curChar, fetchData->currentResult);
               }
           }
-        
+
         break;
       }
-        
+
       case PARSING_DATA:
       {
         appendCharToString(curChar, fetchData->currentResult);
         break;
       }
-        
+
       case PARSING_TAG_SEARCH:
       {
         /* If we find a forward slash, it's the start of a tag, so we'll parse the tag name next */
         if (curChar == '/')
           fetchData->parserState = PARSING_TAG_NAME;
-        
+
         break;
       }
-        
+
       case PARSING_TAG_NAME:
       {
         if (curChar == '=') /* signals the end of the tag */
           pfetchGetParserStateFromTagName(fetchData);
         else
           g_string_append_c(fetchData->tagName, curChar); /* read in tag name */
-        
+
         break;
       }
-        
+
       case PARSING_TAG_IGNORE:
       {
         /* Look for the start quote before we start parsing the tag properly */
         if (curChar == '"')
           pfetchGetParserStateFromTagName(fetchData);
-        
+
         break;
       }
-        
+
       case PARSING_DATA_QUOTED:
       {
         /* Like PARSING_DATA but we need to watch out for end quotes */
         appendCharToQuotedString(curChar, &fetchData->foundEndQuote, fetchData->currentResult);
         break;
       }
-        
+
       default:
         break;
-        
+
     };
 }
 
@@ -2361,15 +2362,15 @@ static void pfetchProcessEmblBufferChar(GeneralFetchData fetchData, const char c
 static void checkParserState(GeneralFetchData fetchData, BlxSeqParserState origState)
 {
   /* If we were parsing data for a column but the parser state has now changed to
-   * something else, then we've finished parsing the string, so save it in the 
+   * something else, then we've finished parsing the string, so save it in the
    * sequence */
   if (fetchData->parserState != origState && fetchData->currentResult->str)
     {
       if (origState == PARSING_DATA || origState == PARSING_DATA_QUOTED)
         {
-          blxSequenceSetValueFromString(fetchData->currentSeq, 
-                                        fetchData->currentColumn->columnId, 
-                                        fetchData->currentResult->str); 
+          blxSequenceSetValueFromString(fetchData->currentSeq,
+                                        fetchData->currentColumn->columnId,
+                                        fetchData->currentResult->str);
 
           /* Reset the result string and current column */
           g_string_truncate(fetchData->currentResult, 0);
@@ -2393,8 +2394,8 @@ static void checkParserState(GeneralFetchData fetchData, BlxSeqParserState origS
  * updated with the new state on exit. */
 static void parseEmblBuffer(GeneralFetchData fetchData, GError **error)
 {
-  if (fetchData->status == FALSE || 
-      fetchData->parserState == PARSING_FINISHED || 
+  if (fetchData->status == FALSE ||
+      fetchData->parserState == PARSING_FINISHED ||
       fetchData->parserState == PARSING_CANCELLED)
     {
       return;
@@ -2402,7 +2403,7 @@ static void parseEmblBuffer(GeneralFetchData fetchData, GError **error)
 
   /* Loop through each character in the buffer */
   int i = 0;
-  
+
   for ( ; i < fetchData->lenReceived && fetchData->status; ++i)
     {
       checkProgressBar(fetchData->bar, &fetchData->parserState, &fetchData->status);
@@ -2428,7 +2429,7 @@ static void parseEmblBuffer(GeneralFetchData fetchData, GError **error)
           fetchData->foundEndQuote = FALSE;
           fetchData->parserState = PARSING_TAG_SEARCH;
         }
-      
+
 
       /* Newline character means we need to re-read the 2-letter ID at the start of the
        * line to find out what section we're in. Ignore newlines in the sequence body, though,
@@ -2464,7 +2465,7 @@ static void parseEmblBuffer(GeneralFetchData fetchData, GError **error)
 
 
 /* Check the given tag name to see if it contains data for a column we're interested
- * in, and update the parser state accordingly. Sets the parser state to PARSING_IGNORE 
+ * in, and update the parser state accordingly. Sets the parser state to PARSING_IGNORE
  * if this is not a tag we care about. */
 static void pfetchGetParserStateFromTagName(GeneralFetchData fetchData)
 {
@@ -2487,7 +2488,7 @@ static void pfetchGetParserStateFromTagName(GeneralFetchData fetchData)
       if (currentSection == foundSection && currentTag == foundTag)
         {
           fetchData->currentColumn = columnInfo;
-          
+
           if (fetchData->parserState == PARSING_TAG_NAME)
             {
               /* Start parsing the data within the tag but initially ignore
@@ -2496,7 +2497,7 @@ static void pfetchGetParserStateFromTagName(GeneralFetchData fetchData)
             }
           else
             {
-              /* Should only get here if we found a quoted section. Start 
+              /* Should only get here if we found a quoted section. Start
                * parsing the actual data for the current column. */
               fetchData->parserState = PARSING_DATA_QUOTED;
             }
@@ -2525,7 +2526,7 @@ static void appendCharToQuotedString(const char curChar, gboolean *foundEndQuote
     {
       if (*foundEndQuote)
         {
-          /* The previous char was also a quote, which means this is an 
+          /* The previous char was also a quote, which means this is an
            * escaped quote, so we do include the char in the text. */
           appendCharToString(curChar, result);
           *foundEndQuote = FALSE;
@@ -2544,7 +2545,7 @@ static void appendCharToQuotedString(const char curChar, gboolean *foundEndQuote
 
 
 /* Append the given char to the given GString. Doesn't
- * add whitespace chars to the start of the string. Also 
+ * add whitespace chars to the start of the string. Also
  * filters out multiple whitespace chars. */
 static void appendCharToString(const char curChar, GString *result)
 {
@@ -2575,24 +2576,24 @@ static gboolean pfetchFinishSequence(GeneralFetchData fetchData)
   const int maxWarnings = 50;
 
   fetchData->numFetched += 1;
-  
+
   if (fetchData->numFetched >= fetchData->numRequested)
     {
       /* We've fetched all of the sequences we requested. */
       fetchData->parserState = PARSING_FINISHED;
     }
-  
+
   /* The pfetch failed if our sequence is null or equal to an error string. */
   gboolean pfetch_ok = FALSE;
-  
-  /* If the sequence isn't required, or is already set, then we don't need 
+
+  /* If the sequence isn't required, or is already set, then we don't need
    * to check if it was fetched */
   if (!blxSequenceRequiresColumnData(fetchData->currentSeq, BLXCOL_SEQUENCE) ||
       blxSequenceGetValueAsString(fetchData->currentSeq, BLXCOL_SEQUENCE))
     {
       pfetch_ok = TRUE;
     }
-  else 
+  else
     {
       if (!fetchData->currentResult || fetchData->currentResult->len == 0)
         {
@@ -2625,7 +2626,7 @@ static gboolean pfetchFinishSequence(GeneralFetchData fetchData)
           blxSequenceSetValueFromString(fetchData->currentSeq, BLXCOL_SEQUENCE, fetchData->currentResult->str);
         }
     }
-  
+
   if (pfetch_ok)
     {
       fetchData->numSucceeded += 1;
@@ -2633,7 +2634,7 @@ static gboolean pfetchFinishSequence(GeneralFetchData fetchData)
 
   /* Reset the result string */
   g_string_truncate(fetchData->currentResult, 0);
-  
+
   return pfetch_ok;
 }
 
@@ -2646,50 +2647,50 @@ static gboolean pfetchFinishSequence(GeneralFetchData fetchData)
  *                          Bulk fetch                             *
  *******************************************************************/
 
-/* Returns true if the given fetch method retrieves sequence 
- * data. Note that fetch methods that return gff files for 
+/* Returns true if the given fetch method retrieves sequence
+ * data. Note that fetch methods that return gff files for
  * re-parsing will cause this function to return true. */
 static gboolean fetchMethodReturnsSequence(const BlxFetchMethod* const fetchMethod)
 {
   gboolean result = FALSE;
-  
+
   if (fetchMethod)
     {
-      result = 
+      result =
         fetchMethod->outputType == BLXFETCH_OUTPUT_RAW ||
         fetchMethod->outputType == BLXFETCH_OUTPUT_FASTA ||
-        fetchMethod->outputType == BLXFETCH_OUTPUT_EMBL || 
+        fetchMethod->outputType == BLXFETCH_OUTPUT_EMBL ||
         fetchMethod->outputType == BLXFETCH_OUTPUT_GFF;
     }
-  
+
   return result;
 }
 
 
 /* Returns true if the given fetch method retrieves data for
- * optional columns. Note that fetch methods that return gff files for 
+ * optional columns. Note that fetch methods that return gff files for
  * re-parsing will cause this function to return true. */
 static gboolean fetchMethodReturnsOptionalColumns(const BlxFetchMethod* const fetchMethod)
 {
   gboolean result = FALSE;
-  
+
   if (fetchMethod)
     {
       /* - EMBL files can be parsed for optional columns like tissue-type and strain.
        * - DB fetch methods that return a list of columns can also return optional columns.
        * - GFF files will be re-parsed and the results will be checked again, so we return
        * true for those too. */
-      result = 
-        fetchMethod->outputType == BLXFETCH_OUTPUT_EMBL || 
-        fetchMethod->outputType == BLXFETCH_OUTPUT_LIST || 
+      result =
+        fetchMethod->outputType == BLXFETCH_OUTPUT_EMBL ||
+        fetchMethod->outputType == BLXFETCH_OUTPUT_LIST ||
         fetchMethod->outputType == BLXFETCH_OUTPUT_GFF;
     }
-  
+
   return result;
 }
 
 
-static const BlxFetchMethod* findFetchMethod(const BlxFetchMode mode, 
+static const BlxFetchMethod* findFetchMethod(const BlxFetchMode mode,
                                              const BlxFetchOutputType outputType,
                                              GHashTable *fetchMethods)
 {
@@ -2702,7 +2703,7 @@ static const BlxFetchMethod* findFetchMethod(const BlxFetchMode mode,
   while (g_hash_table_iter_next (&iter, &key, &value) && !result)
     {
       const BlxFetchMethod* fetchMethod = (const BlxFetchMethod*)value;
-      
+
       if (fetchMethod->mode == mode && fetchMethod->outputType == outputType)
         result = fetchMethod;
     }
@@ -2713,31 +2714,31 @@ static const BlxFetchMethod* findFetchMethod(const BlxFetchMode mode,
 
 /* Checks the list of sequences for blixem to display to see which ones
  * need fetching.
- * Returns lists of all the sequences to be fetched, categorised by the fetch 
+ * Returns lists of all the sequences to be fetched, categorised by the fetch
  * mode that should be used to fetch them. The return value is a map of
  * a GQuark (representing the fetch-mode string) to the GList of sequences
  * to be fetched.
  * This function can be called multiple times on the same sequences to
  * re-try fetching sequences with different fetch methods if the original
- * fetch method fails. Pass 'attempt' as 0 for the first try, 1 for 
- * the second etc. 
- * If optionalColumns is true, then this 'forces' optional data to be 
+ * fetch method fails. Pass 'attempt' as 0 for the first try, 1 for
+ * the second etc.
+ * If optionalColumns is true, then this 'forces' optional data to be
  * loaded even if the bulk fetch method for a sequence does not return
  * embl data. We do this by looking for another fetch method of the same
- * mode that does return embl data. This is perhaps a bit hacky but avoids 
+ * mode that does return embl data. This is perhaps a bit hacky but avoids
  * us having to have yet another set of fetch methods in the config for the
  * user-triggered load-optional-data action. */
-static GHashTable* getSeqsToPopulate(GList *inputList, 
+static GHashTable* getSeqsToPopulate(GList *inputList,
                                      const GArray *defaultFetchMethods,
                                      const int attempt,
                                      GHashTable *fetchMethods,
                                      const gboolean optionalColumns)
 {
   GHashTable *resultTable = g_hash_table_new(g_direct_hash, g_direct_equal);
-  
+
   /* Loop through the input list */
   GList *inputItem = inputList;
-  
+
   for ( ; inputItem; inputItem = inputItem->next)
     {
       BlxSequence *blxSeq = (BlxSequence*)(inputItem->data);
@@ -2752,20 +2753,20 @@ static GHashTable* getSeqsToPopulate(GList *inputList,
               /* Check if sequence data is required and is not already set.
                * Also only attempt to fetch the sequence if this fetch method
                * can return it! */
-              gboolean getSeq = (blxSequenceRequiresSeqData(blxSeq) && 
+              gboolean getSeq = (blxSequenceRequiresSeqData(blxSeq) &&
                                  fetchMethodReturnsSequence(fetchMethod) &&
                                  !blxSequenceGetSequence(blxSeq));
-              
+
               /* Check if full embl data data is required and is not already set. */
               gboolean getEmbl = (blxSequenceRequiresOptionalData(blxSeq) &&
                                   (!blxSequenceGetOrganism(blxSeq) ||
                                    !blxSequenceGetGeneName(blxSeq) ||
                                    !blxSequenceGetTissueType(blxSeq) ||
                                    !blxSequenceGetStrain(blxSeq)));
-              
+
               /* Only attempt to fetch the embl data if this fetch method can
-               * return it, or, if optionalColumns is true, then search for a 
-               * fetch method that does return embl data */ 
+               * return it, or, if optionalColumns is true, then search for a
+               * fetch method that does return embl data */
               if (getEmbl)
                 {
                   if (!fetchMethodReturnsOptionalColumns(fetchMethod) && optionalColumns)
@@ -2780,16 +2781,16 @@ static GHashTable* getSeqsToPopulate(GList *inputList,
 
                   getEmbl = fetchMethodReturnsOptionalColumns(fetchMethod);
                 }
-              
+
               getSeq |= getEmbl;
 
               if (getSeq)
                 {
-                  /* Get the result list for this fetch method. It's ok if it is 
+                  /* Get the result list for this fetch method. It's ok if it is
                    * null because the list will be created by g_list_prepend. */
                   GList *resultList = (GList*)g_hash_table_lookup(resultTable, GINT_TO_POINTER(fetchMethodQuark));
                   resultList = g_list_prepend(resultList, blxSeq);
-                  
+
                   /* Update the existing (or insert the new) list */
                   g_hash_table_insert(resultTable, GINT_TO_POINTER(fetchMethodQuark), resultList);
                 }
@@ -2819,7 +2820,7 @@ void sendFetchOutputToFile(GString *command,
                            GKeyFile *keyFile,
                            BlxBlastMode *blastMode,
                            GArray* featureLists[],
-                           GSList *supportedTypes, 
+                           GSList *supportedTypes,
                            GSList *styles,
                            GList **seqList,
                            MSP **mspListIn,
@@ -2838,7 +2839,7 @@ void sendFetchOutputToFile(GString *command,
   char *fileName = g_strdup_printf("%s/%s_%s", tmpDir, MKSTEMP_CONST_CHARS_GFF, MKSTEMP_REPLACEMENT_CHARS);
   int fileDesc = g_mkstemp(fileName);
   GError *tmpError = NULL;
-  
+
   if (!fileName || fileDesc == -1)
     {
       g_set_error(&tmpError, BLX_ERROR, 1, "  %s: Error creating temp file for fetch results (filename=%s)\n", fetchName, fileName);
@@ -2853,11 +2854,11 @@ void sendFetchOutputToFile(GString *command,
     {
       /* Send the output to the temp file */
       g_string_append_printf(command, " > %s", fileName);
-      
+
       FILE *outputFile = fopen(fileName, "w");
-      
+
       g_debug("Fetch command:\n%s\n", command->str);
-      
+
       GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_NONE, "Fetching features...");
       gtk_widget_show_all(dialog);
 
@@ -2865,7 +2866,7 @@ void sendFetchOutputToFile(GString *command,
       const gboolean success = (system(command->str) == 0);
 
       gtk_widget_destroy(dialog);
-      
+
       fclose(outputFile);
 
       if (success)
@@ -2874,8 +2875,8 @@ void sendFetchOutputToFile(GString *command,
           g_message_info("... ok.\n");
           g_message_info("Parsing fetch results...");
 
-          loadNativeFile(fileName, NULL, keyFile, blastMode, featureLists, 
-                         supportedTypes, styles, newMsps, newSeqs, columnList, 
+          loadNativeFile(fileName, NULL, keyFile, blastMode, featureLists,
+                         supportedTypes, styles, newMsps, newSeqs, columnList,
                          lookupTable, refSeqOffset, refSeqRange, &tmpError);
 
           if (!tmpError)
@@ -2912,7 +2913,7 @@ void sendFetchOutputToFile(GString *command,
  *   tmpDir is the directory in which to place the temporary files
  *   script is the script to call to do the fetch
  *   dataset will be passed as the -dataset argument to the script if it is not null */
-void BulkFetch::regionFetchFeature(const MSP* const msp, 
+void BulkFetch::regionFetchFeature(const MSP* const msp,
                                    const BlxFetchMethod* const fetchMethod,
                                    const char *script,
                                    const char *dataset,
@@ -2924,27 +2925,27 @@ void BulkFetch::regionFetchFeature(const MSP* const msp,
   GError *tmpError = NULL;
 
   /* Get the command string, including the args */
-  GString *command = getFetchCommand(fetchMethod, NULL, 
-                                     msp, mspGetRefName(msp), 
-                                     refSeqOffset, refSeqRange, 
+  GString *command = getFetchCommand(fetchMethod, NULL,
+                                     msp, mspGetRefName(msp),
+                                     refSeqOffset, refSeqRange,
                                      dataset, &tmpError);
 
   if (tmpError)
     prefixError(tmpError, "  %s: Error constructing fetch command:\n", fetchName);
-  
+
   if (!tmpError)
     {
       MSP *newMsps  = NULL;
       GList *newSeqs = NULL;
-      
-      sendFetchOutputToFile(command, keyFile, blastMode, 
-                            featureLists, supportedTypes, styles, 
-                            seqList, mspList, fetchName, saveTempFiles, 
+
+      sendFetchOutputToFile(command, keyFile, blastMode,
+                            featureLists, supportedTypes, styles,
+                            seqList, mspList, fetchName, saveTempFiles,
                             &newMsps, &newSeqs, columnList, lookupTable, refSeqOffset, refSeqRange, &tmpError);
 
       blxMergeFeatures(newMsps, newSeqs, mspList, seqList);
     }
-  
+
   if (command)
     g_string_free(command, TRUE);
 
@@ -2957,10 +2958,10 @@ void BulkFetch::regionFetchFeature(const MSP* const msp,
  * script and arguments to call to fetch the sequences.
  * The input GList contains a list of BlxSequences that are parent objects for
  * MSPs that identify regions. For each region, the script is called to fetch
- * all sequences that lie within that region, and the results are placed in 
+ * all sequences that lie within that region, and the results are placed in
  * a temporary GFF file, which is then parsed to get the results. The GFF file
  * is deleted when finished, unless the saveTempFiles argument is true. */
-void BulkFetch::regionFetchList(GList *regionsToFetch, 
+void BulkFetch::regionFetchList(GList *regionsToFetch,
                                 const BlxFetchMethod* const fetchMethod,
                                 GError **error)
 {
@@ -2983,7 +2984,7 @@ void BulkFetch::regionFetchList(GList *regionsToFetch,
     {
       BlxSequence *blxSeq = (BlxSequence*)(regionItem->data);
       GList *mspItem = blxSeq->mspList;
-    
+
       for ( ; mspItem; mspItem = mspItem->next)
         {
           const MSP* const msp = (const MSP*)(mspItem->data);
@@ -2991,7 +2992,7 @@ void BulkFetch::regionFetchList(GList *regionsToFetch,
           /* Only fetch regions that are at least partly inside our display range */
           if (!rangesOverlap(&msp->qRange, refSeqRange))
             continue;
-          
+
           regionFetchFeature(msp, fetchMethod, script, dataset, tmpDir, &tmpError);
         }
     }
@@ -3002,8 +3003,8 @@ void BulkFetch::regionFetchList(GList *regionsToFetch,
 
 
 /* Fetch sequences using a given command-line script */
-void BulkFetch::commandFetchList(GList *regionsToFetch, 
-                                 const BlxFetchMethod* const fetchMethod, 
+void BulkFetch::commandFetchList(GList *regionsToFetch,
+                                 const BlxFetchMethod* const fetchMethod,
                                  GError **error)
 {
   /* Currently we only support an output type of gff */
@@ -3018,16 +3019,16 @@ void BulkFetch::commandFetchList(GList *regionsToFetch,
 }
 
 
-/* This function determines which function to call to fetch the 
+/* This function determines which function to call to fetch the
  * given list of features, based on the given fetch method.
- * The first argument is the list  of features to fetch and 
+ * The first argument is the list  of features to fetch and
  * the second is the list of all features. */
-gboolean BulkFetch::fetchList(GList *seqsToFetch, 
+gboolean BulkFetch::fetchList(GList *seqsToFetch,
                               const BlxFetchMethod* const fetchMethod,
                               GError **error)
 {
   gboolean success = TRUE;
-  
+
   if (g_list_length(seqsToFetch) > 0)
     {
       if (fetchMethod)
@@ -3035,12 +3036,12 @@ gboolean BulkFetch::fetchList(GList *seqsToFetch,
           switch (fetchMethod->mode)
             {
             case BLXFETCH_MODE_SOCKET:
-              {  
+              {
                 success = socketFetchList(seqsToFetch, fetchMethod, error);
                 break;
               }
 
-#ifdef PFETCH_HTML 
+#ifdef PFETCH_HTML
             case BLXFETCH_MODE_HTTP: // fall through
             case BLXFETCH_MODE_PIPE:
               {
@@ -3079,7 +3080,7 @@ gboolean BulkFetch::fetchList(GList *seqsToFetch,
           g_set_error(error, BLX_ERROR, 1, "Fetch mode not specified.\n");
         }
     }
-  
+
   return success;
 }
 
@@ -3109,19 +3110,19 @@ UserFetch::UserFetch(const BlxSequence *blxSeq_in,
   ipresolve = ipresolve_in;
   cainfo = cainfo_in;
 #endif
-  
+
 }
 
 
 /* Perform the fetch */
-/* Fetch the given sequence and optionally display the results. 
+/* Fetch the given sequence and optionally display the results.
  * dialog and text_buffer are only used when recursing via httpFetchSequence;
  * they should remain as NULL in all other cases. */
 void UserFetch::performFetch()
 {
   BlxContext *bc = blxWindowGetContext(blxWindow);
   g_return_if_fail(blxSeq && bc);
- 
+
   ++attempt;
 
   /* Look up the fetch method for this sequence */
@@ -3130,7 +3131,7 @@ void UserFetch::performFetch()
 
   if (!fetchMethod)
     {
-      /* If this is the first attempt then we should have a fetch method; 
+      /* If this is the first attempt then we should have a fetch method;
        * therefore give a warning if no fetch method was found */
       if (attempt == 0 && !fetchMethodQuark)
         g_warning("No fetch method specified for sequence '%s'\n", blxSequenceGetName(blxSeq));
@@ -3145,15 +3146,15 @@ void UserFetch::performFetch()
       g_message("Fetch method for '%s' is '%s'\n", blxSequenceGetName(blxSeq), fetchModeStr(BLXFETCH_MODE_NONE));
       return;
     }
-  
+
   g_message("Fetching '%s' using method '%s' (attempt %d)\n", blxSequenceGetName(blxSeq), g_quark_to_string(fetchMethodQuark), attempt + 1);
 
-  
+
   if (fetchMethod->mode == BLXFETCH_MODE_SOCKET)
     {
       socketFetchSequence(fetchMethod);
     }
-#ifdef PFETCH_HTML 
+#ifdef PFETCH_HTML
   else if (fetchMethod->mode == BLXFETCH_MODE_HTTP || fetchMethod->mode == BLXFETCH_MODE_PIPE)
     {
       httpFetchSequence(fetchMethod);
@@ -3197,11 +3198,11 @@ void UserFetch::setTextBuffer(GtkTextBuffer *text_buffer_in)
 
 #ifdef PFETCH_HTML
 /* Use the http proxy to pfetch an entry */
-/* Note that this uses a callback to update the display 
- * window; it cannot return the result immediately and the 
+/* Note that this uses a callback to update the display
+ * window; it cannot return the result immediately and the
  * code is not currently structured to allow the callback to
  * do anything other than update the display window, so if
- * we're just requesting the sequence, this currently just 
+ * we're just requesting the sequence, this currently just
  * returns null. */
 bool UserFetch::httpFetchSequence(const BlxFetchMethod *fetchMethod)
 {
@@ -3222,24 +3223,24 @@ bool UserFetch::httpFetchSequence(const BlxFetchMethod *fetchMethod)
 
   if (fetchMethod->location == NULL)
     g_set_error(&tmpError, BLX_ERROR, 1, "%s", "Failed to obtain preferences specifying how to pfetch.\n");
-  
+
   if (!tmpError)
     {
       pfetch_data = new PFetchDataStruct;
 
       pfetch_data->fetchMethod = fetchMethod;
       pfetch_data->user_fetch = this;
-      
+
       command = getFetchCommand(fetchMethod, blxSeq, NULL, bc->refSeqName, bc->refSeqOffset, &bc->refSeqRange, bc->dataset, &tmpError);
     }
-  
+
   if (!tmpError)
     {
-      request = getFetchArgs(fetchMethod, blxSeq, NULL, 
-                             bc->refSeqName, bc->refSeqOffset, &bc->refSeqRange, 
+      request = getFetchArgs(fetchMethod, blxSeq, NULL,
+                             bc->refSeqName, bc->refSeqOffset, &bc->refSeqRange,
                              bc->dataset, &tmpError);
     }
-  
+
   if (!pfetch_data || tmpError)
     {
       /* Couldn't initiate the fetch; try again with a different fetch method */
@@ -3251,13 +3252,13 @@ bool UserFetch::httpFetchSequence(const BlxFetchMethod *fetchMethod)
         }
 
       reportAndClearIfError(&tmpError, G_LOG_LEVEL_WARNING);
-      
+
       performFetch();
     }
   else
     {
       pfetch_data->title = g_strdup_printf("%s%s", blxGetTitlePrefix(bc), command->str);
-      
+
       if (!dialog || !text_buffer)
         {
           dialog = displayFetchResults(pfetch_data->title, "pfetching...\n", blxWindow, dialog, &text_buffer);
@@ -3267,10 +3268,10 @@ bool UserFetch::httpFetchSequence(const BlxFetchMethod *fetchMethod)
         {
           gtk_window_set_title(GTK_WINDOW(dialog), pfetch_data->title);
 
-          pfetch_data->widget_destroy_handler_id = 
-            g_signal_connect(G_OBJECT(dialog), "destroy", 
-                             G_CALLBACK(handle_dialog_close), pfetch_data); 
-          
+          pfetch_data->widget_destroy_handler_id =
+            g_signal_connect(G_OBJECT(dialog), "destroy",
+                             G_CALLBACK(handle_dialog_close), pfetch_data);
+
           if (fetchMethod->mode == BLXFETCH_MODE_PIPE)
             {
               pfetch_data->pfetch =  new PfetchPipe(fetchMethod->location,
@@ -3294,8 +3295,8 @@ bool UserFetch::httpFetchSequence(const BlxFetchMethod *fetchMethod)
 
           if (!(pfetch_data->pfetch->fetch(request->str, &err_msg)))
             {
-              char *msg = g_strdup_printf("Error performing http fetch request:\n  Request: %s\n  Error: %s\n", 
-                                          command->str, 
+              char *msg = g_strdup_printf("Error performing http fetch request:\n  Request: %s\n  Error: %s\n",
+                                          command->str,
                                           (err_msg ? err_msg : "no error"));
               g_warning("%s", msg);
               displayFetchResults(pfetch_data->title, msg, blxWindow, dialog, &text_buffer);
@@ -3324,7 +3325,7 @@ bool UserFetch::httpFetchSequence(const BlxFetchMethod *fetchMethod)
 
 /* Use the www-fetch method to fetch an entry and optionally display
  * the results in a dialog.
- * Opens a browser to display the results. Does nothing if 
+ * Opens a browser to display the results. Does nothing if
  * not displaying results! */
 void UserFetch::wwwFetchSequence(const BlxFetchMethod *fetchMethod)
 {
@@ -3333,11 +3334,11 @@ void UserFetch::wwwFetchSequence(const BlxFetchMethod *fetchMethod)
       BlxContext *bc = blxWindowGetContext(blxWindow);
 
       GError *error = NULL;
-      
-      GString *url = getFetchCommand(fetchMethod, 
-                                     blxSeq, 
-                                     NULL, 
-                                     bc->refSeqName, 
+
+      GString *url = getFetchCommand(fetchMethod,
+                                     blxSeq,
+                                     NULL,
+                                     bc->refSeqName,
                                      bc->refSeqOffset,
                                      &bc->refSeqRange,
                                      bc->dataset,
@@ -3348,7 +3349,7 @@ void UserFetch::wwwFetchSequence(const BlxFetchMethod *fetchMethod)
         {
           seqtoolsLaunchWebBrowser(url->str, &error);
         }
-      
+
       if (url)
         {
           g_string_free(url, TRUE);
@@ -3372,7 +3373,7 @@ void UserFetch::commandFetchSequence(const BlxFetchMethod *fetchMethod)
   GError *error = NULL;
   GString *command = NULL;
   GString *resultText = NULL;
-  
+
   if (!error)
     checkFetchMethodNonNull(fetchMethod, &error);
 
@@ -3403,10 +3404,10 @@ void UserFetch::commandFetchSequence(const BlxFetchMethod *fetchMethod)
       /* Try again with the next-preferred fetch method, if there is one */
       if (resultText)
         g_string_free(resultText, TRUE);
-      
+
       performFetch();
     }
-  
+
   if (command)
     g_string_free(command, TRUE);
 }
@@ -3436,7 +3437,7 @@ void UserFetch::internalFetchSequence(const BlxFetchMethod *fetchMethod)
   else
     {
       g_warning("No sequence data found for '%s'\n", seqName ? seqName : "");
-      
+
       /* Try again with the next-preferred fetch method, if there is one */
       performFetch();
     }
@@ -3458,11 +3459,11 @@ void UserFetch::socketFetchSequence(const BlxFetchMethod *fetchMethod)
     checkFetchMethodExecutable(fetchMethod, &error);
 
   if (!error)
-    command = getFetchCommand(fetchMethod, blxSeq, NULL, bc->refSeqName, bc->refSeqOffset, &bc->refSeqRange, bc->dataset, &error);  
+    command = getFetchCommand(fetchMethod, blxSeq, NULL, bc->refSeqName, bc->refSeqOffset, &bc->refSeqRange, bc->dataset, &error);
 
   if (!error && command)
     resultText = getExternalCommandOutput(command->str, &error);
-  
+
   reportAndClearIfError(&error, G_LOG_LEVEL_WARNING);
 
   if (resultText && resultText->len && !stringInArray(resultText->str, fetchMethod->errors))  /* Success */
@@ -3497,20 +3498,20 @@ void UserFetch::sqliteFetchSequence(const BlxFetchMethod *fetchMethod)
 
   GError *tmpError = NULL;
   sqliteValidateFetchMethod(fetchMethod, &tmpError);
-    
+
   BlxContext *bc = blxWindowGetContext(blxWindow);
   GString *query = NULL;
-  
+
   if (!tmpError)
     {
-      query = getFetchArgs(fetchMethod, blxSeq, NULL, 
+      query = getFetchArgs(fetchMethod, blxSeq, NULL,
                            bc->refSeqName, bc->refSeqOffset, &bc->refSeqRange,
                            bc->dataset, &tmpError);
     }
-  
+
   if (query && !tmpError)
     {
-      sqliteRequest(fetchMethod->location, 
+      sqliteRequest(fetchMethod->location,
                     query->str,
                     sqliteDisplayResultsCB,
                     blxWindow,
@@ -3518,14 +3519,14 @@ void UserFetch::sqliteFetchSequence(const BlxFetchMethod *fetchMethod)
     }
 
   g_string_free(query, TRUE);
-  
+
 
   if (tmpError)
     {
       reportAndClearIfError(&tmpError, G_LOG_LEVEL_WARNING);
       performFetch();
     }
-    
+
   DEBUG_EXIT("sqliteFetchSequence");
 }
 
@@ -3541,7 +3542,7 @@ BulkFetch::BulkFetch(gboolean External_in,
                      MSP **mspList_in,
                      BlxBlastMode *blastMode_in,
                      GArray* featureLists_in[],
-                     GSList *supportedTypes_in, 
+                     GSList *supportedTypes_in,
                      GSList *styles_in,
                      int refSeqOffset_in,
                      IntRange* const refSeqRange_in,
@@ -3565,7 +3566,7 @@ BulkFetch::BulkFetch(gboolean External_in,
   mspList = mspList_in;
   blastMode = blastMode_in;
   featureLists = featureLists_in;
-  supportedTypes = supportedTypes_in; 
+  supportedTypes = supportedTypes_in;
   styles = styles_in;
   refSeqOffset = refSeqOffset_in;
   refSeqRange = refSeqRange_in;
@@ -3578,23 +3579,23 @@ BulkFetch::BulkFetch(gboolean External_in,
   ipresolve = ipresolve_in;
   cainfo = cainfo_in;
 #endif
- 
+
 }
 
 
-/* Find out if we need to fetch any sequences (they may all be 
- * contained in the input files so there might not be anything to 
+/* Find out if we need to fetch any sequences (they may all be
+ * contained in the input files so there might not be anything to
  * fetch). If we do need to, then fetch them by the preferred method.
  * If the preferred fetch method fails, recusively try any other
- * fetch methods set up for each sequence until we have either fetched 
+ * fetch methods set up for each sequence until we have either fetched
  * everything or run out of fetch methods to try.
  * 'attempt' should be passed as 0 for the first call. */
 gboolean BulkFetch::performFetch()
 {
   gboolean success = FALSE; /* will get set to true if any of the fetch methods succeed */
- 
+
   ++attempt;
- 
+
   /* Fetch any sequences that do not have their sequence data
    * already populated. If this is a re-try attempt, then use
    * a secondary fetch method, if one is given; otherwise, exclude
@@ -3614,15 +3615,15 @@ gboolean BulkFetch::performFetch()
       g_hash_table_iter_init(&iter, seqsTable);
       gpointer key, value;
       GError *error = NULL;
-      
+
       while (g_hash_table_iter_next(&iter, &key, &value))
         {
-          GList *seqsToFetch = (GList*)value;          
+          GList *seqsToFetch = (GList*)value;
           GQuark fetchMethodQuark = GPOINTER_TO_INT(key);
 
           if (!fetchMethodQuark)
             continue;
-          
+
           g_message_info("Fetching %d items using method '%s' (attempt %d)\n", g_list_length(seqsToFetch), g_quark_to_string(fetchMethodQuark), attempt + 1);
 
           const BlxFetchMethod* const fetchMethod = getFetchMethodDetails(fetchMethodQuark, fetchMethods);
@@ -3632,13 +3633,13 @@ gboolean BulkFetch::performFetch()
               g_warning("Fetch method '%s' not found\n", g_quark_to_string(fetchMethodQuark));
               continue;
             }
-          
+
           GError *tmpError = NULL;
-          
+
           if (fetchList(seqsToFetch, fetchMethod, &tmpError))
             {
               success = TRUE;
-              
+
               /* Compile all errors into a single error */
               if (error && tmpError)
                 {
@@ -3651,12 +3652,12 @@ gboolean BulkFetch::performFetch()
                   error = tmpError;
                 }
             }
-          
+
           /* We're done with this list now, so free the memory. Don't delete it from
            * the table yet, though, because that will invalidate the iterators. */
           g_list_free(seqsToFetch);
         }
-      
+
       if (success && error)
         {
           /* Some fetches succeeded, so just issue a warning */
@@ -3685,7 +3686,7 @@ gboolean BulkFetch::performFetch()
 
 
 
-/* Get the fetch-method struct containing the details for the 
+/* Get the fetch-method struct containing the details for the
  * given fetch method */
 BlxFetchMethod* getFetchMethodDetails(GQuark fetchMethodQuark, GHashTable *fetchMethods)
 {
diff --git a/src/blixemApp/blxFetchDb.cpp b/src/blixemApp/blxFetchDb.cpp
index 1cd9b414df5ea77f046e8fde3e46bd195924938b..e90e420442da32dd03ebc276ba79da31b9640fe2 100644
--- a/src/blixemApp/blxFetchDb.cpp
+++ b/src/blixemApp/blxFetchDb.cpp
@@ -1,5 +1,6 @@
 /*  File: blxFetchDb.c
  *  Author: Gemma Barson, 2012-08-06
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -30,7 +31,7 @@
  *
  * Description: Blixem functions for control of sequence fetching and
  *              display.
- *              
+ *
  *              Compiling with -DSQLITE3 includes code to issue
  *              fetch requests to an sqlite3 database.
  *              This requires sqlite3 libs to be installed.
@@ -77,7 +78,7 @@ static BlxSequence* findBlxSequence(const char *seqName, GList *seqList)
     {
       BlxSequence* blxSeq = (BlxSequence*)(item->data);
       const char *curName = blxSequenceGetName(blxSeq);
-      
+
       if (stringsEqual(curName, seqName, FALSE))
         result = blxSeq;
     }
@@ -137,7 +138,7 @@ static int populateResultsListCB(void *data, int argc, char **argv, char **azCol
     {
       nameCol = g_quark_from_string("Name");
     }
-  
+
   SqliteFetchData *fetchData = (SqliteFetchData*)data;
 
   /* Loop through the columns to find the name column,
@@ -148,7 +149,7 @@ static int populateResultsListCB(void *data, int argc, char **argv, char **azCol
   for (i = 0; i < argc && !blxSeq; ++i)
     {
       GQuark column = g_quark_from_string(azColName[i]);
-      
+
       if (column == nameCol)
         {
           blxSeq = findBlxSequence(argv[i], fetchData->seqList);
@@ -179,7 +180,7 @@ void sqliteRequest(const char *database, const char *query, SqliteFunc callbackF
   sqlite3 *db;
 
   int rc = sqlite3_open(database, &db);
-  
+
   if (rc)
     {
       fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
@@ -232,8 +233,8 @@ void sqliteValidateFetchMethod(const BlxFetchMethod* const fetchMethod, GError *
 
 
 /* Fetch multiple sequences using sqlite */
-void sqliteFetchSequences(GList *seqsToFetch, 
-                          const BlxFetchMethod* const fetchMethod, 
+void sqliteFetchSequences(GList *seqsToFetch,
+                          const BlxFetchMethod* const fetchMethod,
                           GList *columnList,
                           GError **error)
 {
@@ -241,7 +242,7 @@ void sqliteFetchSequences(GList *seqsToFetch,
 
   GError *tmpError = NULL;
   sqliteValidateFetchMethod(fetchMethod, &tmpError);
-    
+
   GString *query = NULL;
 
   if (!tmpError)
@@ -250,10 +251,10 @@ void sqliteFetchSequences(GList *seqsToFetch,
     }
 
   SqliteFetchData fetchData = {seqsToFetch, columnList};
-  
+
   if (query && !tmpError)
     {
-      sqliteRequest(fetchMethod->location, 
+      sqliteRequest(fetchMethod->location,
                     query->str,
                     populateResultsListCB,
                     &fetchData,
@@ -261,10 +262,9 @@ void sqliteFetchSequences(GList *seqsToFetch,
     }
 
   g_string_free(query, TRUE);
-  
+
   if (tmpError)
     g_propagate_error(error, tmpError);
 
   DEBUG_EXIT("sqliteFetchSequences");
 }
-
diff --git a/src/blixemApp/blxcontext.cpp b/src/blixemApp/blxcontext.cpp
index 3b7ae199fdb1db36426ea1ec8a7350de5ea47b70..9bf4bb20e333796de8cc9886656594c455dcfe99 100644
--- a/src/blixemApp/blxcontext.cpp
+++ b/src/blixemApp/blxcontext.cpp
@@ -1,5 +1,6 @@
 /*  File: blxcontext.cpp
  *  Author: Gemma Barson, 2016-04-06
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -56,7 +57,7 @@ namespace // unnamed namespace
 GroupType getGroupType(const BlxSequenceType featureType)
 {
   GroupType result = GroupType::NONE;
-  
+
   if (featureType == BLXSEQUENCE_MATCH)
     result = GroupType::MATCH;
   else if (featureType != BLXSEQUENCE_UNSET)
@@ -70,7 +71,7 @@ GroupType getGroupType(const BlxSequenceType featureType)
 GroupType getGroupType(const SequenceGroup *group)
 {
   GroupType result = GroupType::NONE;
-  
+
   // Find the type based on the feature types in the blxsequence list.
   if (group && group->seqList && g_list_length(group->seqList) > 0)
     {
@@ -85,13 +86,13 @@ GroupType getGroupType(const SequenceGroup *group)
 
 
 /* This returns the name for the given flag enum. It returns null if the name
- * has not been set. This is used to save settings in the config file; only 
+ * has not been set. This is used to save settings in the config file; only
  * flags whose name is set in this function will be saved. */
 static const char* getFlagName(const BlxFlag flag)
 {
   /* Create an array of names for all of the relevant settings */
   static const char* names[BLXFLAG_NUM_FLAGS] = {0, 0};
-  
+
   if (!names[1]) /* only populate it once */
     {
       names[BLXFLAG_HIGHLIGHT_DIFFS] = SETTING_NAME_HIGHLIGHT_DIFFS;
@@ -132,47 +133,47 @@ DepthCounter getDepthCounterForChar(const char c, const BlxStrand strand)
   switch (c)
     {
     case 'a': //fall through
-    case 'A': 
+    case 'A':
       if (strand == BLXSTRAND_REVERSE)
         result = DEPTHCOUNTER_A_R;
       else
         result = DEPTHCOUNTER_A_F;
       break;
-    case 'c': //fall through 
-    case 'C': 
+    case 'c': //fall through
+    case 'C':
       if (strand == BLXSTRAND_REVERSE)
         result = DEPTHCOUNTER_C_R;
       else
         result = DEPTHCOUNTER_C_F;
       break;
     case 'g':  //fall through
-    case 'G': 
+    case 'G':
       if (strand == BLXSTRAND_REVERSE)
-        result = DEPTHCOUNTER_G_R; 
+        result = DEPTHCOUNTER_G_R;
       else
-        result = DEPTHCOUNTER_G_F; 
+        result = DEPTHCOUNTER_G_F;
       break;
     case 'u':  //fall through
     case 'U':   //fall through
     case 't':  //fall through
-    case 'T': 
+    case 'T':
       if (strand == BLXSTRAND_REVERSE)
-        result = DEPTHCOUNTER_T_R; 
+        result = DEPTHCOUNTER_T_R;
       else
-        result = DEPTHCOUNTER_T_F; 
+        result = DEPTHCOUNTER_T_F;
       break;
     case 'n':  //fall through
-    case 'N': 
+    case 'N':
       if (strand == BLXSTRAND_REVERSE)
-        result = DEPTHCOUNTER_N_R; 
+        result = DEPTHCOUNTER_N_R;
       else
-        result = DEPTHCOUNTER_N_F; 
+        result = DEPTHCOUNTER_N_F;
       break;
     case '.': // indicates a gap
       if (strand == BLXSTRAND_REVERSE)
-        result = DEPTHCOUNTER_GAP_R; 
+        result = DEPTHCOUNTER_GAP_R;
       else
-        result = DEPTHCOUNTER_GAP_F; 
+        result = DEPTHCOUNTER_GAP_F;
       break;
     default:
       break;
@@ -213,7 +214,7 @@ BlxContext::BlxContext(CommandLineOptions *options,
                        GSList *styles_in)
 {
   statusBar = statusBar_in;
-  
+
   refSeq = options->refSeq;
   refSeqName = options->refSeqName ? g_strdup(options->refSeqName) : g_strdup("Blixem-seq");
   refSeqRange.set(refSeqRange_in);
@@ -224,13 +225,13 @@ BlxContext::BlxContext(CommandLineOptions *options,
   mspList = options->mspList;
   columnList = options->columnList;
   styles = styles_in;
-  
+
   int typeId = 0;
   for ( ; typeId < BLXMSP_NUM_TYPES; ++typeId)
     {
       featureLists[typeId] = featureLists_in[typeId];
     }
-  
+
   geneticCode = options->geneticCode;
   blastMode = options->blastMode;
   seqType = options->seqType;
@@ -243,13 +244,13 @@ BlxContext::BlxContext(CommandLineOptions *options,
   dataset = g_strdup(options->dataset);
   matchSeqs = seqList_in;
   supportedTypes = supportedTypes_in;
-  
+
   displayRev = FALSE;
   external = External_in;
-  
+
   selectedSeqs = NULL;
   sequenceGroups = NULL;
-  
+
   dotterRefType = BLXDOTTER_REF_AUTO;
   dotterMatchType = BLXDOTTER_MATCH_SELECTED;
   dotterAdhocSeq = NULL;
@@ -258,32 +259,32 @@ BlxContext::BlxContext(CommandLineOptions *options,
   dotterStart = UNSET_INT;
   dotterEnd = UNSET_INT;
   dotterZoom = 0;
-  
+
   defaultColors = NULL;
   usePrintColors = FALSE;
   windowColor = options->windowColor;
-  
+
   createColors(widget_in);
-  
+
   initialiseFlags(options);
-    
+
   /* Null out all the entries in the dialogs list */
   int dialogId = 0;
   for ( ; dialogId < BLXDIALOG_NUM_DIALOGS; ++dialogId)
     {
       dialogList[dialogId] = NULL;
     }
-    
+
   spawnedProcesses = NULL;
   minDepth = 0;
   maxDepth = 0;
 
   for (int counter = DEPTHCOUNTER_NONE + 1; counter < DEPTHCOUNTER_NUM_ITEMS; ++counter)
     depthArray[counter] = NULL;
- 
+
   loadSettings();
 
-  /* do this after loading settings because the passed-in squashed 
+  /* do this after loading settings because the passed-in squashed
    * matches option should override the saved option in the settings */
   modelId = options->squashMatches ? BLXMODEL_SQUASHED : BLXMODEL_NORMAL;
 
@@ -309,7 +310,7 @@ BlxContext::~BlxContext()
 
   /* Free table of fetch methods and the fetch-method structs */
   /* to do */
-      
+
   /* Free the list of selected sequence names (not the names themselves
    * because we don't own them). */
   if (selectedSeqs)
@@ -317,7 +318,7 @@ BlxContext::~BlxContext()
       g_list_free(selectedSeqs);
       selectedSeqs = NULL;
     }
-      
+
   deleteAllSequenceGroups();
 
   /* Free the color array */
@@ -339,7 +340,7 @@ BlxContext::~BlxContext()
   int typeId = 0;
   for ( ; typeId < BLXMSP_NUM_TYPES; ++typeId)
     g_array_free(featureLists[typeId], FALSE);
-      
+
   destroyMspList(&(mspList));
   destroyBlxSequenceList(&(matchSeqs));
   blxDestroyGffTypeList(&(supportedTypes));
@@ -464,19 +465,19 @@ void BlxContext::destroySequenceGroup(SequenceGroup **seqGroup)
     {
       /* Remove it from the list of groups */
       sequenceGroups = g_list_remove(sequenceGroups, *seqGroup);
-      
+
       /* Free the memory used by the group name */
       if ((*seqGroup)->groupName)
         {
           g_free((*seqGroup)->groupName);
         }
-      
+
       /* Free the list of sequences */
       if ((*seqGroup)->seqList)
         {
           freeStringList(&(*seqGroup)->seqList, (*seqGroup)->ownsSeqNames);
         }
-      
+
       delete *seqGroup;
       *seqGroup = NULL;
     }
@@ -488,7 +489,7 @@ void BlxContext::deleteAllSequenceGroups()
 {
   GList *groupItem = sequenceGroups;
   GList *nextItem = NULL;
-  
+
   while (groupItem)
     {
       nextItem = groupItem->next; // groupItem gets invalidated by destroySequenceGroup
@@ -498,7 +499,7 @@ void BlxContext::deleteAllSequenceGroups()
 
       groupItem = nextItem;
     }
-  
+
   g_list_free(sequenceGroups);
   sequenceGroups = NULL;
 }
@@ -508,7 +509,7 @@ void BlxContext::deleteAllSequenceGroups()
 void BlxContext::disableAllGroups()
 {
   GList *groupItem = sequenceGroups;
-  
+
   while (groupItem)
     {
       GList *nextItem = groupItem->next ;
@@ -530,7 +531,7 @@ void BlxContext::disableAllGroups()
 void BlxContext::disableAllQuickGroups()
 {
   GList *groupItem = sequenceGroups;
-  
+
   while (groupItem)
     {
       GList *nextItem = groupItem->next ;
@@ -566,7 +567,7 @@ BlxStrand BlxContext::activeStrand() const
   BlxStrand result = BLXSTRAND_NONE;
 
   result = displayRev ? BLXSTRAND_REVERSE : BLXSTRAND_FORWARD;
-  
+
   return result;
 }
 
@@ -577,7 +578,7 @@ void BlxContext::createColors(GtkWidget *widget)
   /* Initialise the array with empty BlxColor structs */
   defaultColors = g_array_sized_new(FALSE, FALSE, sizeof(BlxColor), BLXCOL_NUM_COLORS);
   int i = BLXCOLOR_MIN + 1;
-  
+
   for ( ; i < BLXCOL_NUM_COLORS; ++i)
     {
       BlxColor *blxColor = new BlxColor;
@@ -585,21 +586,21 @@ void BlxContext::createColors(GtkWidget *widget)
       blxColor->desc = NULL;
       g_array_append_val(defaultColors, *blxColor);
     }
-  
+
   /* Get the default background color of our widgets (i.e. that inherited from the theme).
    * Convert it to a string so we can use the same creation function as the other colors */
   char *defaultBgColorStr = convertColorToString(&widget->style->bg[GTK_STATE_NORMAL]);
   createBlxColor(defaultColors, BLXCOLOR_BACKGROUND, "Background", "Background color", defaultBgColorStr, BLX_WHITE, "#bdbdbd", NULL);
-  
+
   /* reference sequence */
   createBlxColor(defaultColors, BLXCOLOR_REF_SEQ, "Reference sequence", "Default background color for the reference sequence", BLX_YELLOW, BLX_VERY_LIGHT_GREY, BLX_DARK_YELLOW, NULL);
-  
+
   /* matches */
   createBlxColor(defaultColors, BLXCOLOR_MATCH, "Exact match", "Exact match", BLX_LIGHT_CYAN, BLX_LIGHT_GREY, BLX_CYAN, NULL);
   createBlxColor(defaultColors, BLXCOLOR_CONS, "Conserved match", "Conserved match", BLX_VIOLET, BLX_VERY_LIGHT_GREY, BLX_DARK_VIOLET, NULL);
   createBlxColor(defaultColors, BLXCOLOR_MISMATCH, "Mismatch", "Mismatch", "#FFFFFF", BLX_WHITE, "#FED4EA", NULL);
   createBlxColor(defaultColors, BLXCOLOR_INSERTION, "Insertion", "Insertion", "#9E00FF", BLX_VERY_DARK_GREY, NULL, NULL);
-  
+
   /* exons */
   createBlxColor(defaultColors, BLXCOLOR_EXON_START, "Exon start", "Exon start boundary", BLX_BLUE, BLX_GREY, NULL, NULL);
   createBlxColor(defaultColors, BLXCOLOR_EXON_END, "Exon end", "Exon end boundary", BLX_DARK_BLUE, BLX_GREY, NULL, NULL);
@@ -611,12 +612,12 @@ void BlxContext::createColors(GtkWidget *widget)
   createBlxColor(defaultColors, BLXCOLOR_UTR_FILL, "Exon fill color (UTR)", "Untranslated region fill color in big picture", BLX_LIGHT_RED, BLX_GREY, NULL, NULL);
   createBlxColor(defaultColors, BLXCOLOR_UTR_LINE, "Exon line color (UTR)", "Untranslated region line color in big picture", BLX_DARK_RED, BLX_VERY_DARK_GREY, BLX_VERY_DARK_RED, NULL);
   createBlxColor(defaultColors, BLXCOLOR_PARTIAL_EXON_CROSSHATCH, "Cross-hatch line color for partial exons", "Line color of cross-hatch highlighting for partial exons", BLX_GREY, BLX_GREY, NULL, NULL);
-  
+
   /* codons */
   createBlxColor(defaultColors, BLXCOLOR_CODON, "Codon nucleotides", "Codon nucleotides", BLX_SKY_BLUE, BLX_GREY, NULL, NULL);
   createBlxColor(defaultColors, BLXCOLOR_MET, "MET codons", "MET codons", BLX_LAWN_GREEN, BLX_LIGHT_GREY, NULL, NULL);
   createBlxColor(defaultColors, BLXCOLOR_STOP, "STOP codons", "MET codons", BLX_SALMON_RED, BLX_LIGHT_GREY, NULL, NULL);
-  
+
   /* SNPs */
   createBlxColor(defaultColors, BLXCOLOR_SNP, "SNPs", "SNPs", BLX_ORANGE, BLX_GREY, NULL, NULL);
 
@@ -652,7 +653,7 @@ void BlxContext::createColors(GtkWidget *widget)
   createBlxColor(defaultColors, BLXCOLOR_COVERAGE_PLOT, "Coverage plot", "Coverage plot", BLX_ROYAL_BLUE, BLX_DARK_GREY, NULL, NULL);
   createBlxColor(defaultColors, BLXCOLOR_ASSEMBLY_GAP, "Assembly gaps", "Highlight color for assembly gaps", "#D14553", BLX_DARK_GREY, NULL, NULL);
   createBlxColor(defaultColors, BLXCOLOR_SELECTION, "Selection color", "Highlight color for selections", BLX_DARK_GREY, BLX_DARK_GREY, NULL, NULL);
-  
+
   g_free(defaultBgColorStr);
 }
 /* Called on startup to set the initial state of the flags. Gets the state for
@@ -666,7 +667,7 @@ void BlxContext::initialiseFlags(CommandLineOptions *options)
     {
       flags[flag] = FALSE;
     }
-  
+
   /* Set any specific flags that we want initialised to TRUE */
   flags[BLXFLAG_LIMIT_UNALIGNED_BASES] = TRUE;
   flags[BLXFLAG_SHOW_POLYA_SITE_SELECTED] = TRUE;
@@ -687,12 +688,12 @@ void BlxContext::loadSettings()
 
   if (!key_file)
     return;
-  
+
   GError *error = NULL;
 
   /* squash-matches */
   int squashMatches = g_key_file_get_integer(blxGetConfig(), SETTINGS_GROUP, SETTING_NAME_SQUASH_MATCHES, &error);
-  
+
   if (error)
     {
       /* we don't care if it wasn't found; just clear the error */
@@ -706,15 +707,15 @@ void BlxContext::loadSettings()
 
   /* loop through all the flags and see if any of them are given */
   int flag = BLXFLAG_MIN + 1;
-  
+
   for ( ; flag < BLXFLAG_NUM_FLAGS; ++flag)
     {
       const char *flagName = getFlagName((BlxFlag)flag);
-      
+
       if (flagName)
         {
           int result = g_key_file_get_integer(key_file, SETTINGS_GROUP, flagName, &error);
-          
+
           if (error)
             {
               g_error_free(error);
@@ -734,7 +735,7 @@ void BlxContext::saveSettingsFlags(GKeyFile *key_file)
 {
   /* loop through each (save-able) setting */
   int flag = BLXFLAG_MIN + 1;
-  
+
   for ( ; flag < BLXFLAG_NUM_FLAGS; ++flag)
     {
       const char *flagName = getFlagName((BlxFlag)flag);
@@ -749,13 +750,13 @@ void BlxContext::saveSettingsFlags(GKeyFile *key_file)
 void BlxContext::killAllSpawned()
 {
   GSList *processes = spawnedProcesses;
-  
+
   for ( ; processes; processes = processes->next)
     {
       pid_t pid = GPOINTER_TO_INT(processes->data);
       kill(pid, 9);
     }
-    
+
   if (spawnedProcesses)
     {
       g_slist_free(spawnedProcesses);
@@ -770,10 +771,10 @@ void BlxContext::calculateDepth(const int numUnalignedBases)
 {
   /* Allocate the depth array, if null */
   const int displayLen = fullDisplayRange.length();
-  
+
   if (displayLen < 1)
-    return; 
-  
+    return;
+
   depthArray[DEPTHCOUNTER_ALL_F] = (int*)g_malloc0(sizeof(int) * displayLen);
   depthArray[DEPTHCOUNTER_GAP_F] = (int*)g_malloc0(sizeof(int) * displayLen);
   depthArray[DEPTHCOUNTER_A_F] = (int*)g_malloc0(sizeof(int) * displayLen);
@@ -781,7 +782,7 @@ void BlxContext::calculateDepth(const int numUnalignedBases)
   depthArray[DEPTHCOUNTER_G_F] = (int*)g_malloc0(sizeof(int) * displayLen);
   depthArray[DEPTHCOUNTER_T_F] = (int*)g_malloc0(sizeof(int) * displayLen);
   depthArray[DEPTHCOUNTER_N_F] = (int*)g_malloc0(sizeof(int) * displayLen);
-  
+
   depthArray[DEPTHCOUNTER_ALL_R] = (int*)g_malloc0(sizeof(int) * displayLen);
   depthArray[DEPTHCOUNTER_GAP_R] = (int*)g_malloc0(sizeof(int) * displayLen);
   depthArray[DEPTHCOUNTER_A_R] = (int*)g_malloc0(sizeof(int) * displayLen);
@@ -789,8 +790,8 @@ void BlxContext::calculateDepth(const int numUnalignedBases)
   depthArray[DEPTHCOUNTER_G_R] = (int*)g_malloc0(sizeof(int) * displayLen);
   depthArray[DEPTHCOUNTER_T_R] = (int*)g_malloc0(sizeof(int) * displayLen);
   depthArray[DEPTHCOUNTER_N_R] = (int*)g_malloc0(sizeof(int) * displayLen);
-  
-  /* Initialise each entry to zero */  
+
+  /* Initialise each entry to zero */
   int i = 0;
   for ( ; i < displayLen; ++i)
     {
@@ -810,23 +811,23 @@ void BlxContext::calculateDepth(const int numUnalignedBases)
       depthArray[DEPTHCOUNTER_T_R][i] = 0;
       depthArray[DEPTHCOUNTER_N_R][i] = 0;
     }
-  
+
   /* Loop through all MSP lists */
   int mspType = 0;
-  
+
   for ( ; mspType < BLXMSP_NUM_TYPES; ++mspType)
     {
       /* Only include MSPs of relevant types */
       if (!includeTypeInCoverage((BlxMspType)mspType))
         continue;
-      
+
       /* Loop through all MSPs in this list */
       GArray *mspArray = featureLists[mspType];
       const int fullDisplayLen = fullDisplayRange.length();
-    
+
       i = 0;
       const MSP *msp = mspArrayIdx(mspArray, i);
-  
+
       for ( ; msp; msp = mspArrayIdx(mspArray, ++i))
         {
           /* For each ref-seq coord that this alignment spans, increment the depth */
@@ -874,22 +875,22 @@ void BlxContext::calculateDepth(const int numUnalignedBases)
                 }
             }
         }
-    } 
-  
+    }
+
   /* Find the max and min depth (total depth over both strands) */
   minDepth = depthArray[DEPTHCOUNTER_ALL_F][0] + depthArray[DEPTHCOUNTER_ALL_R][0];
   maxDepth = minDepth;
-  
+
   for (i = 1 ; i < displayLen; ++i)
     {
       const int cur_depth = depthArray[DEPTHCOUNTER_ALL_F][i] + depthArray[DEPTHCOUNTER_ALL_R][i];
 
       if (cur_depth < minDepth)
         minDepth = cur_depth;
-      
+
       if (cur_depth > maxDepth)
         maxDepth = cur_depth;
-    }  
+    }
 }
 
 
@@ -906,10 +907,10 @@ int BlxContext::calculateTotalDepth(const IntRange *range, const BlxStrand stran
       /* Only include MSPs of relevant types */
       if (!includeTypeInCoverage((BlxMspType)mspType))
         continue;
-      
+
       /* Loop through all MSPs in this list */
       GArray *mspArray = featureLists[mspType];
-    
+
       int i = 0;
       for (const MSP *msp = mspArrayIdx(mspArray, i); msp; msp = mspArrayIdx(mspArray, ++i))
         {
@@ -919,7 +920,7 @@ int BlxContext::calculateTotalDepth(const IntRange *range, const BlxStrand stran
               rangesOverlap(range, &msp->displayRange))
             ++depth;
         }
-    } 
+    }
 
   return depth;
 }
@@ -946,13 +947,13 @@ int BlxContext::getDepthForCounter(const int coord, const DepthCounter counter)
 
 
 /* Return the read depth at the given display coord */
-int BlxContext::getDepth(const int coord, 
+int BlxContext::getDepth(const int coord,
                          const char *base_char,
                          const BlxStrand strand)
 {
   int result = 0;
   g_return_val_if_fail(coord >= fullDisplayRange.min() &&
-                       coord <= fullDisplayRange.max(), 
+                       coord <= fullDisplayRange.max(),
                        result);
 
   if (base_char && strand == BLXSTRAND_NONE)
@@ -960,8 +961,8 @@ int BlxContext::getDepth(const int coord,
       /* Get the depth for the specific base for both strands */
       DepthCounter counter_f = getDepthCounterForChar(*base_char, BLXSTRAND_FORWARD);
       DepthCounter counter_r = getDepthCounterForChar(*base_char, BLXSTRAND_REVERSE);
-      
-      result = 
+
+      result =
         getDepthForCounter(coord, counter_f) +
         getDepthForCounter(coord, counter_r);
     }
@@ -974,8 +975,8 @@ int BlxContext::getDepth(const int coord,
   else if (strand == BLXSTRAND_NONE)
     {
       /* Get the depth for all reads for both strands */
-      result = 
-        getDepthForCounter(coord, DEPTHCOUNTER_ALL_F) + 
+      result =
+        getDepthForCounter(coord, DEPTHCOUNTER_ALL_F) +
         getDepthForCounter(coord, DEPTHCOUNTER_ALL_R);
     }
   else if (strand == BLXSTRAND_FORWARD)
@@ -1001,12 +1002,12 @@ int BlxContext::getDepth(const int coord,
 bool BlxContext::isSeqSelected(const BlxSequence *seq) const
 {
   GList *foundItem = NULL;
-  
+
   if (seq)
     {
       foundItem = g_list_find(selectedSeqs, seq);
     }
-  
+
   return (foundItem != NULL);
 }
 
@@ -1015,10 +1016,10 @@ bool BlxContext::isSeqSelected(const BlxSequence *seq) const
 SequenceGroup *BlxContext::getFirstSequenceGroup(const BlxSequence *seqToFind) const
 {
   SequenceGroup *result = NULL;
-  
+
   if (!seqToFind)
     return result;
-  
+
   /* Loop through all the groups until we find this sequence in one */
   GList *groupItem = sequenceGroups;
   for ( ; groupItem; groupItem = groupItem->next)
@@ -1026,14 +1027,14 @@ SequenceGroup *BlxContext::getFirstSequenceGroup(const BlxSequence *seqToFind) c
       /* See if our sequence struct is in this group's list */
       SequenceGroup *group = (SequenceGroup*)(groupItem->data);
       GList *foundItem = g_list_find(group->seqList, seqToFind);
-      
+
       if (foundItem)
         {
           result = group;
           break;
         }
     }
-  
+
   return result;
 }
 
@@ -1042,10 +1043,10 @@ SequenceGroup *BlxContext::getFirstSequenceGroup(const BlxSequence *seqToFind) c
 list<const SequenceGroup*> BlxContext::getSequenceGroups(const BlxSequence *seqToFind) const
 {
   list<const SequenceGroup*> result;
-  
+
   if (!seqToFind)
     return result;
-  
+
   /* Loop through all the groups until we find this sequence in one */
   GList *groupItem = sequenceGroups;
   for ( ; groupItem; groupItem = groupItem->next)
@@ -1053,13 +1054,13 @@ list<const SequenceGroup*> BlxContext::getSequenceGroups(const BlxSequence *seqT
       /* See if our sequence struct is in this group's list */
       SequenceGroup *group = (SequenceGroup*)(groupItem->data);
       GList *foundItem = g_list_find(group->seqList, seqToFind);
-      
+
       if (foundItem)
         {
           result.push_back(group);
         }
     }
-  
+
   return result;
 }
 
@@ -1071,11 +1072,11 @@ GList *BlxContext::getSelectedSeqsByType(const BlxSequenceType type) const
   GList *result = NULL;
 
   GList *list_item = selectedSeqs;
-  
+
   for ( ; list_item; list_item = list_item->next)
     {
       BlxSequence *curSeq = (BlxSequence*)(list_item->data);
-      
+
       if (curSeq->type == type)
         {
           result = g_list_append(result, curSeq);
@@ -1094,15 +1095,15 @@ BlxSequence* BlxContext::getSelectedTranscript(int *num_transcripts) const
 
   GList *list_item = selectedSeqs;
   int num_found = 0;
-  
+
   for ( ; list_item; list_item = list_item->next)
     {
       BlxSequence *curSeq = (BlxSequence*)(list_item->data);
-      
+
       if (curSeq->type == BLXSEQUENCE_TRANSCRIPT)
         {
           ++num_found;
-          
+
           if (result)
             {
               /* Found more than one - don't know which to choose so return null */
@@ -1156,7 +1157,7 @@ GList* BlxContext::getFeaturesInSourceList(std::set<GQuark> sources) const
     {
       BlxSequence* blxSeq = (BlxSequence*)(item->data);
       const char *source = blxSequenceGetSource(blxSeq);
-      
+
       if (sources.find(g_quark_from_string(source)) != sources.end())
         result = g_list_append(result, blxSeq);
     }
@@ -1165,7 +1166,7 @@ GList* BlxContext::getFeaturesInSourceList(std::set<GQuark> sources) const
 }
 
 
-void BlxContext::highlightBoxCalcBorders(GdkRectangle *drawingRect, 
+void BlxContext::highlightBoxCalcBorders(GdkRectangle *drawingRect,
                                          GdkRectangle *highlightRect,
                                          const IntRange *fullRange,
                                          const IntRange *highlightRange,
@@ -1176,24 +1177,24 @@ void BlxContext::highlightBoxCalcBorders(GdkRectangle *drawingRect,
       /* Get the full range in dna coords */
       IntRange fullDnaRange;
       convertDisplayRangeToDnaRange(fullRange, seqType, numFrames, displayRev, &refSeqRange, &fullDnaRange);
-      
+
       /* Get the highlight range in dna coords */
       IntRange highlightDnaRange;
       convertDisplayRangeToDnaRange(highlightRange, seqType, numFrames, displayRev, &refSeqRange, &highlightDnaRange);
-      
+
       /* Get the x coords for the start and end of the detail view display range */
       const int x1 = convertBaseIdxToRectPos(highlightDnaRange.min(true, displayRev), drawingRect, &fullDnaRange, TRUE, displayRev, TRUE);
       const int x2 = convertBaseIdxToRectPos(highlightDnaRange.max(true, displayRev), drawingRect, &fullDnaRange, TRUE, displayRev, TRUE);
-      
+
       highlightRect->x = min(x1, x2);
       highlightRect->y = 0;
 
       highlightRect->width = abs(x1 - x2);
 
-      highlightRect->height = 
-        drawingRect->height + 
-        roundNearest(charHeight() / 2.0) + 
-        yPadding + 
+      highlightRect->height =
+        drawingRect->height +
+        roundNearest(charHeight() / 2.0) +
+        yPadding +
         (2 * HIGHLIGHT_BOX_Y_PAD);
     }
 }
diff --git a/src/blixemApp/blxcontext.hpp b/src/blixemApp/blxcontext.hpp
index 2660082a804498c1abfe21baefef473490cb50b0..2b6b02afce0a5e582668b6690aad6ce049d52852 100644
--- a/src/blixemApp/blxcontext.hpp
+++ b/src/blixemApp/blxcontext.hpp
@@ -1,5 +1,6 @@
 /*  File: blxcontext.hpp
  *  Author: Gemma Barson, 2016-04-06
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -28,7 +29,7 @@
  *      Roy Storey        (Sanger Institute, UK)  <rds@sanger.ac.uk>
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
- * Description: A Blixem context class, containing all status information 
+ * Description: A Blixem context class, containing all status information
  *              required for a blixem instance.
  *----------------------------------------------------------------------------
  */
@@ -77,8 +78,8 @@ public:
   std::set<GQuark> getSelectedSources() const;
   GList* getFeaturesInSourceList(std::set<GQuark> sources) const;
 
-  void highlightBoxCalcBorders(GdkRectangle *drawingRect, GdkRectangle *highlightRect, 
-                               const IntRange *fullRange, const IntRange *highlightRange, 
+  void highlightBoxCalcBorders(GdkRectangle *drawingRect, GdkRectangle *highlightRect,
+                               const IntRange *fullRange, const IntRange *highlightRange,
                                const int yPadding);
 
   // Modify
@@ -101,7 +102,7 @@ public:
 
 
   GtkWidget *statusBar;                   /* The Blixem window's status bar */
-    
+
   char *refSeq;                           /* The reference sequence (always forward strand, always DNA sequence) */
   const char *refSeqName;                 /* The name of the reference sequence */
   IntRange refSeqRange;                   /* The range of the reference sequence */
@@ -124,18 +125,18 @@ public:
 
   MSP *mspList;                           /* List of all MSPs. Obsolete - use featureLists array instead */
   GArray* featureLists[BLXMSP_NUM_TYPES]; /* Array indexed by the BlxMspType enum. Each array entry contains a zero-terminated array of all the MSPs of that type. */
-    
+
   GList *matchSeqs;                       /* List of all match sequences (as BlxSequences). */
   GSList *supportedTypes;                 /* List of supported GFF types */
   const char *paddingSeq;                 /* A sequence of padding characters, used if the real sequence could not be found. All padded MSPs
                                            * use this same padding sequence - it is constructed to be long enough for the longest required seq. */
-    
+
   gboolean displayRev;                    /* True if the display is reversed (i.e. coords decrease as you read from left to right, rather than increase). */
   gboolean external;                      /* True if Blixem was run externally or false if it was run internally from another program */
-    
+
   GList *selectedSeqs;                    /* A list of sequences that are selected (as BlxSequences) */
   GList *sequenceGroups;                  /* A list of SequenceGroups */
-    
+
   DotterRefType dotterRefType;            /* Whether to dotter a ref seq range or a transcript */
   DotterMatchType dotterMatchType;        /* Saved type of match to call dotter on */
   char *dotterAdhocSeq;                   /* Saves the sequence text the user pastes into the dotter dialog */
@@ -144,19 +145,19 @@ public:
   int dotterStart;                        /* Start coord to call dotter on, or UNSET_INT to calculate automatically */
   int dotterEnd;                          /* End coord to call dotter on, or UNSET_INT to calculate automatically */
   int dotterZoom;                         /* Zoom param to call dotter with, if using manual params */
-    
+
   GArray *defaultColors;                  /* Default colors used by Blixem */
   gboolean usePrintColors;                /* Whether to use print colors (i.e. black and white) */
   char *windowColor;                      /* If not null, background color for the window */
 
   GList *columnList;                      /* A list of details about all the columns in the detail view (might have been better to use an array here but it's a short list so not important) */
   GSList *styles;
-    
+
   gboolean flags[BLXFLAG_NUM_FLAGS];              /* Array of all the flags the user can toggle. Indexed by the BlxFlags enum. */
   GtkWidget *dialogList[BLXDIALOG_NUM_DIALOGS];   /* Array of all the persistent dialogs in the application */
   GSList *spawnedProcesses;                       /* List of processes spawned by Blixem */
   BlxModelId modelId;                             /* which tree model to use (i.e. normal or squashed) */
-  
+
   /* This array holds the depth (num alignments) at each coord of the ref seq for
    * different types of counter. For each counter there is an array the same lenth as the
    * reference sequence. This could cause memory problems with a large region. Generally
diff --git a/src/blixemApp/blxdotter.cpp b/src/blixemApp/blxdotter.cpp
index 328b52b8f02fe42bb5cc5f9853f1880e62f42bdc..0fd0637d45ce09006f66a40020a25df3ae831024 100644
--- a/src/blixemApp/blxdotter.cpp
+++ b/src/blixemApp/blxdotter.cpp
@@ -1,5 +1,6 @@
 /*  File: blxdotter.c
  *  Author: Gemma Barson, 2010-02-03
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -67,13 +68,13 @@ typedef struct _DotterDialogData
     GtkWidget *startEntry;          /* the text entry box on the dialog for the start coord */
     GtkWidget *endEntry;            /* the text entry box on the dialog for the end coord */
     GtkWidget *zoomEntry;           /* the text entry box on the dialog for the zoom value */
-    
+
     DotterMatchType matchType;      /* whether to call dotter on the selected match, an adhoc seq,
                                      * or the query seq versus itself */
     DotterRefType refType;          /* whether to use the ref seq or a transcript seq */
     gboolean hspsOnly;              /* whether to call dotter on HSPs only */
     gboolean sleep;                 /* whether to sleep dotter on startup */
-    
+
     GtkWidget *selectedButton;      /* the radio button for the use-selected-sequence option */
     GtkWidget *adhocButton;         /* the radio button for the use-adhoc-sequence option */
     GtkWidget *selfButton;          /* the radio button for the use-self option */
@@ -111,7 +112,7 @@ static gboolean	      callDotterOnSelf(DotterDialogData *dialogData, GError **er
 static gboolean	      callDotterOnAdhocSeq(DotterDialogData *dialogData, GError **error);
 static char*          getSelectedSequenceDNA(const BlxSequence *selectedSeq, const BlxContext *bc, GError **error);
 static void           textGetSeqDetails(const char *text, char **sequence, char **sequenceName);
-static char*          getDotterTitle(const BlxContext *bc, const DotterMatchType matchType, const DotterRefType refType, const char *adhocSeq); 
+static char*          getDotterTitle(const BlxContext *bc, const DotterMatchType matchType, const DotterRefType refType, const char *adhocSeq);
 static char*          getDotterTitleAdhocSeq(const BlxContext *bc, const char *adhocSeq, const DotterRefType refType);
 static const char*    getDotterRefSeqName(const BlxContext *bc, const gboolean transcript);
 static gboolean       boundsCheckDotterCoord(int *coordIn, BlxContext *bc, GError **error);
@@ -128,9 +129,9 @@ static void onResponseDotterDialog(GtkDialog *dialog, gint responseId, gpointer
 {
   gboolean destroy = TRUE;
   DotterDialogData *dialogData = (DotterDialogData*)(data);
-  
+
   GError *error = NULL;
-  
+
   switch (responseId)
     {
       case GTK_RESPONSE_ACCEPT:
@@ -144,8 +145,8 @@ static void onResponseDotterDialog(GtkDialog *dialog, gint responseId, gpointer
                   {
                     /* The 'transcript' flag indicates that we're dottering vs the selected
                      * transcript rather than the reference sequence*/
-                    destroy = callDotterOnSelectedSeqs(dialogData->blxWindow, 
-                                                       dialogData->hspsOnly, 
+                    destroy = callDotterOnSelectedSeqs(dialogData->blxWindow,
+                                                       dialogData->hspsOnly,
                                                        dialogData->sleep,
                                                        dialogData->refType,
                                                        &error);
@@ -163,14 +164,14 @@ static void onResponseDotterDialog(GtkDialog *dialog, gint responseId, gpointer
           {
             destroy = FALSE; /* there was an error, so leave the dialog open */
           }
-        
+
 	break;
-	
+
       case GTK_RESPONSE_APPLY:
 	widgetCallAllCallbacks(GTK_WIDGET(dialog), GINT_TO_POINTER(responseId));
 	destroy = FALSE;
 	break;
-	
+
       default:
 	break;
     };
@@ -191,14 +192,14 @@ static void onResponseDotterDialog(GtkDialog *dialog, gint responseId, gpointer
 
 
 /* Callback to be called when the user clicks OK or Apply on the dotter
- * dialog. It sets the dotter mode according to the toggle state of the 
+ * dialog. It sets the dotter mode according to the toggle state of the
  * "auto" button. */
 static gboolean onSaveDotterMode(GtkWidget *button, const gint responseId, gpointer data)
 {
   DotterDialogData *dialogData = (DotterDialogData*)data;
   GtkWidget *blxWindow = dialogData->blxWindow;
   BlxContext *bc = blxWindowGetContext(blxWindow);
-  
+
   bc->dotterRefType = dialogData->refType;
 
   return TRUE;
@@ -263,7 +264,7 @@ static gboolean onSaveDotterAdhocSeq(GtkWidget *textView, const gint responseId,
 
 
 /* Callback to be called when the user clicks OK or Apply on the dotter
- * dialog. It sets the sequence we should dotter against to be the 
+ * dialog. It sets the sequence we should dotter against to be the
  * reference sequence if the button is active. */
 static gboolean onSaveDotterSelf(GtkWidget *button, const gint responseId, gpointer data)
 {
@@ -314,9 +315,9 @@ static gboolean onSaveDotterStart(GtkWidget *entry, const gint responseId, gpoin
     {
       int newVal = atoi(gtk_entry_get_text(GTK_ENTRY(entry)));
       GError *error = NULL;
-      
+
       result = boundsCheckDotterCoord(&newVal, bc, &error);
-      
+
       if (result)
         {
           bc->dotterStart = newVal;
@@ -327,27 +328,27 @@ static gboolean onSaveDotterStart(GtkWidget *entry, const gint responseId, gpoin
           postfixError(error, "Value not saved.");
           reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
         }
-    }  
-  
+    }
+
   return result;
 }
 
 static gboolean onSaveDotterEnd(GtkWidget *entry, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   DotterDialogData *dialogData = (DotterDialogData*)data;
   BlxContext *bc = blxWindowGetContext(dialogData->blxWindow);
-  
+
   /* Only save the parameter if we are using manual parameters */
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialogData->manualButton)))
     {
       int newVal = atoi(gtk_entry_get_text(GTK_ENTRY(entry)));
 
       GError *error = NULL;
-      
+
       result = boundsCheckDotterCoord(&newVal, bc, &error);
-      
+
       if (result)
         {
           bc->dotterEnd = newVal;
@@ -358,23 +359,23 @@ static gboolean onSaveDotterEnd(GtkWidget *entry, const gint responseId, gpointe
           postfixError(error, "Value not saved.");
           reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
         }
-    }  
-  
+    }
+
   return result;
 }
 
 static gboolean onSaveDotterZoom(GtkWidget *entry, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   DotterDialogData *dialogData = (DotterDialogData*)data;
   BlxContext *blxContext = blxWindowGetContext(dialogData->blxWindow);
-  
+
   /* Only save the parameter if we are using manual parameters */
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialogData->manualButton)))
     {
       const int newVal = atoi(gtk_entry_get_text(GTK_ENTRY(entry)));
-      
+
       if (newVal < 0)
         {
           result = FALSE;
@@ -384,8 +385,8 @@ static gboolean onSaveDotterZoom(GtkWidget *entry, const gint responseId, gpoint
         {
           blxContext->dotterZoom = newVal;
         }
-    }  
-  
+    }
+
   return result;
 }
 
@@ -412,15 +413,15 @@ static void onLastSavedButtonClicked(GtkWidget *button, gpointer data)
 {
   DotterDialogData *dialogData = (DotterDialogData*)data;
   BlxContext *bc = blxWindowGetContext(dialogData->blxWindow);
-  
+
   char *startString = convertIntToString(getDisplayCoord(bc->dotterStart, bc));
   char *endString = convertIntToString(getDisplayCoord(bc->dotterEnd, bc));
   char *zoomString = convertIntToString(bc->dotterZoom);
-  
+
   gtk_entry_set_text(GTK_ENTRY(dialogData->startEntry), startString);
   gtk_entry_set_text(GTK_ENTRY(dialogData->endEntry), endString);
   gtk_entry_set_text(GTK_ENTRY(dialogData->zoomEntry), zoomString);
-  
+
   /* Change the mode to manual */
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialogData->manualButton), TRUE);
 }
@@ -432,19 +433,19 @@ static void onFullRangeButtonClicked(GtkWidget *button, gpointer data)
 {
   DotterDialogData *dialogData = (DotterDialogData*)data;
   BlxContext *bc = blxWindowGetContext(dialogData->blxWindow);
-  
+
   const int startCoord = (bc->displayRev ? bc->refSeqRange.max() : bc->refSeqRange.min());
   const int endCoord = (bc->displayRev ? bc->refSeqRange.min() : bc->refSeqRange.max());
-  
+
   char *startString = convertIntToString(getDisplayCoord(startCoord, bc));
   char *endString = convertIntToString(getDisplayCoord(endCoord, bc));
-  
+
   gtk_entry_set_text(GTK_ENTRY(dialogData->startEntry), startString);
   gtk_entry_set_text(GTK_ENTRY(dialogData->endEntry), endString);
-  
+
   g_free(startString);
   g_free(endString);
-  
+
   /* Change the mode to manual */
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialogData->manualButton), TRUE);
 }
@@ -464,16 +465,16 @@ static void onBpRangeButtonClicked(GtkWidget *button, gpointer data)
 
   boundsLimitValue(&qStart, &bc->refSeqRange);
   boundsLimitValue(&qEnd, &bc->refSeqRange);
-  
+
   char *startString = convertIntToString(getDisplayCoord(qStart, bc));
   char *endString = convertIntToString(getDisplayCoord(qEnd, bc));
-  
+
   gtk_entry_set_text(GTK_ENTRY(dialogData->startEntry), startString);
   gtk_entry_set_text(GTK_ENTRY(dialogData->endEntry), endString);
-  
+
   g_free(startString);
   g_free(endString);
-  
+
   /* Change the mode to manual */
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialogData->manualButton), TRUE);
 }
@@ -513,7 +514,7 @@ static void onRefTypeToggled(GtkWidget *button, gpointer data)
 {
   DotterDialogData *dialogData = (DotterDialogData*)data;
   BlxContext *bc = blxWindowGetContext(dialogData->blxWindow);
-  
+
   char *title = getDotterTitle(bc, dialogData->matchType, dialogData->refType, bc->dotterAdhocSeq);
   gtk_window_set_title(GTK_WINDOW(dialogData->dialog), title);
   g_free(title);
@@ -544,7 +545,7 @@ static void onRefTypeToggled(GtkWidget *button, gpointer data)
           autoStart = bc->displayRev ? bc->refSeqRange.max() : bc->refSeqRange.min();
           autoEnd = bc->displayRev ? bc->refSeqRange.min() : bc->refSeqRange.max();
         }
-      
+
       char *startString = convertIntToString(getDisplayCoord(autoStart, bc));
       char *endString = convertIntToString(getDisplayCoord(autoEnd, bc));
       char *zoomString = convertIntToString(bc->dotterZoom);
@@ -553,11 +554,11 @@ static void onRefTypeToggled(GtkWidget *button, gpointer data)
       gtk_entry_set_text(GTK_ENTRY(dialogData->startEntry), startString);
       gtk_entry_set_text(GTK_ENTRY(dialogData->endEntry), endString);
       gtk_entry_set_text(GTK_ENTRY(dialogData->zoomEntry), zoomString);
-      
+
       g_free(startString);
       g_free(endString);
       g_free(zoomString);
-      
+
       /* Lock out the entry boxes so they cannot be edited */
       gtk_widget_set_sensitive(dialogData->startEntry, FALSE);
       gtk_widget_set_sensitive(dialogData->endEntry, FALSE);
@@ -571,7 +572,7 @@ static void onMatchTypeToggled(GtkWidget *button, gpointer data)
 {
   DotterDialogData *dialogData = (DotterDialogData*)data;
   BlxContext *bc = blxWindowGetContext(dialogData->blxWindow);
-  
+
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialogData->selfButton)))
     {
       dialogData->matchType = BLXDOTTER_MATCH_SELF;
@@ -595,7 +596,7 @@ static void onMatchTypeToggled(GtkWidget *button, gpointer data)
   g_free(title);
   g_free(adhocSeq);
 
-  /* If using auto coords, recalculate them */ 
+  /* If using auto coords, recalculate them */
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialogData->autoButton)))
     {
       int autoStart = UNSET_INT, autoEnd = UNSET_INT;
@@ -603,10 +604,10 @@ static void onMatchTypeToggled(GtkWidget *button, gpointer data)
 
       if (autoStart == UNSET_INT)
         autoStart = bc->displayRev ? bc->refSeqRange.max() : bc->refSeqRange.min();
-  
+
       if (autoEnd == UNSET_INT)
         autoEnd = bc->displayRev ? bc->refSeqRange.min() : bc->refSeqRange.max();
-  
+
       char *startString = convertIntToString(getDisplayCoord(autoStart, bc));
       char *endString = convertIntToString(getDisplayCoord(autoEnd, bc));
       char *zoomString = convertIntToString(bc->dotterZoom);
@@ -615,7 +616,7 @@ static void onMatchTypeToggled(GtkWidget *button, gpointer data)
       gtk_entry_set_text(GTK_ENTRY(dialogData->startEntry), startString);
       gtk_entry_set_text(GTK_ENTRY(dialogData->endEntry), endString);
       gtk_entry_set_text(GTK_ENTRY(dialogData->zoomEntry), zoomString);
-  
+
       g_free(startString);
       g_free(endString);
       g_free(zoomString);
@@ -642,7 +643,7 @@ static void onSleepButtonToggled(GtkWidget *button, gpointer data)
 static void onDestroyDotterDialog(GtkWidget *dialog, gpointer data)
 {
   DotterDialogData *dialogData = (DotterDialogData*)data;
-  
+
   if (dialogData)
     {
       delete dialogData;
@@ -654,11 +655,11 @@ static void onDestroyDotterDialog(GtkWidget *dialog, gpointer data)
  *                      Creating the dialog                        *
  *******************************************************************/
 
-static GtkWidget* createTextEntry(GtkTable *table, 
-				  int col, 
-				  int row, 
-				  const int xpad, 
-				  const int ypad, 
+static GtkWidget* createTextEntry(GtkTable *table,
+				  int col,
+				  int row,
+				  const int xpad,
+				  const int ypad,
 				  const char *title,
 				  BlxResponseCallback callbackFunc,
                                   gpointer callbackData,
@@ -668,21 +669,21 @@ static GtkWidget* createTextEntry(GtkTable *table,
   GtkWidget *label = gtk_label_new(title);
   gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
   gtk_table_attach(table, label, col, col + 1, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
-  
+
   /* Create the text entry widget in the next column in the same row */
   ++col;
   GtkWidget *entry = gtk_entry_new();
   gtk_table_attach(table, entry, col, col + 1, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
   gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-  
+
   /* Set the initial text */
   char *initText = convertIntToString(initValue);
   gtk_entry_set_text(GTK_ENTRY(entry), initText);
   g_free(initText);
-  
+
   /* Add the callback data. This specifies what callback to use when the user hits OK or Apply on the dialog. */
   widgetSetCallbackData(entry, callbackFunc, callbackData);
-  
+
   return entry;
 }
 
@@ -692,11 +693,11 @@ static GtkWidget* createTextEntry(GtkTable *table,
 static void dotterDialogSetDefaultSize(GtkWidget *dialog, GtkWidget *blxWindow)
 {
   /* We'll set the default window width to a preferred default, but make it smaller
-   * if it exceeds a maximum percentage of the screen size. Just use the height 
+   * if it exceeds a maximum percentage of the screen size. Just use the height
    * allocated for the widgets. */
   int maxWidth = 300;
   gbtools::GUIGetTrueMonitorSizeFraction(dialog, MAX_WINDOW_WIDTH_FRACTION, 1, &maxWidth, NULL);
-  
+
   const int width = min(DEFAULT_WINDOW_WIDTH, maxWidth);
 
   gtk_window_set_default_size(GTK_WINDOW(dialog), width, -1);
@@ -765,20 +766,20 @@ static void createCoordsTab(DotterDialogData *dialogData, const int spacing)
   ++col;
   row = 0;
 
-  dialogData->startEntry = createTextEntry(table, col, row, xpad, ypad, "<i>Start:</i>", onSaveDotterStart, 
+  dialogData->startEntry = createTextEntry(table, col, row, xpad, ypad, "<i>Start:</i>", onSaveDotterStart,
                                            dialogData, getDisplayCoord(bc->dotterStart, bc));
   ++row;
-  dialogData->endEntry = createTextEntry(table, col, row, xpad, ypad, "<i>End:</i>", onSaveDotterEnd, 
+  dialogData->endEntry = createTextEntry(table, col, row, xpad, ypad, "<i>End:</i>", onSaveDotterEnd,
                                          dialogData, getDisplayCoord(bc->dotterEnd, bc));
   ++row;
-  dialogData->zoomEntry = createTextEntry(table, col, row, xpad, ypad, "<i>Zoom:</i>", onSaveDotterZoom, 
+  dialogData->zoomEntry = createTextEntry(table, col, row, xpad, ypad, "<i>Zoom:</i>", onSaveDotterZoom,
                                           dialogData, bc->dotterZoom);
   ++row;
 
   gtk_widget_set_tooltip_text(dialogData->zoomEntry, "The level of zoom to open Dotter with (higher values zoom in)");
 
   /* There is an issue if the user selects a different sequence while the dotter dialog
-   * is still open: the auto range does not update automatically for the new sequence. To 
+   * is still open: the auto range does not update automatically for the new sequence. To
    * mitigate this, connect the 'clicked' signal so that they can
    * click on the 'auto' toggle button and have it refresh, even if that button is already selected.*/
   g_signal_connect(G_OBJECT(dialogData->autoButton),      "clicked", G_CALLBACK(onRefTypeToggled), dialogData);
@@ -866,7 +867,7 @@ static void createSequenceTab(DotterDialogData *dialogData, const int spacing)
   gtk_container_add(GTK_CONTAINER(scrollWin), dialogData->adhocSeqText);
   gtk_container_add(GTK_CONTAINER(frame), scrollWin);
 
-  gtk_table_attach(table, frame, col, col + 1, row, row + 1, 
+  gtk_table_attach(table, frame, col, col + 1, row, row + 1,
                    (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), xpad, ypad);
   ++row;
 
@@ -889,7 +890,7 @@ static void createSequenceTab(DotterDialogData *dialogData, const int spacing)
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialogData->selfButton), FALSE);
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialogData->adhocButton), FALSE);
         break;
-     
+
       case BLXDOTTER_MATCH_SELF:
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialogData->selectedButton), FALSE);
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialogData->selfButton), TRUE);
@@ -927,7 +928,7 @@ static void createOptionsTab(DotterDialogData *dialogData, const int spacing)
   gtk_box_pack_start(vbox, sleepButton, FALSE, FALSE, spacing);
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sleepButton), bc->dotterSleep);
   widgetSetCallbackData(sleepButton, onSaveDotterSleep, dialogData->blxWindow);
-  
+
   g_signal_connect(G_OBJECT(hspsButton), "toggled", G_CALLBACK(onHspsButtonToggled), dialogData);
   g_signal_connect(G_OBJECT(sleepButton), "toggled", G_CALLBACK(onSleepButtonToggled), dialogData);
 }
@@ -935,7 +936,7 @@ static void createOptionsTab(DotterDialogData *dialogData, const int spacing)
 
 /* First time round, create the dotter dialog. Subsequent calls re-use the same dialog but clear
  * the contents ready to re-populate it. If resetData is true, reset entries to last-saved values */
-static GtkWidget* getOrCreateDotterDialog(GtkWidget *blxWindow, 
+static GtkWidget* getOrCreateDotterDialog(GtkWidget *blxWindow,
                                           const gboolean resetValues,
                                           DotterDialogData **dialogData_inout)
 {
@@ -944,13 +945,13 @@ static GtkWidget* getOrCreateDotterDialog(GtkWidget *blxWindow,
   GtkWidget *dialog = getPersistentDialog(bc->dialogList, dialogId);
   DotterDialogData *dialogData = *dialogData_inout;
   gboolean createContent = FALSE;
-  
+
   if (!dialog)
     {
       createContent = TRUE;
 
-      dialog = gtk_dialog_new_with_buttons(NULL, 
-                                           GTK_WINDOW(blxWindow), 
+      dialog = gtk_dialog_new_with_buttons(NULL,
+                                           GTK_WINDOW(blxWindow),
                                            GTK_DIALOG_DESTROY_WITH_PARENT,
                                            GTK_STOCK_CANCEL,
                                            GTK_RESPONSE_REJECT,
@@ -965,7 +966,7 @@ static GtkWidget* getOrCreateDotterDialog(GtkWidget *blxWindow,
       g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
       dotterDialogSetDefaultSize(dialog, blxWindow);
 
-      /* Create the dialog data struct first time round, but re-populate it each time. Create 
+      /* Create the dialog data struct first time round, but re-populate it each time. Create
        * a destructor function that will free the struct. */
       *dialogData_inout = new DotterDialogData;
       dialogData = *dialogData_inout;
@@ -991,7 +992,7 @@ static GtkWidget* getOrCreateDotterDialog(GtkWidget *blxWindow,
     {
       /* Refresh the dialog by clearing its contents an re-creating it */
       createContent = TRUE;
-      dialogClearContentArea(GTK_DIALOG(dialog));      
+      dialogClearContentArea(GTK_DIALOG(dialog));
 
       /* Reset to last-saved values */
       dialogData->matchType = bc->dotterMatchType;
@@ -999,7 +1000,7 @@ static GtkWidget* getOrCreateDotterDialog(GtkWidget *blxWindow,
       dialogData->hspsOnly = bc->dotterHsps;
       dialogData->sleep = bc->dotterSleep;
     }
-  
+
   if (createContent)
     {
       /* Create the dialog content */
@@ -1011,7 +1012,7 @@ static GtkWidget* getOrCreateDotterDialog(GtkWidget *blxWindow,
       dialogData->notebook = gtk_notebook_new();
       gtk_container_add(contentArea, dialogData->notebook);
       g_signal_connect(G_OBJECT(dialogData->notebook), "switch-page", G_CALLBACK(onChangeCurrentPage), dialogData);
-  
+
       createCoordsTab(dialogData, spacing);
       createSequenceTab(dialogData, spacing);
       createOptionsTab(dialogData, spacing);
@@ -1035,7 +1036,7 @@ void showDotterDialog(GtkWidget *blxWindow, const gboolean resetValues)
   static DotterDialogData *dialogData = NULL;
 
   GtkWidget *dialog = getOrCreateDotterDialog(blxWindow, resetValues, &dialogData);
-  
+
   gtk_widget_show_all(dialog);
 
   onRefTypeToggled(NULL, dialogData);
@@ -1067,7 +1068,7 @@ static char* getDotterTitleSelectedSeq(const BlxContext *bc, const DotterRefType
   /* Get selected match seq name */
   GList *selectedSeqs = bc->getSelectedSeqsByType(BLXSEQUENCE_MATCH);
   const int numSeqs = g_list_length(selectedSeqs);
-  
+
   if (numSeqs == 1)
     {
       const BlxSequence *blxSeq = (const BlxSequence*)(selectedSeqs->data);
@@ -1081,9 +1082,9 @@ static char* getDotterTitleSelectedSeq(const BlxContext *bc, const DotterRefType
     {
       g_string_append_printf(resultStr, "<%d sequences>", numSeqs);
     }
-  
+
   result = g_string_free(resultStr, FALSE);
-  
+
   return result;
 }
 
@@ -1141,8 +1142,8 @@ static char *getDotterTitleSelf(const BlxContext *bc, const DotterRefType refTyp
 
 
 /* Get the title for the dotter dialog. */
-static char *getDotterTitle(const BlxContext *bc, 
-                            const DotterMatchType matchType, 
+static char *getDotterTitle(const BlxContext *bc,
+                            const DotterMatchType matchType,
                             const DotterRefType refType,
                             const char *adhocSeq)
 {
@@ -1151,15 +1152,15 @@ static char *getDotterTitle(const BlxContext *bc,
   switch (matchType)
     {
       default:
-      case BLXDOTTER_MATCH_SELECTED: 
+      case BLXDOTTER_MATCH_SELECTED:
         result = getDotterTitleSelectedSeq(bc, refType);
         break;
 
-      case BLXDOTTER_MATCH_ADHOC: 
+      case BLXDOTTER_MATCH_ADHOC:
         result = getDotterTitleAdhocSeq(bc, adhocSeq, refType);
         break;
 
-      case BLXDOTTER_MATCH_SELF: 
+      case BLXDOTTER_MATCH_SELF:
         result = getDotterTitleSelf(bc, refType);
         break;
     }
@@ -1173,17 +1174,17 @@ static char *getDotterTitle(const BlxContext *bc,
  *******************************************************************/
 
 /* Get the display coord version of the given coord (i.e. negated if the
- * 'negate coords' option is enabled and the display is reversed). Only 
+ * 'negate coords' option is enabled and the display is reversed). Only
  * applicable to reference sequence coords. */
 static int getDisplayCoord(const int coordIn, BlxContext *bc)
 {
   int result = coordIn;
-  
+
   if (bc->displayRev && bc->flags[BLXFLAG_NEGATE_COORDS])
     {
       result *= -1;
     }
-  
+
   return result;
 }
 
@@ -1191,28 +1192,28 @@ static int getDisplayCoord(const int coordIn, BlxContext *bc)
 /* Check whether the given dotter coord is within the blixem ref seq range.
  * The coord should be as the user sees it, i.e. negated if the 'negate coords'
  * option is enabled and the display is reversed - in this case in input arg
- * will be updated to reflect the real coord. 
- * Returns false and sets the error if not in range. Also sets the error but 
+ * will be updated to reflect the real coord.
+ * Returns false and sets the error if not in range. Also sets the error but
  * returns true if we succeeded but with a warning. */
 static gboolean boundsCheckDotterCoord(int *coordIn, BlxContext *bc, GError **error)
 {
   gboolean ok = TRUE;
-  
+
   const gboolean negate = bc->displayRev && bc->flags[BLXFLAG_NEGATE_COORDS];
-  
+
   int coord = *coordIn;
-  
+
   if (negate)
     {
       /* Display coords are negated - un-negate to get the real coord */
       coord *= -1;
     }
-  
+
   if (!valueWithinRange(coord, &bc->refSeqRange))
     {
       /* Try negating it in case the user missed the minus sign off. */
       coord *= -1;
-      
+
       if (valueWithinRange(coord, &bc->refSeqRange))
         {
           g_set_error(error, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_NEGATED_COORD,
@@ -1222,15 +1223,15 @@ static gboolean boundsCheckDotterCoord(int *coordIn, BlxContext *bc, GError **er
         {
           ok = FALSE;
           g_set_error(error, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_OUT_OF_RANGE,
-                      "Coord '%d' is outside reference sequence range [%d -> %d].\n", 
-                      *coordIn, 
+                      "Coord '%d' is outside reference sequence range [%d -> %d].\n",
+                      *coordIn,
                       (negate ? bc->refSeqRange.max() * -1 : bc->refSeqRange.min()),
                       (negate ? bc->refSeqRange.min() * -1 : bc->refSeqRange.max()));
         }
     }
-  
+
   *coordIn = coord;
-  
+
   return ok;
 }
 
@@ -1239,7 +1240,7 @@ static gboolean boundsCheckDotterCoord(int *coordIn, BlxContext *bc, GError **er
 char getDotterMode(const BlxBlastMode blastMode)
 {
   char type = ' ';
-  
+
   if (blastMode == BLXMODE_BLASTP || blastMode == BLXMODE_TBLASTN)
     {
       type = 'P';
@@ -1252,7 +1253,7 @@ char getDotterMode(const BlxBlastMode blastMode)
     {
       type = 'N';
     }
-  
+
   return type;
 }
 
@@ -1261,21 +1262,21 @@ char getDotterMode(const BlxBlastMode blastMode)
 /* Get the start/end coords. If the passed refType flag is auto, calculate coords
  * automatically - otherwise use the stored manual coords. If refType is transcript
  * then don't set the coords (they get set later) */
-static gboolean getDotterRange(GtkWidget *blxWindow, 
+static gboolean getDotterRange(GtkWidget *blxWindow,
                                const DotterMatchType matchType,
                                const DotterRefType refType,
-			       int *dotterStart, 
-			       int *dotterEnd, 
-			       int *dotterZoom, 
+			       int *dotterStart,
+			       int *dotterEnd,
+			       int *dotterZoom,
 			       GError **error)
 {
   g_return_val_if_fail(!error || *error == NULL, FALSE); /* if error is passed, its contents must be NULL */
 
   GError *tmpError = NULL;
   gboolean success = TRUE;
-  
+
   BlxContext *bc = blxWindowGetContext(blxWindow);
-  
+
 
   if (refType == BLXDOTTER_REF_TRANSCRIPT)
     {
@@ -1293,22 +1294,22 @@ static gboolean getDotterRange(GtkWidget *blxWindow,
   else if (refType == BLXDOTTER_REF_MANUAL)
     {
       /* Use manual coords */
-      if (dotterStart) 
+      if (dotterStart)
         *dotterStart = bc->dotterStart;
 
-      if (dotterEnd) 
+      if (dotterEnd)
         *dotterEnd = bc->dotterEnd;
 
-      if (dotterZoom) 
+      if (dotterZoom)
         *dotterZoom = bc->dotterZoom;
-      
+
       if ((dotterStart && *dotterStart == UNSET_INT) || (dotterEnd && *dotterEnd == UNSET_INT))
 	{
 	  g_debug("Manual dotter parameters were requested but one or more coord is not set (start=%d, end=%d). Calculating automatic parameters instead.\n",
 		  *dotterStart, *dotterEnd);
 	}
     }
-  
+
   if ((dotterStart && *dotterStart == UNSET_INT) || (dotterEnd && *dotterEnd == UNSET_INT))
     {
       /* Calculate automatic coords */
@@ -1325,16 +1326,16 @@ static gboolean getDotterRange(GtkWidget *blxWindow,
 
       GList *selectedSeqs = bc->getSelectedSeqsByType(BLXSEQUENCE_MATCH);
       GList *seqItem = selectedSeqs;
-      
+
       for ( ; seqItem; seqItem = seqItem->next)
         {
           const BlxSequence *seq = (const BlxSequence*)(seqItem->data);
-          GList *mspItem = seq->mspList;  
-          
+          GList *mspItem = seq->mspList;
+
           for ( ; mspItem ; mspItem = mspItem->next)
             {
               const MSP *msp = (MSP*)(mspItem->data);
-              
+
               if ((msp->qStrand == activeStrand || bc->blastMode == BLXMODE_BLASTN) &&
                   msp->qRange.min() <= qMax && msp->qRange.max() >= qMin)
                 {
@@ -1343,7 +1344,7 @@ static gboolean getDotterRange(GtkWidget *blxWindow,
                 }
             }
         }
-      
+
       if (!found)
         {
           g_set_error(&tmpError, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_NO_MATCHES,
@@ -1375,20 +1376,20 @@ static gboolean smartDotterRange(GtkWidget *blxWindow,
   GtkWidget *bigPicture = blxWindowGetBigPicture(blxWindow);
   BlxContext *bc = blxWindowGetContext(blxWindow);
   const IntRange* const displayRange = bigPictureGetDisplayRange(bigPicture);
-  
+
   /* Convert to DNA coords */
   int start = convertDisplayIdxToDnaIdx(displayRange->min(), bc->seqType, 1, 1, bc->numFrames, bc->displayRev, &bc->refSeqRange);
   int end = convertDisplayIdxToDnaIdx(displayRange->max(), bc->seqType, 1, 1, bc->numFrames, bc->displayRev, &bc->refSeqRange);
-  
+
   if (dotter_start_out)
     *dotter_start_out = start;
-  
+
   if (dotter_end_out)
     *dotter_end_out = end;
 
   boundsLimitValue(dotter_start_out, &bc->refSeqRange);
   boundsLimitValue(dotter_end_out, &bc->refSeqRange);
-  
+
   return TRUE;
 }
 
@@ -1407,8 +1408,8 @@ static gboolean smartDotterRange(GtkWidget *blxWindow,
  * Returns true but sets the error if there is a warning.
  * NOTE: This function assumes that only a single sequence can be selected at any one time. */
 static gboolean smartDotterRange(GtkWidget *blxWindow,
-				 const char *dotterSSeq, 
-				 int *dotter_start_out, 
+				 const char *dotterSSeq,
+				 int *dotter_start_out,
 				 int *dotter_end_out,
 				 GError **error)
 {
@@ -1432,12 +1433,12 @@ static gboolean smartDotterRange(GtkWidget *blxWindow,
    * query region from the extent of the HSP's that are completely within view. */
   const BlxSequence *selectedSeq = (const BlxSequence*)(selectedSeqs->data);
   int qMin = UNSET_INT, qMax = UNSET_INT;
-  GList *mspListItem = selectedSeq->mspList;  
-  
+  GList *mspListItem = selectedSeq->mspList;
+
   for ( ; mspListItem ; mspListItem = mspListItem->next)
     {
       const MSP *msp = (MSP*)(mspListItem->data);
-      
+
       /* Get the msp start/end in terms of display coords, and find the min/max */
       const IntRange* const mspDisplayRange = mspGetDisplayRange(msp);
 
@@ -1449,12 +1450,12 @@ static gboolean smartDotterRange(GtkWidget *blxWindow,
 	  int qSeqMax = msp->qRange.max;
 	  int sSeqMin = msp->sRange.min;
 	  int sSeqMax = msp->sRange.max;
-	  
+
 	  /* Extrapolate qMin backwards to the start of the match sequence (i.e. where
 	   * s==0) and qMax forwards to the end of the match sequence (i.e. where s==sLength). */
 	  int distToSMin = sSeqMin - 1;
 	  int distToSMax = 200; /* default amount if sequence not found or if mode is tblastn */
-	  
+
 	  if (bc->blastMode != BLXMODE_TBLASTN && dotterSSeq)
 	    {
 	      distToSMax = strlen(dotterSSeq) - sSeqMax;
@@ -1468,7 +1469,7 @@ static gboolean smartDotterRange(GtkWidget *blxWindow,
 	      distToSMax *= bc->numFrames;
 	    }
 
-	  /* If the strands are in opposite directions, the low end of the ref 
+	  /* If the strands are in opposite directions, the low end of the ref
 	   * sequence corresponds to the high of the match sequence, and vice versa. */
 	  const gboolean sameDirection = (mspGetRefStrand(msp) == mspGetMatchStrand(msp));
 	  qSeqMin -= sameDirection ? distToSMin : distToSMax;
@@ -1479,7 +1480,7 @@ static gboolean smartDotterRange(GtkWidget *blxWindow,
 	    {
 	      qMin = qSeqMin;
 	    }
-	  
+
 	  if (qMax == UNSET_INT || qSeqMax > qMax)
 	    {
 	      qMax = qSeqMax;
@@ -1490,13 +1491,13 @@ static gboolean smartDotterRange(GtkWidget *blxWindow,
   if (qMin == UNSET_INT && qMax == UNSET_INT)
     {
       /* No alignments found. Give a warning, and use the big picture range. */
-      g_set_error(error, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_NO_MATCHES, 
+      g_set_error(error, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_NO_MATCHES,
                   "There were no matches for the selected sequence(s) within the big picture range.\nZoom out to ensure alignments lie entirely within the big picture range.");
-      
+
       qMin = convertDisplayIdxToDnaIdx(bigPicRange->min, bc->seqType, 1, 1, bc->numFrames, bc->displayRev, &bc->refSeqRange);
       qMax = convertDisplayIdxToDnaIdx(bigPicRange->max, bc->seqType, 1, bc->numFrames, bc->numFrames, bc->displayRev, &bc->refSeqRange);
     }
-  
+
   /* Due to gaps, we might miss the ends - add some more */
   int extend = 0.1 * (qMax - qMin) ;
   qMin -= extend ;
@@ -1536,27 +1537,27 @@ static gboolean smartDotterRange(GtkWidget *blxWindow,
   boundsLimitValue(&qMin, &bc->refSeqRange);
   boundsLimitValue(&qMax, &bc->refSeqRange);
 
-  /* Return the start/end. The values start low and end high in normal 
+  /* Return the start/end. The values start low and end high in normal
    * left-to-right display, or vice-versa if the display is reversed. */
   *dotter_start_out = bc->displayRev ? qMax : qMin;
   *dotter_end_out = bc->displayRev ? qMin : qMax;
-  
+
   return TRUE;
 }
 #endif
 
 
 /* Utility to fetch the selected match sequence's DNA, or get it from the selected MSP.
- * This function assumes that if multiple MSPs are selected, that they are all for 
+ * This function assumes that if multiple MSPs are selected, that they are all for
  * the same match sequence. Returns null if no MSPs are selected, with details of the error
  * in 'error'.  If the sequence was found but there were warnings, it returns non-null with
  * the warnings in 'error'. The return value should be free'd with g_free */
 static char* getSelectedSequenceDNA(const BlxSequence *blxSeq, const BlxContext *bc, GError **error)
 {
   g_return_val_if_fail(!error || *error == NULL, FALSE); /* if error is passed, its contents must be NULL */
-  
+
   char *dotterSSeq = NULL;
-  
+
   /* If we're in seqbl mode, only part of the sequence is stored
    * internally, so try to fetch the full sequence.
    * gb10: I don't think this is applicable any more (or even if it
@@ -1569,9 +1570,9 @@ static char* getSelectedSequenceDNA(const BlxSequence *blxSeq, const BlxContext
     {
       /* Check if sequence is stored internally (i.e. it was passed from acedb) */
       g_debug("Looking for sequence stored internally... ");
-    
+
       dotterSSeq = g_strdup(blxSequenceGetSequence(blxSeq));
-      
+
       if (!dotterSSeq)
 	{
 	  g_debug("not found.\n");
@@ -1580,7 +1581,7 @@ static char* getSelectedSequenceDNA(const BlxSequence *blxSeq, const BlxContext
 	}
 
       g_debug("found.\n");
-      
+
       /* Dotter expects the passed sequence to be forwards and un-complemented but if this is
        * the reverse strand the sequence will be complemented, so un-complement it. */
       if (blxSeq->strand == BLXSTRAND_REVERSE)
@@ -1593,7 +1594,7 @@ static char* getSelectedSequenceDNA(const BlxSequence *blxSeq, const BlxContext
     {
       g_warning("The sequence for '%s' is incomplete.\n", blxSequenceGetName(blxSeq));
     }
-  
+
   return dotterSSeq;
 }
 
@@ -1608,7 +1609,7 @@ static const char* getDotterRefSeqName(const BlxContext *bc, const gboolean tran
       /* Get the sequence for a transcript */
       int num_found = 0;
       BlxSequence *transcriptSeq = bc->getSelectedTranscript(&num_found);
-      
+
       if (transcriptSeq)
         result = blxSequenceGetName(transcriptSeq);
       else if (num_found > 0)
@@ -1625,8 +1626,8 @@ static const char* getDotterRefSeqName(const BlxContext *bc, const gboolean tran
 /* Get the section of reference sequence to dotter against. Also sets the dotterRange if getting
  * the sequence for a transcript. */
 static char* getDotterRefSeq(GtkWidget *blxWindow,
-                             IntRange *dotterRange, 
-                             const int frame, 
+                             IntRange *dotterRange,
+                             const int frame,
                              const gboolean transcript,
                              const char** refSeqName_out,
                              GError **error)
@@ -1641,11 +1642,11 @@ static char* getDotterRefSeq(GtkWidget *blxWindow,
     {
       /* Get the sequence for a transcript */
       BlxSequence *transcriptSeq = blxWindowGetSelectedTranscript(blxWindow);
-      
+
       if (transcriptSeq)
         {
           result = blxSequenceGetSplicedSequence(transcriptSeq, bc->refSeq, &bc->refSeqRange, &tmpError);
-          
+
           if (refSeqName_out)
             *refSeqName_out = blxSequenceGetName(transcriptSeq);
         }
@@ -1657,7 +1658,7 @@ static char* getDotterRefSeq(GtkWidget *blxWindow,
           g_set_error(&tmpError, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_NO_TRANSCRIPT,
                       "Please select one (and only one) transcript to dotter against.\n\nUse Ctrl to select multiple features i.e. the transcript and the sequence(s) you want to dotter against it.");
         }
-      
+
       /* Set the range of coords of the result. */
       if (result)
         dotterRange->set(1, strlen(result));
@@ -1700,14 +1701,14 @@ static char *textViewGetText(GtkWidget *textView)
 
   GtkTextBuffer *textBuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textView));
   GtkTextIter start, end;
-  gtk_text_buffer_get_bounds(textBuffer, &start, &end);  
+  gtk_text_buffer_get_bounds(textBuffer, &start, &end);
 
   result = gtk_text_buffer_get_text(textBuffer, &start, &end, TRUE);
   return result;
 }
 
 
-/* Extract the sequence DNA from the text. Also sets the sequence name if 
+/* Extract the sequence DNA from the text. Also sets the sequence name if
  * the text is in fasta format; otherwise just expects the raw sequence. This also removes any
  * newlines or whitespace from the sequence */
 static void textGetSeqDetails(const char *text, char **sequence, char **sequenceName)
@@ -1720,7 +1721,7 @@ static void textGetSeqDetails(const char *text, char **sequence, char **sequence
   gboolean parsingHeader = FALSE;
   gboolean parsingName = FALSE;
   const char *cp = text;
-      
+
   for ( ; cp && *cp; ++cp)
     {
       if (*cp == '>')
@@ -1743,7 +1744,7 @@ static void textGetSeqDetails(const char *text, char **sequence, char **sequence
         }
       else if (parsingHeader)
         {
-          /* If parsing the name section of the header append it to the name (if name was 
+          /* If parsing the name section of the header append it to the name (if name was
            * requested). Ignore the rest of the header. */
           if (parsingName && sequenceName)
             {
@@ -1765,7 +1766,7 @@ static void textGetSeqDetails(const char *text, char **sequence, char **sequence
           g_string_append_c(sequenceStr, *cp);
         }
     }
-      
+
   if (sequenceStr && sequence)
     *sequence = g_string_free(sequenceStr, FALSE);
   else if (sequenceStr)
@@ -1778,7 +1779,7 @@ static void textGetSeqDetails(const char *text, char **sequence, char **sequence
 }
 
 
-/* Extract the sequence DNA from the text in the given widget. Also sets the sequence name if 
+/* Extract the sequence DNA from the text in the given widget. Also sets the sequence name if
  * the text is in fasta format; otherwise just expects the raw sequence. This also removes any
  * newlines or whitespace from the sequence */
 static void textViewGetSeqDetails(GtkWidget *textView, char **sequence, char **sequenceName)
@@ -1795,7 +1796,7 @@ static void textViewGetSeqDetails(GtkWidget *textView, char **sequence, char **s
 
 /* This actually executes the dotter child process */
 static GIOChannel* callDotterChildProcess(GtkWidget *blxWindow,
-                                          const char *dotterBinary, 
+                                          const char *dotterBinary,
                                           const int dotterZoom,
                                           const gboolean hspsOnly,
                                           const gboolean sleep,
@@ -1818,7 +1819,7 @@ static GIOChannel* callDotterChildProcess(GtkWidget *blxWindow,
   char *seq2OffsetStr = convertIntToString(seq2Range->min() - 1);
   char *seq1LenStr = convertIntToString(seq1Range->length());
   char *seq2LenStr = convertIntToString(seq2Range->length());
-  
+
   /* Create the argument list - start with any options we want to pass */
   GSList *argList = NULL;
   argList = g_slist_append(argList, g_strdup(dotterBinary));
@@ -1844,7 +1845,7 @@ static GIOChannel* callDotterChildProcess(GtkWidget *blxWindow,
 
   if (bc->windowColor)
     argList = g_slist_append(argList, g_strdup_printf("--session_colour=%s", bc->windowColor));
-  
+
   if (seq1Strand == BLXSTRAND_REVERSE)      argList = g_slist_append(argList, g_strdup("-r"));
   if (seq2Strand == BLXSTRAND_REVERSE)	    argList = g_slist_append(argList, g_strdup("-v"));
   if (seq1DisplayRev)			    argList = g_slist_append(argList, g_strdup("--reverse-h-display"));
@@ -1856,7 +1857,7 @@ static GIOChannel* callDotterChildProcess(GtkWidget *blxWindow,
   /* now tell Dotter that we're calling it internally from another SeqTools
    * program, so that it knows to expect piped data */
   argList = g_slist_append(argList, g_strdup("-S"));
-  
+
   /* Now pass the required arguments. These must be in the correct order. */
   argList = g_slist_append(argList, g_strdup(seq1Name));
   argList = g_slist_append(argList, seq1LenStr);
@@ -1885,7 +1886,7 @@ static GIOChannel* callDotterChildProcess(GtkWidget *blxWindow,
   char *argv[g_slist_length(argList)];
   GSList *item = argList;
   int i = 0;
-  
+
   for ( ; item; item = item->next)
     {
       char *arg = (char*)(item->data);
@@ -1894,7 +1895,7 @@ static GIOChannel* callDotterChildProcess(GtkWidget *blxWindow,
       DEBUG_OUT(", %s", arg  );
     }
   DEBUG_OUT("\n");
-    
+
   DEBUG_OUT("Executing dotter\n");
 
   int standard_input = 0;
@@ -1903,7 +1904,7 @@ static GIOChannel* callDotterChildProcess(GtkWidget *blxWindow,
                                          argv,
                                          NULL, //inherit parent's environment
                                          (GSpawnFlags)0,
-                                         NULL, 
+                                         NULL,
                                          NULL,
                                          childPid,
                                          &standard_input,
@@ -1921,7 +1922,7 @@ static GIOChannel* callDotterChildProcess(GtkWidget *blxWindow,
 /* Call dotter as an external process */
 gboolean callDotterExternal(GtkWidget *blxWindow,
                             BlxContext *bc,
-                            int dotterZoom, 
+                            int dotterZoom,
                             const gboolean hspsOnly,
                             const gboolean sleep,
                             const char *seq1Name,
@@ -1945,8 +1946,8 @@ gboolean callDotterExternal(GtkWidget *blxWindow,
   static char *dotterBinary = NULL;
 
   /* Open pipe to new dotterBinary */
-  if (!dotterBinary) 
-    { 
+  if (!dotterBinary)
+    {
       g_debug("Looking for Dotter ...\n");
       dotterBinary = g_find_program_in_path("dotter");
 
@@ -1957,14 +1958,14 @@ gboolean callDotterExternal(GtkWidget *blxWindow,
           return FALSE;
         }
     }
-  
+
   g_debug("Calling %s with region: %d,%d - %d,%d\n", dotterBinary, seq1Range->min(), seq2Range->min(), seq1Range->max(), seq2Range->max());
 
   /* Create the child process */
   GPid childPid = 0;
   gsize bytes_written = 0;
   GError *tmpError = NULL;
-  
+
   GIOChannel *ioChannel = callDotterChildProcess(blxWindow, dotterBinary, dotterZoom, hspsOnly, sleep,
                                                  seq1Name, seq1Range, seq1Strand, seq1DisplayRev,
                                                  seq2Name, seq2Range, seq2Strand, seq2DisplayRev,
@@ -2008,16 +2009,16 @@ gboolean callDotterExternal(GtkWidget *blxWindow,
       else
         {
           GList *seqItem = bc->matchSeqs;
-          for ( ; seqItem; seqItem = seqItem->next) 
+          for ( ; seqItem; seqItem = seqItem->next)
             {
               BlxSequence *blxSeq = (BlxSequence*)(seqItem->data);
               writeBlxSequenceToOutput(ioChannel, blxSeq, seq1Range, seq2Range, &tmpError);
             }
         }
-      
+
       DEBUG_OUT("...done\n");
     }
-      
+
   /* Close the channel */
   g_io_channel_shutdown(ioChannel, TRUE, NULL);
 
@@ -2028,9 +2029,9 @@ gboolean callDotterExternal(GtkWidget *blxWindow,
 }
 
 
-/* Call dotter on the given sequence. Returns true if dotter was called; 
+/* Call dotter on the given sequence. Returns true if dotter was called;
  * false if we quit trying. */
-gboolean callDotterOnSelectedSeq(GtkWidget *blxWindow, 
+gboolean callDotterOnSelectedSeq(GtkWidget *blxWindow,
                                  const gboolean hspsOnly,
                                  const gboolean sleep,
                                  const DotterRefType refType,
@@ -2048,7 +2049,7 @@ gboolean callDotterOnSelectedSeq(GtkWidget *blxWindow,
       g_set_error(error, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_INVALID_SEQ, "You must select a valid match sequence first.\n");
       return FALSE;
     }
-  
+
   /* We will display the active strand as the main strand in dotter */
   const BlxStrand qStrand = blxWindowGetActiveStrand(blxWindow);
 
@@ -2056,20 +2057,20 @@ gboolean callDotterOnSelectedSeq(GtkWidget *blxWindow,
     {
       GList *mspItem = selectedSeq->mspList;
       gboolean found = FALSE;
-      
+
       for ( ; mspItem && !found; mspItem = mspItem->next)
         {
           const MSP* const msp = (const MSP*)(mspItem->data);
           found = (msp->qStrand == qStrand);
         }
-      
+
       if (!found)
         {
           g_set_error(error, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_INVALID_STRAND, "You must select a match sequence on the active strand, or toggle strands first.\n");
           return FALSE;
         }
     }
-  
+
   /* Make a copy of the match sequence, because dotter takes ownership of this. */
   char *dotterSSeq = getSelectedSequenceDNA(selectedSeq, bc, NULL);
 
@@ -2078,11 +2079,11 @@ gboolean callDotterOnSelectedSeq(GtkWidget *blxWindow,
       g_set_error(error, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_NO_SEQ_DATA, "No sequence data for this sequence.\n");
       return FALSE;
     }
-  
+
   /* Get the coords */
   int dotterStart = UNSET_INT, dotterEnd = UNSET_INT, dotterZoom = 0;
   GError *rangeError = NULL;
-  
+
   gboolean ok = getDotterRange(blxWindow, BLXDOTTER_MATCH_SELECTED, refType, &dotterStart, &dotterEnd, &dotterZoom, &rangeError);
 
   if (!ok)
@@ -2099,15 +2100,15 @@ gboolean callDotterOnSelectedSeq(GtkWidget *blxWindow,
 
       char *title = g_strdup_printf("%sWarning", blxGetTitlePrefix(bc));
       ok = (runConfirmationBox(blxWindow, title, rangeError->message) == GTK_RESPONSE_ACCEPT);
-      
+
       g_free(title);
       g_error_free(rangeError);
       rangeError = NULL;
-      
+
       if (!ok)
 	return FALSE;
     }
-  
+
   /* Get the section of reference sequence that we're interested in */
   const int frame = mspGetRefFrame(firstMsp, bc->seqType);
   IntRange dotterRange;
@@ -2117,7 +2118,7 @@ gboolean callDotterOnSelectedSeq(GtkWidget *blxWindow,
   const gboolean transcript = (refType == BLXDOTTER_REF_TRANSCRIPT);
 
   char *refSeqSegment = getDotterRefSeq(blxWindow, &dotterRange, frame, transcript, &refSeqName, &seqError);
-  
+
   if (!refSeqSegment)
     {
       g_propagate_error(error, seqError);
@@ -2128,7 +2129,7 @@ gboolean callDotterOnSelectedSeq(GtkWidget *blxWindow,
       /* If there was an error set but the sequence was still returned then it's a non-critical warning */
       reportAndClearIfError(&seqError, G_LOG_LEVEL_WARNING);
     }
-  
+
   /* Get the match sequence name (chopping off the letters before the colon, if there is one). */
   const char *dotterSName = strchr(mspGetSName(firstMsp), ':');
   if (dotterSName)
@@ -2141,19 +2142,19 @@ gboolean callDotterOnSelectedSeq(GtkWidget *blxWindow,
     }
 
   IntRange sRange = {1, (int)strlen(dotterSSeq)};
-  
+
   const int offset = dotterRange.min() - 1;
   const BlxStrand refSeqStrand = blxWindowGetActiveStrand(blxWindow);
-  
+
   if (transcript)
     g_message("Calling dotter on %s vs %s\n", refSeqName, dotterSName);
   else
     g_message("Calling dotter on %s [%d,%d] vs %s\n", refSeqName, dotterStart, dotterEnd, dotterSName);
-  
+
   g_debug("reference sequence: name =  %s, offset = %d\n"
-          "    match sequence: name =  %s, offset = %d\n", 
+          "    match sequence: name =  %s, offset = %d\n",
           refSeqName, offset, dotterSName, 0);
-  
+
   const gboolean revHozScale = (refSeqStrand == BLXSTRAND_REVERSE);
   const gboolean revVertScale = FALSE; /* don't rev match seq scale, because it would show in dotter with -ve coords, but blixem always shows +ve coords */
   const gboolean clipRange = !transcript; /* don't clip the range if using a transcript range */
@@ -2170,9 +2171,9 @@ gboolean callDotterOnSelectedSeq(GtkWidget *blxWindow,
 }
 
 
-/* Call dotter on the currently-selected sequence(s). Returns true if all dotters were; 
+/* Call dotter on the currently-selected sequence(s). Returns true if all dotters were;
  * successful; false if there was a problem. */
-gboolean callDotterOnSelectedSeqs(GtkWidget *blxWindow, 
+gboolean callDotterOnSelectedSeqs(GtkWidget *blxWindow,
                                   const gboolean hspsOnly,
                                   const gboolean startup_sleep,
                                   const DotterRefType refType,
@@ -2185,7 +2186,7 @@ gboolean callDotterOnSelectedSeqs(GtkWidget *blxWindow,
   GList *selectedSeqs = blxWindowGetSelectedSeqsByType(blxWindow, BLXSEQUENCE_MATCH);
 
   const int numSeqsSelected = g_list_length(selectedSeqs);
-  
+
   if (numSeqsSelected < 1)
     {
       g_set_error(error, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_NO_SEQS, "There are no sequences selected.\n");
@@ -2201,7 +2202,7 @@ gboolean callDotterOnSelectedSeqs(GtkWidget *blxWindow,
 
           if (runConfirmationBox(blxWindow, "Run multiple dotters", msg) != GTK_RESPONSE_ACCEPT)
             ok = FALSE;
-            
+
           g_free(msg);
         }
 
@@ -2223,17 +2224,17 @@ gboolean callDotterOnSelectedSeqs(GtkWidget *blxWindow,
 }
 
 
-/* Call dotter on the manually-entered adhoc sequence. Returns true if dotter 
+/* Call dotter on the manually-entered adhoc sequence. Returns true if dotter
  * was called; false if we quit trying. */
 gboolean callDotterOnAdhocSeq(DotterDialogData *dialogData, GError **error)
 {
   gboolean result = FALSE;
   g_return_val_if_fail(!error || *error == NULL, result); /* if error is passed it must be NULL */
-  
+
   GtkWidget *blxWindow = dialogData->blxWindow;
   BlxContext *bc = blxWindowGetContext(blxWindow);
   const gboolean transcript = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialogData->transcriptButton));
-  
+
   /* We will display the active strand as the main strand in dotter */
   const BlxStrand qStrand = blxWindowGetActiveStrand(blxWindow);
 
@@ -2241,7 +2242,7 @@ gboolean callDotterOnAdhocSeq(DotterDialogData *dialogData, GError **error)
   char *dotterSName = NULL;
   char *dotterSSeq = NULL;
   textViewGetSeqDetails(dialogData->adhocSeqText, &dotterSSeq, &dotterSName);
-  
+
   if (!dotterSSeq || *dotterSSeq == 0)
     {
       g_set_error(error, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_NO_SEQS, "Please enter a sequence into the entry box.\n");
@@ -2257,7 +2258,7 @@ gboolean callDotterOnAdhocSeq(DotterDialogData *dialogData, GError **error)
   /* Get the coords */
   int dotterStart = UNSET_INT, dotterEnd = UNSET_INT, dotterZoom = 0;
   GError *rangeError = NULL;
-  
+
   gboolean ok = getDotterRange(blxWindow, dialogData->matchType, dialogData->refType, &dotterStart, &dotterEnd, &dotterZoom, &rangeError);
 
   if (!ok)
@@ -2266,7 +2267,7 @@ gboolean callDotterOnAdhocSeq(DotterDialogData *dialogData, GError **error)
       g_propagate_error(error, rangeError);
       return FALSE;
     }
-  
+
   /* Get the section of reference sequence that we're interested in */
   const int frame = 1;
   IntRange dotterRange;
@@ -2275,7 +2276,7 @@ gboolean callDotterOnAdhocSeq(DotterDialogData *dialogData, GError **error)
   const char *refSeqName = NULL;
 
   char *refSeqSegment = getDotterRefSeq(blxWindow, &dotterRange, frame, transcript, &refSeqName, &seqError);
-  
+
   if (!refSeqSegment)
     {
       g_propagate_error(error, seqError);
@@ -2288,19 +2289,19 @@ gboolean callDotterOnAdhocSeq(DotterDialogData *dialogData, GError **error)
     }
 
   IntRange sRange = {1, (int)strlen(dotterSSeq)};
-  
+
   const int offset = dotterRange.min() - 1;
   const BlxStrand refSeqStrand = blxWindowGetActiveStrand(blxWindow);
-  
+
   if (transcript)
     g_message("Calling dotter on %s vs %s\n", refSeqName, dotterSName);
   else
     g_message("Calling dotter on %s [%d,%d] vs %s\n", refSeqName, dotterStart, dotterEnd, dotterSName);
-  
+
   g_debug("reference sequence: name =  %s, offset = %d\n"
-          "    match sequence: name =  %s, offset = %d\n", 
+          "    match sequence: name =  %s, offset = %d\n",
           refSeqName, offset, dotterSName, 0);
-  
+
   const gboolean revHozScale = (refSeqStrand == BLXSTRAND_REVERSE);
   const gboolean revVertScale = FALSE; /* don't rev match seq scale, because it would show in dotter with -ve coords, but blixem always shows +ve coords */
   const gboolean clipRange = !transcript; /* don't clip the range if using a transcript range */
@@ -2317,7 +2318,7 @@ gboolean callDotterOnAdhocSeq(DotterDialogData *dialogData, GError **error)
 
   /* dotter takes ownership of dotterSSeq but not dotterSName, so free it */
   g_free(dotterSName);
-  
+
   return result;
 }
 
@@ -2327,38 +2328,38 @@ gboolean callDotterOnAdhocSeq(DotterDialogData *dialogData, GError **error)
  * The follow notes on this are from http://sonnhammer.sbc.su.se/Dotter.html:
  *
  * When looking for overlaps between many sequences, for instance when assembling contigs, it can
- * be uselful to make a dotplot of all sequences vs. each other. This way any overlap will show up 
- * as a diagonal in the corner of a subsequence dotplot. Dotter has a built-in mechanism for this. 
+ * be uselful to make a dotplot of all sequences vs. each other. This way any overlap will show up
+ * as a diagonal in the corner of a subsequence dotplot. Dotter has a built-in mechanism for this.
  * To run Dotter on many sequences at once, concatenate the sequence files (in fasta format). Then
  * run dotter on the concatenated sequence file against itself, and green partitioning lines will
- * appear between the sequences. At each partitioning line, the name of the following sequence is 
+ * appear between the sequences. At each partitioning line, the name of the following sequence is
  * printed. These lines can be turned on and off with the button "Draw lines a segment ends" in
- * the "Feature series selection tool", which is launched from the main menu. 
+ * the "Feature series selection tool", which is launched from the main menu.
  */
 static gboolean callDotterOnSelf(DotterDialogData *dialogData, GError **error)
 {
   GtkWidget *blxWindow = dialogData->blxWindow;
   BlxContext *bc = blxWindowGetContext(blxWindow);
-  
+
   /* Get the auto range, if requested */
   int dotterStart = UNSET_INT;
   int dotterEnd = UNSET_INT;
   int dotterZoom = 0;
-  
+
   GError *tmpError = NULL;
   if (!getDotterRange(blxWindow, dialogData->matchType, dialogData->refType, &dotterStart, &dotterEnd, &dotterZoom, &tmpError))
     {
       g_propagate_error(error, tmpError);
       return FALSE;
     }
-  
+
   /* Get the section of reference sequence that we're interested in */
   const BlxStrand qStrand = blxWindowGetActiveStrand(blxWindow);
   const int frame = 1;
   IntRange qRange;
   qRange.set(dotterStart, dotterEnd);
   const char *refSeqName = NULL;
-    
+
   const gboolean transcript = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialogData->transcriptButton));
   char *refSeqSegment = getDotterRefSeq(blxWindow, &qRange, frame, transcript, &refSeqName, &tmpError);
 
@@ -2372,12 +2373,12 @@ static gboolean callDotterOnSelf(DotterDialogData *dialogData, GError **error)
       /* If there's an error but the sequence was still returned it's a non-critical warning */
       reportAndClearIfError(&tmpError, G_LOG_LEVEL_WARNING);
     }
-  
+
   /* Make a copy of the reference sequence segment to pass as the match sequence */
   char *dotterSSeq = g_strdup(refSeqSegment);
 
   const gboolean revScale = (qStrand == BLXSTRAND_REVERSE);
-  
+
   if (transcript)
     g_message("Calling dotter on %s vs itself\n", refSeqName);
   else
@@ -2395,4 +2396,3 @@ static gboolean callDotterOnSelf(DotterDialogData *dialogData, GError **error)
 
   return TRUE;
 }
-
diff --git a/src/blixemApp/blxdotter.hpp b/src/blixemApp/blxdotter.hpp
index 3c74f6efbbadccc9c5c980dfca9b00b933357e95..8e09a3f5a06f2b3f5d5a49239297df0a31b2f671 100644
--- a/src/blixemApp/blxdotter.hpp
+++ b/src/blixemApp/blxdotter.hpp
@@ -1,5 +1,6 @@
 /*  File: blxdotter.h
  *  Author: Gemma Barson, 2010-02-03
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -28,18 +29,18 @@
  *      Roy Storey        (Sanger Institute, UK)  <rds@sanger.ac.uk>
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
- * Description: Provides functionality to call Dotter as an external 
+ * Description: Provides functionality to call Dotter as an external
  *              application.
- *              
+ *
  *              Determines which sequences to call Dotter with based on the
  *              current selection in Blixem. Provides a dialog allowing the
- *              user to set certain parameters and optionally calculates a 
+ *              user to set certain parameters and optionally calculates a
  *              sensible coordinate range to call Dotter with.
  *
  *              Generally Dotter will be called with one alignment sequence vs
  *              a relevant portion of the reference sequence. It can also be
  *              called on the reference sequence vs itself. This is useful if
- *              the reference sequence has been constructed from several 
+ *              the reference sequence has been constructed from several
  *              sequences concatenated together and one wishes to identify
  *              alignments between those sequences.
  *----------------------------------------------------------------------------
diff --git a/src/blixemApp/blxmain.cpp b/src/blixemApp/blxmain.cpp
index 183f6988e66bbba972c37f98c30eb8ddd5899b3f..4f345501471316f840243aeb6fe5ecdccc6c897a 100644
--- a/src/blixemApp/blxmain.cpp
+++ b/src/blixemApp/blxmain.cpp
@@ -1,5 +1,6 @@
 /*  File: blxmain.c
  *  Author: Erik Sonnhammer, 1999-08-26
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -51,7 +52,7 @@
 gboolean blixem_debug_G = FALSE ;
 
 
-/* Usage text. This is a duplicate of the text that is in 
+/* Usage text. This is a duplicate of the text that is in
  * doc/User_doc/blixem_usage.txt, so ideally we would get rid of this and use
  * the text from the file instead; for now, we must update both. */
 
@@ -262,7 +263,7 @@ MSPcrunch\n\
 \n\
  o The BLAST program (blastp, blastn, blastx, tblastn, tblastx)\n\
    is automatically detected from the Blast output header by MSPcrunch\n\
-   and is passed on to Blixem in the seqbl format (-q).\n\n" 
+   and is passed on to Blixem in the seqbl format (-q).\n\n"
 
 
 /* set default values for command lines options */
@@ -277,22 +278,22 @@ static void initCommandLineOptions(CommandLineOptions *options, char *refSeqName
   options->columnList = NULL;
   options->geneticCode = stdcode1;
   options->activeStrand = BLXSTRAND_FORWARD;
-  options->bigPictZoom = 10;          
-  
+  options->bigPictZoom = 10;
+
   options->zoomWhole = FALSE;
-  options->bigPictON = TRUE;          
-  options->hideInactive = FALSE;         
+  options->bigPictON = TRUE;
+  options->hideInactive = FALSE;
   options->initSortColumn = BLXCOL_ID;
-  options->sortInverted = FALSE;        
-  options->highlightDiffs = FALSE;   
-  options->dotterFirst = FALSE; 
+  options->sortInverted = FALSE;
+  options->highlightDiffs = FALSE;
+  options->dotterFirst = FALSE;
   options->startNextMatch = FALSE;
   options->squashMatches = FALSE;
   options->optionalColumns = FALSE;
   options->saveTempFiles = FALSE;
   options->coverageOn = FALSE;
   options->abbrevTitle = FALSE;
-  
+
   options->blastMode = BLXMODE_UNSET;
   options->seqType = BLXSEQ_NONE;
   options->numFrames = 1;
@@ -321,14 +322,14 @@ static void validateOptions(CommandLineOptions *options)
 static BlxSeqType getSeqTypeFromChar(char seqChar)
 {
   BlxSeqType result = BLXSEQ_NONE;
-  
+
   if (seqChar == 'n' || seqChar == 'N')
     result = BLXSEQ_DNA;
   else if (seqChar == 'p' || seqChar == 'P')
     result = BLXSEQ_PEPTIDE;
   else
     g_error("Bad display mode '%c'\n", seqChar);
-  
+
   return result;
 }
 
@@ -337,7 +338,7 @@ static BlxSeqType getSeqTypeFromChar(char seqChar)
 static BlxColumnId getSortModeFromChar(char sortChar)
 {
   BlxColumnId result = BLXCOL_NONE;
-  
+
   switch (sortChar)
   {
     case 's':
@@ -366,9 +367,9 @@ static BlxColumnId getSortModeFromChar(char sortChar)
       break;
 
     default:
-      g_error("Bad sort mode: %c\n", sortChar); 
+      g_error("Bad sort mode: %c\n", sortChar);
   }
-  
+
   return result;
 }
 
@@ -379,15 +380,15 @@ static char* getSupportedTypesAsString(GSList *supportedTypes)
 {
   GString *resultStr = g_string_new(NULL);
   GSList *item = supportedTypes;
-  
+
   for ( ; item; item = item->next)
     {
       BlxGffType *gffType = (BlxGffType*)(item->data);
       g_string_append_printf(resultStr, "    %s\n", gffType->name);
     }
-  
+
   char *result = g_string_free(resultStr, FALSE);
-  
+
   return result;
 }
 
@@ -411,7 +412,7 @@ static void showHelpText(GSList *supportedTypes, const int exitCode)
   GString *resultStr = g_string_new(USAGE_TEXT);
 
   char *supported_types_string = getSupportedTypesAsString(supportedTypes);
-  
+
   g_string_append_printf(resultStr, HELP_TEXT, supported_types_string);
   g_string_append(resultStr, FOOTER_TEXT);
 
@@ -420,7 +421,7 @@ static void showHelpText(GSList *supportedTypes, const int exitCode)
     g_message_info("%s", resultStr->str);
   else
     g_message("%s", resultStr->str);
-  
+
   g_free(supported_types_string);
   g_string_free(resultStr, TRUE);
 }
@@ -429,13 +430,13 @@ static void showHelpText(GSList *supportedTypes, const int exitCode)
 /* Prints version info to stderr */
 static void showVersionInfo()
 {
-  g_message(VERSION_TEXT);  
+  g_message(VERSION_TEXT);
 }
 
 /* Prints compiled date (must go to stdout for our build scripts to work) */
 static void showCompiledInfo()
 {
-  g_message("%s\n", UT_MAKE_COMPILE_DATE());  
+  g_message("%s\n", UT_MAKE_COMPILE_DATE());
 }
 
 
@@ -452,11 +453,11 @@ int main(int argc, char **argv)
   FILE *seqfile = NULL, *FSfile = NULL;
   char *seqfilename = NULL;
   char *FSfilename = NULL;
-  
+
   int install = 1;
   static gboolean showVersion = FALSE;      /* gets set to true if blixem was called with --version option */
   static gboolean showCompiled = FALSE;     /* gets set to true if blixem was called with --compiled option */
-  
+
   static gboolean rm_input_files = FALSE ; /* whether to remove input files once we're done with them */
   PfetchParams *pfetch = NULL ;
   gboolean xtra_data = FALSE ;      /* whether we have an extra data file to parse */
@@ -466,22 +467,22 @@ int main(int argc, char **argv)
   char *config_file = NULL ;        /* optional blixem config file (usually "blixemrc") */
   char *key_file = NULL ;           /* optional keyword file for passing style information */
   GError *error = NULL ;
- 
+
   char refSeqName[FULLNAMESIZE+1] = "";
 
   static CommandLineOptions options;
   initCommandLineOptions(&options, refSeqName);
- 
+
   /* Set up the GLib message handlers
-   * 
+   *
    * There are two handlers: the default one for all non-critical messages, which will just log
-   * output to the console, and one for critical messages and errors, which will display a 
+   * output to the console, and one for critical messages and errors, which will display a
    * pop-up message (the idea being that we don't bother the user unless it's something serious).
-   * So, to get a pop-up message use g_critical, and to log a message or warning use g_message, 
+   * So, to get a pop-up message use g_critical, and to log a message or warning use g_message,
    * g_warning, g_debug etc. Note that g_error is always fatal.
    */
   g_log_set_default_handler(defaultMessageHandler, &options.msgData);
-  g_log_set_handler(NULL, (GLogLevelFlags)(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), 
+  g_log_set_handler(NULL, (GLogLevelFlags)(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION),
                     popupMessageHandler, &options.msgData);
 
   /* Get the list of supported GFF types, in case we need to print them out in the usage text */
@@ -518,8 +519,8 @@ int main(int argc, char **argv)
       {"sequence-file",         required_argument,  0, 'e'},
       {"help",                  no_argument,        0, 'h'},
       {"disable-install",       no_argument,        0, 'i'}, /* "secret" option (hide from user) */
-      {"map-coords",            required_argument,  0, 'm'}, 
-      {"negate-coords",         no_argument,        0, 'n'}, 
+      {"map-coords",            required_argument,  0, 'm'},
+      {"negate-coords",         no_argument,        0, 'n'},
       {"offset",                required_argument,  0, 'o'},
       {"reverse-strand",        no_argument,        0, 'r'},
       {"start-coord",           required_argument,  0, 's'},
@@ -554,7 +555,7 @@ int main(int argc, char **argv)
                 pfetch = new PfetchParams;
                 pfetch->net_id = strtok(optarg, ":") ;
                 pfetch->port = atoi(strtok(NULL, ":")) ;
-              }                
+              }
             else if (stringsEqual(long_options[optionIndex].name, "sort-mode", TRUE))
               {
                 options.initSortColumn = getSortModeFromChar(*optarg);
@@ -563,24 +564,24 @@ int main(int argc, char **argv)
               {
                 options.dataset = g_strdup(optarg);
               }
-          break; 
-          
+          break;
+
         case '?':
           break; /* getopt_long already printed an error message */
-          
+
         case 'a':
           align_types = g_strdup_printf("%s", optarg) ;
           break;
-        case 'c': 
+        case 'c':
           config_file = g_strdup(optarg) ;
           break;
-        case 'd': 
+        case 'd':
           FSfilename = g_strdup(optarg) ;
           break;
-        case 'e': 
+        case 'e':
           seqfilename = g_strdup(optarg) ;
           break;
-        case 'h': 
+        case 'h':
           {
             showHelpText(supportedTypes, EXIT_SUCCESS);
             exit(EXIT_SUCCESS) ;
@@ -593,12 +594,12 @@ int main(int argc, char **argv)
           {
             options.mapCoords = TRUE;
             options.mapCoordsFrom = atoi(optarg); /* will ignore anything after ':', if it exists */
-              
+
             /* Optionally there may be a second number after a ':' character */
             const char *cp = strchr(optarg, ':');
             if (cp)
               options.mapCoordsTo = atoi(cp + 1);
-              
+
             break;
           }
         case 'n':
@@ -610,7 +611,7 @@ int main(int argc, char **argv)
         case 'r':
           options.activeStrand = BLXSTRAND_REVERSE;
           break ;
-        case 's': 
+        case 's':
           options.startCoord = atoi(optarg);
           options.startCoordSet = TRUE;
           break;
@@ -620,23 +621,23 @@ int main(int argc, char **argv)
         case 'w':
           wait = TRUE;
           break ;
-        case 'x': 
+        case 'x':
           xtra_data = TRUE ;
           strcpy(xtra_filename, optarg);
           break;
         case 'y':
           key_file = g_strdup(optarg) ;
           break;
-        case 'z': 
+        case 'z':
           {
             int coord1 = atoi(optarg); /* will ignore anything after ':' */
             const char *cp = strchr(optarg, ':');
-              
+
             if (cp)
               {
                 int coord2 = atoi(cp + 1);
                 options.bigPictRange.set(coord1, coord2);
-                
+
                 /* If the start coord hasn't already been specified on the
                  * command line, base the default start on the centre of the
                  * big picture range (can still be overridden if start coord
@@ -648,10 +649,10 @@ int main(int argc, char **argv)
               {
                 g_warning("Invalid parameters for --zoom-range argument; expected <start:end> but got '%s'. Zoom range will be ignored.\n", optarg);
               }
-              
+
             break;
           }
-            
+
         default : g_error("Illegal option\n");
         }
     }
@@ -685,7 +686,7 @@ int main(int argc, char **argv)
    * (It's quick and dirty to destroy recreate this but it's a small list and only done once.) */
   blxDestroyGffTypeList(&supportedTypes);
   supportedTypes = blxCreateSupportedGffTypeList(options.seqType);
-  
+
   const int numFiles = argc - optind;
 
   /* Add -install for private colormaps */
@@ -703,7 +704,7 @@ int main(int argc, char **argv)
       else
         options.refSeqOffset = options.mapCoordsTo - options.mapCoordsFrom;
     }
-  
+
   /* Set up program configuration. */
   blxInitConfig(config_file, &options, &error);
   reportAndClearIfError(&error, G_LOG_LEVEL_WARNING);
@@ -733,7 +734,7 @@ int main(int argc, char **argv)
           seqfilename = g_strdup(argv[optind]);
           FSfilename = g_strdup(argv[optind+1]);
         }
-      else 
+      else
         {
           if (seqfilename && FSfilename)
             g_error("Sequence file and data file specified twice - please specify these as the last arguments OR using the -e and -d arguments.");
@@ -757,13 +758,13 @@ int main(int argc, char **argv)
     {
       g_error("Cannot open file %s\n", FSfilename);
     }
-  
+
   /* Parser compiles lists of MSPs per type into the following array. Initialise each GList in the array to NULL */
   GArray* featureLists[BLXMSP_NUM_TYPES];
   int typeId = 0;
   for ( ; typeId < BLXMSP_NUM_TYPES; ++typeId)
     featureLists[typeId] = g_array_new(TRUE, FALSE, sizeof(MSP*));
-  
+
   GList *seqList = NULL; /* parser compiles a list of BlxSequences into this list */
 
   char *dummyseq = NULL;    /* Needed for blxparser to handle both dotter and blixem */
@@ -774,7 +775,7 @@ int main(int argc, char **argv)
 
   /* Pass the config file to parseFS */
   GKeyFile *inputConfigFile = blxGetConfig();
-  
+
   /* Create a temporary lookup table for BlxSequences so we can link them on GFF ID */
   GHashTable *lookupTable = g_hash_table_new(g_direct_hash, g_direct_equal);
 
@@ -783,7 +784,7 @@ int main(int argc, char **argv)
    * of blastmode at some point). */
   if (options.blastMode == BLXMODE_UNSET && options.seqType != BLXSEQ_NONE)
     options.blastMode = (options.seqType == BLXSEQ_PEPTIDE ? BLXMODE_BLASTX : BLXMODE_BLASTN);
-  
+
   if (FSfile)
     {
       parseFS(&options.mspList, FSfile, &options.blastMode, featureLists, &seqList, options.columnList, supportedTypes, styles,
@@ -791,7 +792,7 @@ int main(int argc, char **argv)
               options.fetchMethods, &error) ;
     }
 
-  reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);  
+  reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
 
   /* Now see if blast mode was set and set seqtype from it if not already set... */
   if (options.seqType == BLXSEQ_NONE && options.blastMode != BLXMODE_UNSET)
@@ -806,22 +807,22 @@ int main(int argc, char **argv)
         seqfile = stdin;
       else if(!(seqfile = fopen(seqfilename, "r")))
         g_error("Cannot open %s\n", seqfilename);
-      
+
       /* Read in the reference sequence */
       int startCoord = UNSET_INT;
       int endCoord = UNSET_INT;
       options.refSeq = readFastaSeq(seqfile, options.refSeqName, &startCoord, &endCoord, options.seqType);
-      
+
       if (startCoord != UNSET_INT && endCoord != UNSET_INT)
         options.refSeqRange.set(startCoord, endCoord);
-      
+
       if (seqfile != stdin)
         fclose(seqfile);
     }
-  
+
   if (!options.refSeq)
     g_error("No reference sequence supplied.");
-  
+
   /* If the ref seq range still has not been set, use 1-based coords */
   if (!options.refSeqRange.isSet())
     {
@@ -840,7 +841,7 @@ int main(int argc, char **argv)
         {
           g_error("Cannot open %s\n", xtra_filename) ;
         }
-      
+
       parseFS(&options.mspList, xtra_file, &options.blastMode, featureLists, &seqList, options.columnList, supportedTypes, styles,
               &options.refSeq, options.refSeqName, NULL, &dummyseq, dummyseqname, blxGetConfig(), lookupTable, options.fetchMethods, &error) ;
 
@@ -857,14 +858,14 @@ int main(int argc, char **argv)
           g_warning("Unlink of sequence input file \"%s\" failed: %s\n", seqfilename, msg) ;
           g_free(msg);
         }
-        
+
       if(FSfilename && FSfilename[0] != '\0' && unlink(FSfilename) != 0)
         {
           char *msg = getSystemErrorText();
           g_warning("Unlink of MSP input file \"%s\" failed: %s\n", FSfilename, msg) ;
           g_free(msg);
         }
-        
+
       if (xtra_filename[0] != '\0' && unlink(xtra_filename) != 0)
         {
           char *msg = getSystemErrorText();
@@ -879,14 +880,14 @@ int main(int argc, char **argv)
 
   if (FSfilename)
     g_free(FSfilename);
-  
+
   /* Now display the alignments. (Note that TRUE signals blxview() that it is being called from
    * this standalone blixem program instead of as part of acedb. */
   if (blxview(&options, featureLists, seqList, supportedTypes, pfetch, align_types, TRUE, styles, lookupTable))
     {
       gtk_main();
     }
- 
+
   g_free(key_file);
   g_free(config_file);
   g_hash_table_unref(lookupTable);
@@ -894,6 +895,3 @@ int main(int argc, char **argv)
   printf("Exiting Blixem\n");
   return (EXIT_SUCCESS) ;
 }
-
-
-
diff --git a/src/blixemApp/blxpanel.cpp b/src/blixemApp/blxpanel.cpp
index 2e600ea93e25d766c9cc0262abc46bbd7d36ccad..7c4ad932eebbaeef1d4d0eaf90ded34f0ad47707 100644
--- a/src/blixemApp/blxpanel.cpp
+++ b/src/blixemApp/blxpanel.cpp
@@ -1,5 +1,6 @@
 /*  File: blxpanel.cpp
  *  Author: Gemma Barson, 2016-04-07
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -46,13 +47,13 @@ namespace
 
 
 /* Convert an x coord in the given rectangle to a base index (in nucleotide coords) */
-static gint convertRectPosToBaseIdx(const gint x, 
-                                    const GdkRectangle* const displayRect,  
+static gint convertRectPosToBaseIdx(const gint x,
+                                    const GdkRectangle* const displayRect,
                                     const IntRange* const dnaDispRange,
                                     const gboolean displayRev)
 {
   gint result = UNSET_INT;
-  
+
   gdouble distFromEdge = (gdouble)(x - displayRect->x);
   int basesFromEdge = (int)(distFromEdge / pixelsPerBase(displayRect->width, dnaDispRange));
 
@@ -64,33 +65,33 @@ static gint convertRectPosToBaseIdx(const gint x,
     {
       result = dnaDispRange->min() + basesFromEdge;
     }
-  
+
   return result;
 }
 
 
-/* Given the centre x coord of a rectangle and its width, find the x coord of the 
+/* Given the centre x coord of a rectangle and its width, find the x coord of the
  * left edge. If an outer rectangle is given, limit the coord so that the
  * rectangle lies entirely within the outer rect. */
 int getLeftCoordFromCentre(const int centreCoord, const int width, const GdkRectangle *outerRect)
 {
   int leftCoord = centreCoord - roundNearest((double)width / 2.0);
-  
+
   if (outerRect)
     {
-      if (leftCoord < outerRect->x) 
+      if (leftCoord < outerRect->x)
 	leftCoord = outerRect->x;
       else
 	{
 	  int leftCoordMax = outerRect->x + outerRect->width - width;
-	  
-	  if (leftCoord > leftCoordMax) 
+
+	  if (leftCoord > leftCoordMax)
 	    {
 	      leftCoord = leftCoordMax;
 	    }
 	}
     }
-  
+
   return leftCoord;
 }
 
@@ -102,7 +103,7 @@ int getLeftCoordFromCentre(const int centreCoord, const int width, const GdkRect
 
 
 /* Default constructor */
-BlxPanel::BlxPanel() : 
+BlxPanel::BlxPanel() :
   displayRange(0, 0),
   m_widget(NULL),
   m_blxWindow(NULL),
@@ -116,8 +117,8 @@ BlxPanel::BlxPanel() :
 };
 
 /* Constructor */
-BlxPanel::BlxPanel(GtkWidget *widget_in, 
-                   GtkWidget *blxWindow_in, 
+BlxPanel::BlxPanel(GtkWidget *widget_in,
+                   GtkWidget *blxWindow_in,
                    BlxContext *bc_in,
                    CoverageViewProperties *coverageViewP_in,
                    int previewBoxCentre_in) :
@@ -202,7 +203,7 @@ void BlxPanel::refreshDisplayRange(const bool keepCentered)
 {
 }
 
- 
+
 /* Show a preview box centred on the given x coord. If init is true, we're initialising
  * a drag; otherwise, we're already dragging */
 void BlxPanel::startPreviewBox(const int x, const gboolean init, const int offset)
@@ -245,34 +246,34 @@ void BlxPanel::finishPreviewBox(const int xCentreIn, GdkRectangle *displayRect,
 
   /* Apply any offset required to get the real centre coord */
   const int xCentre = xCentreIn + m_previewBoxOffset;
-  
+
   /* Get the display range in dna coords */
   IntRange dnaDispRange;
   convertDisplayRangeToDnaRange(&displayRange, m_bc->seqType, m_bc->numFrames, m_bc->displayRev, &m_bc->refSeqRange, &dnaDispRange);
-  
+
   /* Find the base index where the new scroll range will start. This is the leftmost
-   * edge of the preview box if numbers increase in the normal left-to-right direction, 
+   * edge of the preview box if numbers increase in the normal left-to-right direction,
    * or the rightmost edge if the display is reversed. */
   const int x = getLeftCoordFromCentre(xCentre, highlightRect->width, displayRect);
   int baseIdx = convertRectPosToBaseIdx(x, displayRect, &dnaDispRange, m_bc->displayRev);
-  
+
   /* Subtract 1 if the display is reversed to give the base to the right of x, rather than the base to the left of x */
   if (m_bc->displayRev)
     --baseIdx;
-  
+
   /* Reset the preview box status. We don't need to un-draw it because we
    * will redraw the whole big picture below. */
   m_previewBoxOn = FALSE;
   m_previewBoxOffset = 0;
-  
+
   /* Perform any required updates following the change to the highlight box position. The base
    * index is in terms of the nucleotide coords so we need to convert to display coords */
   const int displayIdx = convertDnaIdxToDisplayIdx(baseIdx, m_bc->seqType, 1, m_bc->numFrames, m_bc->displayRev, &m_bc->refSeqRange, NULL);
   onHighlightBoxMoved(displayIdx, m_bc->seqType);
-  
+
   /* Re-centre the panel */
   refreshDisplayRange(TRUE);
-  
+
   gtk_widget_queue_draw(widget());
 }
 
@@ -283,8 +284,8 @@ void BlxPanel::onHighlightBoxMoved(const int displayIdx, const BlxSeqType seqTyp
 /* Draw the preview box on the given drawable within the boundaries of the given displayRect.
  * The boundaries of the preview box are given by highlightRect.
  * Only does anything if the preview box centre is set. */
-void BlxPanel::drawPreviewBox(GdkDrawable *drawable, 
-                              GdkRectangle *displayRect, 
+void BlxPanel::drawPreviewBox(GdkDrawable *drawable,
+                              GdkRectangle *displayRect,
                               GdkRectangle *highlightRect)
 {
   /* If not currently drawing the preview box then nothing to do */
@@ -296,16 +297,16 @@ void BlxPanel::drawPreviewBox(GdkDrawable *drawable,
   /* Get the display range in dna coords */
   IntRange dnaDispRange;
   convertDisplayRangeToDnaRange(&displayRange, m_bc->seqType, m_bc->numFrames, m_bc->displayRev, &m_bc->refSeqRange, &dnaDispRange);
-  
+
   /* Find the x coord for the left edge of the preview box (or the right edge, if
    * the display is right-to-left). */
   int x = getLeftCoordFromCentre(m_previewBoxCentre, highlightRect->width, displayRect);
-  
+
   /* Convert it to the base index and back again so that we get it rounded to the position of
    * the nearest base. */
   int baseIdx = convertRectPosToBaseIdx(x, displayRect, &dnaDispRange, m_bc->displayRev);
   int xRounded = convertBaseIdxToRectPos(baseIdx, displayRect, &dnaDispRange, TRUE, m_bc->displayRev, TRUE);
-  
+
   /* The other dimensions of the preview box are the same as the current highlight box. */
   GdkRectangle previewRect = {xRounded, highlightRect->y, highlightRect->width, highlightRect->height};
 
diff --git a/src/blixemApp/blxpanel.hpp b/src/blixemApp/blxpanel.hpp
index 3b1bf65f946f08dbc195d5ed863fffab66927a91..243d9e066da52c5023239ee089c6a713b4e25aee 100644
--- a/src/blixemApp/blxpanel.hpp
+++ b/src/blixemApp/blxpanel.hpp
@@ -1,5 +1,6 @@
 /*  File: blxpanel.hpp
  *  Author: Gemma Barson, 2016-04-07
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -52,8 +53,8 @@ public:
   // Construct/destruct
   BlxPanel();
 
-  BlxPanel(GtkWidget *widget, 
-           GtkWidget *blxWindow, 
+  BlxPanel(GtkWidget *widget,
+           GtkWidget *blxWindow,
            BlxContext *bc_in,
            CoverageViewProperties *coverageViewP,
            int previewBoxCentre);
diff --git a/src/blixemApp/blxview.cpp b/src/blixemApp/blxview.cpp
index df48707340a11bc0e964efede01eac5a79adc460..c9bfdc7f9b1c17d4330ce04f37954bbec0de2627 100644
--- a/src/blixemApp/blxview.cpp
+++ b/src/blixemApp/blxview.cpp
@@ -1,5 +1,6 @@
 /*  File: blxview.c
  *  Author: Erik Sonnhammer, 1993-02-20
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -29,7 +30,7 @@
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
  * Description: Setup and miscellaneous functions for Blixem.
- *               
+ *
  *              This file is a bit of a mish-mash. It originally contained all
  *              of the graphical stuff for Blixem, but that has been moved to
  *              other files. This file now mostly contains setup functions,
@@ -213,7 +214,7 @@ static void validateInput(CommandLineOptions *options)
     {
       g_error("Error: reference sequence not specified.\n");
     }
-  
+
   /* if we were given the blast mode instead of seq type, determine the display sequence type */
   if (options->seqType == BLXSEQ_NONE && options->blastMode != BLXMODE_UNSET)
     {
@@ -222,16 +223,16 @@ static void validateInput(CommandLineOptions *options)
       else
         options->seqType = BLXSEQ_PEPTIDE;
     }
-  
+
   /* Check we have a valid seq type */
   if (options->seqType == BLXSEQ_NONE)
     {
       g_message("\nNo sequence type specified. Detected ");
-      
+
       GError *error = NULL;
       BlxSeqType seqType = determineSeqType(options->refSeq, &error);
       reportAndClearIfError(&error, G_LOG_LEVEL_ERROR);
-      
+
       if (seqType == BLXSEQ_PEPTIDE)
 	{
 	  g_message("protein sequence. Will try to run Blixem in protein mode.\n");
@@ -243,18 +244,18 @@ static void validateInput(CommandLineOptions *options)
 	  options->seqType = BLXSEQ_DNA;
 	}
     }
-  
+
   /* Ideally we'd get rid of blast mode and just deal with real sequence types (ref seq type, match
    * seq type and display type), but it's too in-built for now so make sure it's set */
   if (options->blastMode == BLXMODE_UNSET)
     options->blastMode = (options->seqType == BLXSEQ_DNA ? BLXMODE_BLASTN : BLXMODE_BLASTX);
-  
+
   /* Set the number of reading frames */
   if (options->seqType == BLXSEQ_PEPTIDE)
     options->numFrames = 3;
   else
     options->numFrames = 1;
-  
+
   /* Now we've got the ref seq, we can work out the zoom, if zooming to view the whole sequence */
   if (options->zoomWhole)
     {
@@ -266,7 +267,7 @@ static void validateInput(CommandLineOptions *options)
         options->bigPictZoom = 30;
       else
         options->bigPictZoom = 10;
-    }  
+    }
 }
 
 
@@ -280,7 +281,7 @@ static gboolean getParent(BlxSequence *variant, BlxSequence **parent, GList *all
     {
       *parent = blxSequenceGetVariantParent(variant, allSeqs);
     }
-  
+
   return (*parent != NULL);
 }
 
@@ -291,12 +292,12 @@ static void populateMissingDataFromParent(BlxSequence *curSeq, GList *seqList, G
 {
   BlxSequence *parent = NULL;
   GList *item = columnList;
-  
+
   for ( ; item; item = item->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)(item->data);
       GValue *value = blxSequenceGetValue(curSeq, columnInfo->columnId);
-      
+
       if (!value)
         {
           getParent(curSeq, &parent, seqList);
@@ -317,10 +318,10 @@ void blxMergeFeatures(MSP *newMsps, GList *newSeqs, MSP **mspList, GList **seqLi
     {
       /* Append new MSPs to MSP list */
       MSP *lastMsp = *mspList;
-  
+
       while (lastMsp->next)
         lastMsp = lastMsp->next;
-  
+
       lastMsp->next = newMsps;
     }
   else
@@ -344,7 +345,7 @@ void loadNativeFile(const char *filename,
                     GKeyFile *keyFile,
                     BlxBlastMode *blastMode,
                     GArray* featureLists[],
-                    GSList *supportedTypes, 
+                    GSList *supportedTypes,
                     GSList *styles,
                     MSP **newMsps,
                     GList **newSeqs,
@@ -366,15 +367,15 @@ void loadNativeFile(const char *filename,
   char dummyseqname2[FULLNAMESIZE+1] = "";
 
   /* The range passed to the parser must be in the original parsed coords, so subtract the
-   * offset. (It is used to validate that the range in the GFF file we're reading in is within 
+   * offset. (It is used to validate that the range in the GFF file we're reading in is within
    * blixem's known range.)  */
   IntRange toplevelRange;
-  
+
   if (refSeqRange)
     {
       toplevelRange.set(refSeqRange->min() - refSeqOffset, refSeqRange->max() - refSeqOffset);
     }
-  
+
   if (filename)
     {
       /* Open the file for reading */
@@ -388,19 +389,19 @@ void loadNativeFile(const char *filename,
         {
           parseFS(newMsps, file, blastMode, featureLists, newSeqs, columnList, supportedTypes, styles,
                   &dummyseq1, dummyseqname1, &toplevelRange, &dummyseq2, dummyseqname2, keyFile, lookupTable, NULL, error) ;
-          
+
           fclose(file);
         }
     }
   else if (buffer)
     {
       parseBuffer(newMsps, buffer, blastMode, featureLists, newSeqs, columnList, supportedTypes, styles,
-                  &dummyseq1, dummyseqname1, &toplevelRange, &dummyseq2, dummyseqname2, keyFile, lookupTable, error) ;      
+                  &dummyseq1, dummyseqname1, &toplevelRange, &dummyseq2, dummyseqname2, keyFile, lookupTable, error) ;
     }
 }
 
 
-/* Once we've fetched all the sequences we need to do some post-processing. Loop 
+/* Once we've fetched all the sequences we need to do some post-processing. Loop
  * twice: once to modify any fields in our own custom manner, and once more to
  * see if any with missing data can copy it from their parent. (Need to do these in
  * separate loops or we don't know if the data we're copying is processed or not.) */
@@ -414,7 +415,7 @@ void finaliseFetch(GList *seqList, GList *columnList)
       processGeneName(blxSeq);
       processOrganism(blxSeq);
     }
-  
+
   for (seqItem = seqList; seqItem; seqItem = seqItem->next)
     {
       BlxSequence *blxSeq = (BlxSequence*)(seqItem->data);
@@ -430,7 +431,7 @@ static void findAssemblyGaps(const char *refSeq, GArray *featureLists[], MSP **m
   MSP *lastMsp = *mspList;
   while (lastMsp && lastMsp->next)
     lastMsp = lastMsp->next;
-  
+
   /* Scan for the gap character */
   const char *cp = strchr(refSeq, SEQUENCE_CHAR_GAP);
 
@@ -438,19 +439,19 @@ static void findAssemblyGaps(const char *refSeq, GArray *featureLists[], MSP **m
     {
       /* Found the start of a gap; remember the start coord */
       const int startCoord = cp - refSeq + refSeqRange->min();
-    
+
       /* Loop until we find a non-gap character (or the end of the string) */
       while (cp && *cp == SEQUENCE_CHAR_GAP)
 	++cp;
-    
+
       const int endCoord = cp - refSeq - 1 + refSeqRange->min();
-    
+
       MSP *msp = createEmptyMsp(&lastMsp, mspList);
       msp->type = BLXMSP_GAP;
       msp->qRange.set(startCoord, endCoord);
-      
+
       featureLists[msp->type] = g_array_append_val(featureLists[msp->type], msp);
-    
+
       /* Continue looking for more gaps */
       cp = strchr(cp, SEQUENCE_CHAR_GAP);
     }
@@ -471,8 +472,8 @@ gboolean blxview(CommandLineOptions *options,
                  GArray* featureLists[],
                  GList *seqList,
                  GSList *supportedTypes,
-                 PfetchParams *pfetch, 
-                 char *align_types, 
+                 PfetchParams *pfetch,
+                 char *align_types,
                  gboolean External,
                  GSList *styles,
                  GHashTable *lookupTable)
@@ -488,23 +489,23 @@ gboolean blxview(CommandLineOptions *options,
       blxInitConfig(NULL, options, &error);
       reportAndClearIfError(&error, G_LOG_LEVEL_WARNING);
     }
-  
+
   validateInput(options);
-  
+
   /* Find any assembly gaps (i.e. gaps in the reference sequence) */
   findAssemblyGaps(options->refSeq, featureLists, &options->mspList, &options->refSeqRange);
 
   /* offset has not been applied yet, so pass offset=0 */
   BulkFetch bulk_fetch(External, options->saveTempFiles, options->seqType,
                        &seqList, options->columnList,
-                       options->bulkFetchDefault, options->fetchMethods, &options->mspList, &options->blastMode, 
-                       featureLists, supportedTypes, NULL, 0, &options->refSeqRange, 
+                       options->bulkFetchDefault, options->fetchMethods, &options->mspList, &options->blastMode,
+                       featureLists, supportedTypes, NULL, 0, &options->refSeqRange,
                        options->dataset, FALSE, lookupTable,
 #ifdef PFETCH_HTML
                        options->ipresolve,
                        options->cainfo,
 #endif
-                       options->fetch_debug); 
+                       options->fetch_debug);
 
   gboolean status = bulk_fetch.performFetch();
 
@@ -513,8 +514,8 @@ gboolean blxview(CommandLineOptions *options,
       finaliseFetch(seqList, options->columnList);
 
       /* Construct missing data and do any other required processing now we have all the sequence data */
-      finaliseBlxSequences(featureLists, &options->mspList, &seqList, options->columnList, 
-                           options->refSeqOffset, options->seqType, 
+      finaliseBlxSequences(featureLists, &options->mspList, &seqList, options->columnList,
+                           options->refSeqOffset, options->seqType,
                            options->numFrames, &options->refSeqRange, TRUE, lookupTable);
 
     }
@@ -530,50 +531,50 @@ gboolean blxview(CommandLineOptions *options,
 }
 
 
-/* Find all of the different alignment types (i.e. source names) and 
+/* Find all of the different alignment types (i.e. source names) and
  * compile them into a single string, separated by the given separator string */
 static char* findAlignTypes(GArray* featureLists[], const char *separatorStr)
 {
   GSList *sourceList = NULL;
   GString *resultStr = g_string_new(NULL);
-  
+
   /* Loop through all MSPs of type 'match' */
   const GArray* const mspList = featureLists[BLXMSP_MATCH];
-  
+
   int i = 0;
   const MSP *msp = mspArrayIdx(mspList, i);
-  
+
   for ( ; msp; msp = mspArrayIdx(mspList, ++i))
     {
       const char *source = mspGetSource(msp);
-      
+
       if (source)
         {
           /* See if we've already seen this source. If not, add it to the list,
            * and append it to the string. */
           GQuark quark = g_quark_from_string(source);
-          
+
           if (!g_slist_find(sourceList, GINT_TO_POINTER(quark)))
             {
               sourceList = g_slist_prepend(sourceList, GINT_TO_POINTER(quark));
-              
+
               if (resultStr->len)
                 g_string_append(resultStr, separatorStr);
-              
+
               g_string_append(resultStr, source);
             }
         }
     }
-  
+
   char *result = resultStr->str;
   g_string_free(resultStr, FALSE);
-  
+
   return result;
 }
 
 
 /* Initialize the display and the buttons */
-static void blviewCreate(char *align_types, 
+static void blviewCreate(char *align_types,
 			 const char *paddingSeq,
                          GArray* featureLists[],
                          GList *seqList,
@@ -587,7 +588,7 @@ static void blviewCreate(char *align_types,
       /* Create the window */
       blixemWindow = createBlxWindow(options, paddingSeq, featureLists, seqList, supportedTypes, External, styles);
 
-      /* Set the window title. Get a description of all the alignment types 
+      /* Set the window title. Get a description of all the alignment types
        * (unless already supplied) */
       if (!align_types)
         align_types = findAlignTypes(featureLists, ", ");
@@ -595,15 +596,15 @@ static void blviewCreate(char *align_types,
       /* If no alignment description was set, create a generic description */
       if (!align_types)
         align_types = g_strdup_printf("%s", options->seqType == BLXSEQ_PEPTIDE ? "peptide alignment" : "nucleotide alignment");
-      
+
       BlxContext *bc = blxWindowGetContext(blixemWindow);
-      
+
       char *title = g_strdup_printf("%s(%s) %s %s",
                                     blxGetTitlePrefix(bc),
                                     align_types,
                                     (options->dataset ? options->dataset : ""),
                                     options->refSeqName);
-      
+
       gtk_window_set_title(GTK_WINDOW(blixemWindow), title);
       g_free(title);
     }
@@ -613,28 +614,28 @@ static void blviewCreate(char *align_types,
     {
       options->refSeqName = nameSeparatorPos + 1;
     }
-  
+
   if (options->dotterFirst && options->mspList && options->mspList->sname &&
       (mspIsBlastMatch(options->mspList) || options->mspList->type == BLXMSP_HSP || options->mspList->type == BLXMSP_GSP))
     {
       /* We must select the sequence before calling callDotter. Get the first
        * sequence to the right of the start coord. */
       MSP *msp = nextMatch(blxWindowGetDetailView(blixemWindow), NULL, FALSE);
-      
+
       if (msp)
         {
           blxWindowSelectSeq(blixemWindow, msp->sSequence);
-          
+
           GError *error = NULL;
-          
+
           if (!error)
             {
               callDotterOnSelectedSeqs(blixemWindow, FALSE, FALSE, BLXDOTTER_REF_AUTO, NULL);
             }
-            
+
           reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
         }
-      else 
+      else
         {
           g_error("Could not run Dotter on first sequence; no sequences found to the right of the start coord.\n");
         }
@@ -659,27 +660,27 @@ static void processGeneName(BlxSequence *blxSeq)
    * Therefore, look for the Name tag and extract everything up to the ; or end of line.
    * If there is no name tag, just include everything */
   const char *geneName = blxSequenceGetGeneName(blxSeq);
-  
+
   if (geneName)
     {
       const char *startPtr = strstr(geneName, "Name=");
-      
+
       if (!startPtr)
         {
           startPtr = strstr(geneName, "name=");
         }
-        
+
       if (startPtr)
         {
           startPtr += 5;
           const char *endPtr = strchr(startPtr, ';');
           const int numChars = endPtr ? endPtr - startPtr : strlen(startPtr);
-          
+
           char *result = (char*)g_malloc((numChars + 1) * sizeof(char));
-          
+
           g_utf8_strncpy(result, startPtr, numChars);
           result[numChars] = 0;
-          
+
           blxSequenceSetValueFromString(blxSeq, BLXCOL_GENE_NAME, result);
 
           g_free(result);
@@ -688,32 +689,32 @@ static void processGeneName(BlxSequence *blxSeq)
 }
 
 
-/* Add a prefix to the given BlxSequence's organism field, e.g. change "Homo sapiens (human)" 
- * to "Hs - Homo sapiens (human)". This is so that we can have a very narrow column that just 
+/* Add a prefix to the given BlxSequence's organism field, e.g. change "Homo sapiens (human)"
+ * to "Hs - Homo sapiens (human)". This is so that we can have a very narrow column that just
  * displays the prefix part of the field. */
 static void processOrganism(BlxSequence *blxSeq)
 {
   const char *organism = blxSequenceGetOrganism(blxSeq);
-  
+
   if (organism)
     {
       /* To create the alias, we'll take the first letter of each word until we hit a non-alpha
        * character. To reduce likelihood of duplicates, we'll take 3 chars from the second word
-       * and then quit. e.g. 
+       * and then quit. e.g.
        *   Homo sapiens (human)           -> Hsap
-       *   Mus musculus (house mouse)     -> Mmus 
-       *   Macaca mulatta (Rhesus monkey) -> Mmul 
+       *   Mus musculus (house mouse)     -> Mmus
+       *   Macaca mulatta (Rhesus monkey) -> Mmul
        */
       int srcIdx = 0;
       int srcLen = strlen(organism);
-      
+
       int destIdx = 0;
       int destLen = 5; /* limit the length of the alias */
       char alias[destLen + 1];
-      
+
       gboolean startWord = TRUE;
       gboolean first = TRUE;
-      
+
       for ( ; srcIdx < srcLen && destIdx < destLen; ++srcIdx)
         {
           if (organism[srcIdx] == ' ')
@@ -730,7 +731,7 @@ static void processOrganism(BlxSequence *blxSeq)
 
                   if (!first)
                     {
-                      /* For the second word, also include the next 2 chars 
+                      /* For the second word, also include the next 2 chars
                        * and then exit. */
                       ++srcIdx;
                       if (srcIdx < srcLen && destIdx < destLen)
@@ -759,7 +760,7 @@ static void processOrganism(BlxSequence *blxSeq)
         }
 
       alias[destIdx] = '\0';
-      
+
       if (destIdx > 0)
         {
           blxSeq->organismAbbrev = g_strdup(alias);
@@ -780,7 +781,7 @@ gboolean mspHasFs(const MSP *msp)
 const IntRange* mspGetFullSRange(const MSP* const msp, const gboolean seqSelected, const BlxContext* const bc)
 {
   const IntRange *result = NULL;
-  
+
   if (seqSelected || !bc->flags[BLXFLAG_SHOW_UNALIGNED_SELECTED] || !bc->flags[BLXFLAG_SHOW_POLYA_SITE_SELECTED])
     result = &msp->fullSRange;
   else
@@ -788,7 +789,7 @@ const IntRange* mspGetFullSRange(const MSP* const msp, const gboolean seqSelecte
 
   if (!result->isSet())
     g_warn_if_reached();
-  
+
   return result;
 }
 
@@ -798,12 +799,12 @@ const IntRange* mspGetFullSRange(const MSP* const msp, const gboolean seqSelecte
 const IntRange* mspGetFullDisplayRange(const MSP* const msp, const gboolean seqSelected, const BlxContext* const bc)
 {
   const IntRange *result = NULL;
-  
+
   /* Check if showing unaligned sequence or polya tails for all sequences, or just the selected
      sequence */
-  if ((bc->flags[BLXFLAG_SHOW_UNALIGNED] || bc->flags[BLXFLAG_SHOW_POLYA_SITE]) && 
-      (seqSelected || 
-       (bc->flags[BLXFLAG_SHOW_UNALIGNED] && !bc->flags[BLXFLAG_SHOW_UNALIGNED_SELECTED]) || 
+  if ((bc->flags[BLXFLAG_SHOW_UNALIGNED] || bc->flags[BLXFLAG_SHOW_POLYA_SITE]) &&
+      (seqSelected ||
+       (bc->flags[BLXFLAG_SHOW_UNALIGNED] && !bc->flags[BLXFLAG_SHOW_UNALIGNED_SELECTED]) ||
        (bc->flags[BLXFLAG_SHOW_POLYA_SITE] && !bc->flags[BLXFLAG_SHOW_POLYA_SITE_SELECTED])))
     {
       result = &msp->fullRange;
@@ -827,42 +828,42 @@ const IntRange* mspGetDisplayRange(const MSP* const msp)
 }
 
 
-/* Get the full range of the given MSP that we want to display, in s coords. This will generally 
- * be the coords of the alignment but could extend outside this range we are displaying unaligned 
+/* Get the full range of the given MSP that we want to display, in s coords. This will generally
+ * be the coords of the alignment but could extend outside this range we are displaying unaligned
  * portions of the match sequence or polyA tails etc. */
-static void mspCalcFullSRange(const MSP* const msp, 
+static void mspCalcFullSRange(const MSP* const msp,
 			      const gboolean *flags,
-			      const int numUnalignedBases, 
+			      const int numUnalignedBases,
 			      const GArray* const polyASiteList,
 			      IntRange *result)
 {
   /* Normally we just display the part of the sequence in the alignment */
   result->set(msp->sRange);
-  
+
   if (mspIsBlastMatch(msp))
     {
       if (flags[BLXFLAG_SHOW_UNALIGNED] && mspGetMatchSeq(msp))
 	{
-	  /* We're displaying additional unaligned sequence outside the alignment range. Get 
+	  /* We're displaying additional unaligned sequence outside the alignment range. Get
 	   * the full range of the match sequence */
 	  result->set(1, mspGetMatchSeqLen(msp));
-	  
+
 	  if (flags[BLXFLAG_LIMIT_UNALIGNED_BASES])
 	    {
 	      /* Only include up to 'numUnalignedBases' each side of the MSP range (still limited
 	       * to the range we found above, though). */
-	      result->set(max(result->min(), msp->sRange.min() - numUnalignedBases), 
+	      result->set(max(result->min(), msp->sRange.min() - numUnalignedBases),
                           min(result->max(), msp->sRange.max() + numUnalignedBases));
 	    }
 	}
-      
+
       if (flags[BLXFLAG_SHOW_POLYA_SITE] && mspHasPolyATail(msp))
 	{
 	  /* We're displaying polyA tails, so override the 3' end coord with the full extent of
 	   * the s sequence if there is a polyA site here. The 3' end is the min q coord if the
 	   * match is on forward ref seq strand or the max coord if on the reverse. */
 	  const gboolean sameDirection = (mspGetRefStrand(msp) == mspGetMatchStrand(msp));
-	  
+
 	  if (sameDirection)
 	    {
 	      result->setMax(mspGetMatchSeqLen(msp));
@@ -876,12 +877,12 @@ static void mspCalcFullSRange(const MSP* const msp,
 }
 
 
-/* Get the full range of the given MSP that we want to display, in q coords. This will generally 
- * be the coords of the alignment but could extend outside this range we are displaying unaligned 
+/* Get the full range of the given MSP that we want to display, in q coords. This will generally
+ * be the coords of the alignment but could extend outside this range we are displaying unaligned
  * portions of the match sequence or polyA tails etc. */
-static void mspCalcFullQRange(const MSP* const msp, 
+static void mspCalcFullQRange(const MSP* const msp,
 			      const gboolean *flags,
-			      const int numUnalignedBases, 
+			      const int numUnalignedBases,
 			      const GArray* const polyASiteList,
 			      const int numFrames,
 			      const IntRange* const fullSRange,
@@ -889,7 +890,7 @@ static void mspCalcFullQRange(const MSP* const msp,
 {
   /* Default to the alignment range so we can exit quickly if there are no special cases */
   result->set(msp->qRange);
-  
+
   if (mspIsBlastMatch(msp) && (flags[BLXFLAG_SHOW_UNALIGNED] || flags[BLXFLAG_SHOW_POLYA_SITE]))
     {
       /* Find the offset of the start and end of the full range compared to the alignment range and
@@ -897,7 +898,7 @@ static void mspCalcFullQRange(const MSP* const msp,
        * frames because q coords are in nucleotides and s coords are in peptides. */
       const int startOffset = (msp->sRange.min() - fullSRange->min()) * numFrames;
       const int endOffset = (fullSRange->max() - msp->sRange.max()) * numFrames;
-      
+
       const gboolean sameDirection = (mspGetRefStrand(msp) == mspGetMatchStrand(msp));
 
       if (sameDirection)
@@ -919,13 +920,13 @@ void mspCalculateFullExtents(MSP *msp, const BlxContext* const bc, const int num
 {
   mspCalcFullSRange(msp, bc->flags, numUnalignedBases, bc->featureLists[BLXMSP_POLYA_SITE], &msp->fullSRange);
   mspCalcFullQRange(msp, bc->flags, numUnalignedBases, bc->featureLists[BLXMSP_POLYA_SITE], bc->numFrames, &msp->fullSRange, &msp->fullRange);
- 
+
   /* convert the Q range to display coords */
   const int frame = mspGetRefFrame(msp, bc->seqType);
   const int coord1 = convertDnaIdxToDisplayIdx(msp->fullRange.min(), bc->seqType, frame, bc->numFrames, bc->displayRev, &bc->refSeqRange, NULL);
   const int coord2 = convertDnaIdxToDisplayIdx(msp->fullRange.max(), bc->seqType, frame, bc->numFrames, bc->displayRev, &bc->refSeqRange, NULL);
   msp->fullRange.set(coord1, coord2);
-  
+
   /* Remember the max len of all the MSPs in the detail-view */
   if (typeShownInDetailView(msp->type) && msp->fullRange.length() > getMaxMspLen())
     {
@@ -940,7 +941,7 @@ static void mspCalculateDisplayRange(MSP *msp, const BlxContext* const bc)
   const int frame = mspGetRefFrame(msp, bc->seqType);
   const int coord1 = convertDnaIdxToDisplayIdx(msp->qRange.min(), bc->seqType, frame, bc->numFrames, bc->displayRev, &bc->refSeqRange, NULL);
   const int coord2 = convertDnaIdxToDisplayIdx(msp->qRange.max(), bc->seqType, frame, bc->numFrames, bc->displayRev, &bc->refSeqRange, NULL);
-  msp->displayRange.set(coord1, coord2);  
+  msp->displayRange.set(coord1, coord2);
 }
 
 
@@ -950,7 +951,7 @@ void cacheMspDisplayRanges(const BlxContext* const bc, const int numUnalignedBas
 {
   /* This also calculates the max msp len */
   setMaxMspLen(0);
-  
+
   MSP *msp = bc->mspList;
   for ( ; msp; msp = msp->next)
     {
@@ -967,28 +968,28 @@ static gboolean mspGetGappedAlignmentCoord(const MSP *msp, const int qIdx, const
 {
   gboolean success = FALSE;
   int result = UNSET_INT;
-  
+
   const gboolean qForward = (mspGetRefStrand(msp) == BLXSTRAND_FORWARD);
   const gboolean sameDirection = (mspGetRefStrand(msp) == mspGetMatchStrand(msp));
 
   /* Gapped alignment. Look to see if x lies inside one of the "gaps" ranges. */
   GSList *rangeItem = msp->gaps;
-  
+
   for ( ; rangeItem ; rangeItem = rangeItem->next)
     {
       CoordRange *curRange = (CoordRange*)(rangeItem->data);
-      
+
       int qRangeMin, qRangeMax, sRangeMin, sRangeMax;
       getCoordRangeExtents(curRange, &qRangeMin, &qRangeMax, &sRangeMin, &sRangeMax);
-      
+
       /* We've "found" the value if it's in or before this range. Note that the
        * the range values are in decreasing order if the q strand is reversed. */
       gboolean found = qForward ? qIdx <= qRangeMax : qIdx >= qRangeMin;
-      
+
       if (found)
         {
           gboolean inRange = (qForward ? qIdx >= qRangeMin : qIdx <= qRangeMax);
-          
+
           if (inRange)
             {
               /* It's inside this range. Calculate the actual index. */
@@ -996,11 +997,11 @@ static gboolean mspGetGappedAlignmentCoord(const MSP *msp, const int qIdx, const
               result = sameDirection ? sRangeMin + offset : sRangeMax - offset;
               success = TRUE;
             }
-          
+
           break;
         }
     }
-  
+
   if (success && result_out)
     *result_out = result;
 
@@ -1015,8 +1016,8 @@ static gboolean mspGetUngappedAlignmentCoord(const MSP *msp, const int qIdx, con
 {
   gboolean success = FALSE;
   int result = UNSET_INT;
-  
-  /* If strands are in the same direction, find the offset from qRange.min and add it to 
+
+  /* If strands are in the same direction, find the offset from qRange.min and add it to
    * sRange.min. If strands are in opposite directions, find the offset from qRange.min and
    * subtract it from sRange.max. Note that the offset could be negative if we're outside
    * the alignment range. */
@@ -1024,7 +1025,7 @@ static gboolean mspGetUngappedAlignmentCoord(const MSP *msp, const int qIdx, con
   const gboolean sameDirection = (mspGetRefStrand(msp) == mspGetMatchStrand(msp));
 
   result = (sameDirection) ? msp->sRange.min() + offset : msp->sRange.max() - offset ;
-  
+
   if (result < msp->sRange.min() || result > msp->sRange.max())
     {
       result = UNSET_INT;
@@ -1034,28 +1035,28 @@ static gboolean mspGetUngappedAlignmentCoord(const MSP *msp, const int qIdx, con
     {
       success = TRUE;
     }
-  
+
   if (success && result_out)
     *result_out = result;
 
   return success;
-}  
+}
 
 
 /* Return the match-sequence coord of an MSP at the given reference-sequence coord,
- * where the ref-seq coord is known to lie outside the MSP's alignment range. The 
- * result will be unset unless the option to display unaligned portions of 
+ * where the ref-seq coord is known to lie outside the MSP's alignment range. The
+ * result will be unset unless the option to display unaligned portions of
  * sequence is enabled. */
-static gboolean mspGetUnalignedCoord(const MSP *msp, 
-                                     const int qIdx, 
-                                     const gboolean seqSelected, 
-                                     const int numUnalignedBases, 
+static gboolean mspGetUnalignedCoord(const MSP *msp,
+                                     const int qIdx,
+                                     const gboolean seqSelected,
+                                     const int numUnalignedBases,
                                      const BlxContext *bc,
                                      int *result_out)
 {
   gboolean success = FALSE;
   int result = UNSET_INT;
-  
+
   /* First convert to display coords */
   const int frame = mspGetRefFrame(msp, bc->seqType);
   const int displayIdx = convertDnaIdxToDisplayIdx(qIdx, bc->seqType, frame, bc->numFrames, bc->displayRev, &bc->refSeqRange, NULL);
@@ -1065,7 +1066,7 @@ static gboolean mspGetUnalignedCoord(const MSP *msp,
    * now in the direction of the display, regardless of the ref seq strand. */
   const gboolean sameDirection = (mspGetMatchStrand(msp) == mspGetRefStrand(msp));
   const gboolean sForward = (sameDirection != bc->displayRev);
-  
+
   if (displayIdx < mspRange->min())
     {
       /* Find the offset backwards from the low coord and subtract it from the low end
@@ -1083,17 +1084,17 @@ static gboolean mspGetUnalignedCoord(const MSP *msp,
       result = sForward ? msp->sRange.max() + offset : msp->sRange.min() - offset;
       success = TRUE;
     }
-  
+
   /* Get the full display range of the match sequence. If the result is still out of range
    * then there's nothing to show for this qIdx. */
   const IntRange *fullSRange = mspGetFullSRange(msp, seqSelected, bc);
-  
+
   if (!valueWithinRange(result, fullSRange))
     {
       result = UNSET_INT;
       success = FALSE;
     }
-  
+
   if (success && result_out)
     *result_out = result;
 
@@ -1102,21 +1103,21 @@ static gboolean mspGetUnalignedCoord(const MSP *msp,
 
 
 
-/* Given a base index on the reference sequence, find the corresonding base 
+/* Given a base index on the reference sequence, find the corresonding base
  * in the match sequence. Returns TRUE and sets the result if successful. */
-gboolean mspGetMatchCoord(const MSP *msp, 
-                          const int qIdx, 
+gboolean mspGetMatchCoord(const MSP *msp,
+                          const int qIdx,
                           const gboolean seqSelected,
                           const int numUnalignedBases,
                           BlxContext *bc,
                           int *result_out)
 {
   gboolean success = FALSE;
-  
+
   if (mspIsBlastMatch(msp) || mspIsBoxFeature(msp))
     {
       const gboolean inMspRange = valueWithinRange(qIdx, &msp->qRange);
-      
+
       if (msp->gaps && g_slist_length(msp->gaps) >= 1 && inMspRange)
         {
           success = mspGetGappedAlignmentCoord(msp, qIdx, bc, result_out);
@@ -1132,7 +1133,7 @@ gboolean mspGetMatchCoord(const MSP *msp,
           success = mspGetUngappedAlignmentCoord(msp, qIdx, bc, result_out);
         }
     }
-  
+
   return success;
 }
 
@@ -1174,7 +1175,7 @@ void blviewResetGlobals()
 static void setBlxColorValues(const char *normal, const char *selected, BlxColor *blxColor, GError **error)
 {
   GError *tmpError = NULL;
-  
+
   if (normal)
     {
       getColorFromString(normal, &blxColor->normal, &tmpError);
@@ -1182,7 +1183,7 @@ static void setBlxColorValues(const char *normal, const char *selected, BlxColor
       if (!tmpError)
         {
           getSelectionColor(&blxColor->normal, &blxColor->selected); /* will use this if selection color is not given/has error */
-          
+
           /* Calculate print coords as a greyscale version of normal colors */
           convertToGrayscale(&blxColor->normal, &blxColor->print);            /* calculate print colors, because they are not given */
           getSelectionColor(&blxColor->print, &blxColor->printSelected);
@@ -1202,7 +1203,7 @@ static void setBlxColorValues(const char *normal, const char *selected, BlxColor
     {
       getColorFromString(selected, &blxColor->selected, &tmpError);
     }
-  
+
   if (tmpError)
     g_propagate_error(error, tmpError);
 }
@@ -1210,17 +1211,17 @@ static void setBlxColorValues(const char *normal, const char *selected, BlxColor
 
 /* Create a BlxStyle. For transcripts, CDS and UTR features can have different colors, but they
  * are from the same source and hence have the same style object. We therefore use the default
- * fillColor, lineColor etc. variables for CDS features and provide additional options to supply 
+ * fillColor, lineColor etc. variables for CDS features and provide additional options to supply
  * UTR colors as well. */
-BlxStyle* createBlxStyle(const char *styleName, 
-			 const char *fillColor, 
-			 const char *fillColorSelected, 
-			 const char *lineColor, 
-			 const char *lineColorSelected, 
-			 const char *fillColorUtr, 
-			 const char *fillColorUtrSelected, 
-			 const char *lineColorUtr, 
-			 const char *lineColorUtrSelected, 
+BlxStyle* createBlxStyle(const char *styleName,
+			 const char *fillColor,
+			 const char *fillColorSelected,
+			 const char *lineColor,
+			 const char *lineColorSelected,
+			 const char *fillColorUtr,
+			 const char *fillColorUtrSelected,
+			 const char *lineColorUtr,
+			 const char *lineColorUtrSelected,
 			 GError **error)
 {
   BlxStyle *style = new BlxStyle;
@@ -1230,26 +1231,26 @@ BlxStyle* createBlxStyle(const char *styleName,
     {
       g_set_error(error, BLX_ERROR, 1, "Style name is NULL.\n");
     }
-    
+
   if (!tmpError)
     {
       style->styleName = g_strdup(styleName);
     }
-  
+
   if (!tmpError)
-    {      
+    {
       setBlxColorValues(fillColor ? fillColor : fillColorUtr,
                         fillColorSelected ? fillColorSelected : fillColorUtrSelected,
                         &style->fillColor, &tmpError);
     }
-  
+
   if (!tmpError)
     {
       setBlxColorValues(lineColor ? lineColor : lineColorUtr,
                         lineColorSelected ? lineColorSelected : lineColorUtrSelected,
                         &style->lineColor, &tmpError);
     }
-  
+
   if (!tmpError)
     {
       setBlxColorValues(fillColorUtr ? fillColorUtr : fillColor,
@@ -1270,7 +1271,7 @@ BlxStyle* createBlxStyle(const char *styleName,
       style = NULL;
       g_propagate_error(error, tmpError);
     }
-  
+
   return style;
 }
 
@@ -1294,14 +1295,14 @@ void drawAssemblyGaps(GtkWidget *widget,
                       GdkDrawable *drawable,
                       GdkColor *color,
                       const gboolean displayRev,
-                      GdkRectangle *rect, 
+                      GdkRectangle *rect,
                       const IntRange* const dnaRange,
                       const GArray *mspArray)
 {
   /* See if any gaps lie within the display range. */
   int i = 0;
   MSP *gap = mspArrayIdx(mspArray, i);
-  
+
   for ( ; gap; gap = mspArrayIdx(mspArray, ++i))
     {
       if (rangesOverlap(&gap->qRange, dnaRange))
@@ -1312,9 +1313,9 @@ void drawAssemblyGaps(GtkWidget *widget,
 
 	  const int x1 = convertBaseIdxToRectPos(gapMin, rect, dnaRange, TRUE, displayRev, TRUE);
 	  const int x2 = convertBaseIdxToRectPos(gapMax, rect, dnaRange, TRUE, displayRev, TRUE);
-          
+
 	  const int width = max(MIN_GAP_HIGHLIGHT_WIDTH, abs(x2 - x1));
-	
+
           cairo_t *cr = gdk_cairo_create(drawable);
           gdk_cairo_set_source_color(cr, color);
           cairo_rectangle(cr, min(x1, x2), 0, width, widget->allocation.height);
@@ -1323,11 +1324,11 @@ void drawAssemblyGaps(GtkWidget *widget,
           cairo_destroy(cr);
         }
     }
-  
+
 }
 
 
-/* Get the color strings for the given group from the given 
+/* Get the color strings for the given group from the given
  * styles file. If the string is not found then recurse
  * through any parent styles */
 static void getStylesFileColorsRecursive(GKeyFile *keyFile,
@@ -1341,22 +1342,22 @@ static void getStylesFileColorsRecursive(GKeyFile *keyFile,
     {
       char **normalColors = g_key_file_get_string_list(keyFile, group, "colours", NULL, NULL);
       char **color = normalColors;
-      
+
       if (normalColors)
         colors->normalFound = TRUE;
-      
+
       for ( ; color && *color; ++color)
         {
           /* Ignore leading whitespace */
           char *c = *color;
           while (*c == ' ')
             ++c;
-          
+
           if (c && *c)
             {
               if (!strncasecmp(c, "normal fill ", 12))
                 {
-                  if (!colors->fillColor) 
+                  if (!colors->fillColor)
                     colors->fillColor = g_strchug(g_strchomp(g_strdup(c + 12)));
                 }
               else if (!strncasecmp(c, "normal border ", 14))
@@ -1405,12 +1406,12 @@ static void getStylesFileColorsRecursive(GKeyFile *keyFile,
           char *c = *color;
           while (*c == ' ')
             ++c;
-          
+
           if (c && *c)
             {
               if (!strncasecmp(c, "normal fill ", 12))
                 {
-                  if (!colors->fillColorCds) 
+                  if (!colors->fillColorCds)
                     colors->fillColorCds = g_strchug(g_strchomp(g_strdup(c + 12)));
                 }
               else if (!strncasecmp(c, "normal border ", 14))
@@ -1438,19 +1439,19 @@ static void getStylesFileColorsRecursive(GKeyFile *keyFile,
                 }
             }
         }
-      
+
       if (cdsColors)
         g_strfreev(cdsColors);
     }
 
   /* If there are still any outstanding, recurse to the next parent */
-  if (!colors->fillColor || !colors->lineColor || 
-      !colors->fillColorSelected || !colors->lineColorSelected || 
+  if (!colors->fillColor || !colors->lineColor ||
+      !colors->fillColorSelected || !colors->lineColorSelected ||
       !colors->fillColorCds || !colors->lineColorCds ||
       !colors->fillColorCdsSelected || !colors->lineColorCdsSelected)
     {
       char *parent = g_key_file_get_string(keyFile, group, "parent-style", NULL);
-      
+
       if (parent)
         {
           getStylesFileColorsRecursive(keyFile, parent, colors, error);
@@ -1461,10 +1462,10 @@ static void getStylesFileColorsRecursive(GKeyFile *keyFile,
 
 
 /* For backwards compatibility, read the old-style color fields
- * for the given source (group) from the given key file. (The 
+ * for the given source (group) from the given key file. (The
  * key names were changed to be consistent with zmap). */
-static void readStylesFileColorsOld(GKeyFile *keyFile, 
-                                    const char *group, 
+static void readStylesFileColorsOld(GKeyFile *keyFile,
+                                    const char *group,
                                     GSList **stylesList,
                                     GError **error)
 {
@@ -1476,11 +1477,11 @@ static void readStylesFileColorsOld(GKeyFile *keyFile,
   char *lineColorUtr = g_key_file_get_string(keyFile, group, "line_color_utr", NULL);
   char *fillColorUtrSelected = g_key_file_get_string(keyFile, group, "fill_color_utr_selected", NULL);
   char *lineColorUtrSelected = g_key_file_get_string(keyFile, group, "line_color_utr_selected", NULL);
-  
+
   /* If there was an error, skip this group. Otherwise, go ahead and create the style */
   if (fillColor && lineColor)
     {
-      BlxStyle *style = createBlxStyle(group, 
+      BlxStyle *style = createBlxStyle(group,
                                        fillColor, fillColorSelected,
                                        lineColor, lineColorSelected,
                                        fillColorUtr, fillColorUtrSelected,
@@ -1498,8 +1499,8 @@ static void readStylesFileColorsOld(GKeyFile *keyFile,
     {
       g_set_error(error, BLX_ERROR, 1, "Style '%s' does not contain required field line_color", group);
     }
-  
-  
+
+
   if (fillColor) g_free(fillColor);
   if (lineColor) g_free(lineColor);
   if (fillColorSelected) g_free(fillColorSelected);
@@ -1511,10 +1512,10 @@ static void readStylesFileColorsOld(GKeyFile *keyFile,
 }
 
 
-/* Read the new-style color fields for the given source (group) 
+/* Read the new-style color fields for the given source (group)
  * from the given key file. Returns true if colors were found. */
-static gboolean readStylesFileColors(GKeyFile *keyFile, 
-                                     const char *group, 
+static gboolean readStylesFileColors(GKeyFile *keyFile,
+                                     const char *group,
                                      GSList **stylesList,
                                      GError **error)
 {
@@ -1526,22 +1527,22 @@ static gboolean readStylesFileColors(GKeyFile *keyFile,
    * style parents before we find them. */
   BlxStyleColors colors = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE};
   getStylesFileColorsRecursive(keyFile, group, &colors, &tmpError);
-  
+
   /* If colors were found, create the style */
   if (!tmpError && (colors.normalFound || colors.cdsFound))
     {
       /* Unfortunately blixem stores cds/utr colors differently to zmap, which
        * leads to the following messy logic:
-       * If the optional cds colors are set then the default 'colors' field 
+       * If the optional cds colors are set then the default 'colors' field
        * in the styles file gives our utr colors and the 'transcript-cds-colors'
        * field gives our normal colors. Otherwise, the 'colors' field gives our
-       * normal colors and we don't set the utr colors (because they default 
+       * normal colors and we don't set the utr colors (because they default
        * to the normal colors). */
       BlxStyle *style = NULL;
-      
+
       if (colors.cdsFound)
         {
-          style = createBlxStyle(group, 
+          style = createBlxStyle(group,
                                  colors.fillColorCds, colors.fillColorCdsSelected,
                                  colors.lineColorCds, colors.lineColorCdsSelected,
                                  colors.fillColor, colors.fillColorSelected,
@@ -1550,7 +1551,7 @@ static gboolean readStylesFileColors(GKeyFile *keyFile,
         }
       else
         {
-          style = createBlxStyle(group, 
+          style = createBlxStyle(group,
                                  colors.fillColor, colors.fillColorSelected,
                                  colors.lineColor, colors.lineColorSelected,
                                  NULL, NULL,
@@ -1564,7 +1565,7 @@ static gboolean readStylesFileColors(GKeyFile *keyFile,
       if (tmpError)
         prefixError(tmpError, "  "); /* indent the error message */
     }
-  
+
   /* Clean up */
   if (colors.fillColor) g_free(colors.fillColor);
   if (colors.lineColor) g_free(colors.lineColor);
@@ -1604,12 +1605,12 @@ GSList* blxReadStylesFile(const char *keyFileName_in, GError **error)
       if (keyFile)
         keyFileName = g_key_file_get_string(keyFile, BLIXEM_GROUP, STYLES_FILE_KEY, NULL);
     }
-  
+
   if (!keyFileName)
     {
       return result;
     }
-  
+
   /* Load the key file */
   GKeyFile *keyFile = g_key_file_new();
   GKeyFileFlags flags = G_KEY_FILE_NONE ;
@@ -1624,7 +1625,7 @@ GSList* blxReadStylesFile(const char *keyFileName_in, GError **error)
       char **group;
       int i;
       GError *tmpError = NULL;
-      
+
       for (i = 0, group = groups ; i < (int)num_groups ; i++, group++)
 	{
           gboolean found = readStylesFileColors(keyFile, *group, &result, &tmpError);
@@ -1637,7 +1638,7 @@ GSList* blxReadStylesFile(const char *keyFileName_in, GError **error)
             {
               /* Compile all errors into one */
               prefixError(tmpError, "[%s]\n", *group);
-              
+
               if (error && *error)
                 postfixError(*error, "%s", tmpError->message);
               else
@@ -1647,15 +1648,15 @@ GSList* blxReadStylesFile(const char *keyFileName_in, GError **error)
               tmpError = NULL;
             }
         }
-      
+
       if (tmpError)
-        {          
+        {
           g_propagate_error(error, tmpError);
         }
-      
+
       g_strfreev(groups);
     }
-  
+
   if (error && *error)
     {
       prefixError(*error, "Errors found while reading styles file '%s'\n", keyFileName);
@@ -1665,7 +1666,7 @@ GSList* blxReadStylesFile(const char *keyFileName_in, GError **error)
   g_free(keyFileName);
   g_key_file_free(keyFile) ;
   keyFile = NULL ;
-  
+
   return result;
 }
 
@@ -1703,11 +1704,11 @@ const char *blxGetWebSiteString()
  * functions, this one allocates a new string which must be free'd by the caller */
 char *blxGetCommentsString()
 {
-  char *result = g_strdup_printf("%s\n%s\n%s %s\n\n%s\n", 
-                                 BLIXEM_TITLE_STRING, 
+  char *result = g_strdup_printf("%s\n%s\n%s %s\n\n%s\n",
+                                 BLIXEM_TITLE_STRING,
                                  gbtools::UtilsGetVersionTitle(),
-                                 UT_COMPILE_PHRASE, 
-                                 UT_MAKE_COMPILE_DATE(), 
+                                 UT_COMPILE_PHRASE,
+                                 UT_MAKE_COMPILE_DATE(),
                                  AUTHOR_TEXT);
 
   return result;
@@ -1736,7 +1737,7 @@ static void getColumnWidthsConfig(BlxColumnInfo *columnInfo)
   /* Do nothing for the sequence column, because it has dynamic width */
   if (columnInfo->columnId == BLXCOL_SEQUENCE)
     return;
-    
+
   GKeyFile *key_file = blxGetConfig();
   GError *error = NULL;
 
@@ -1745,7 +1746,7 @@ static void getColumnWidthsConfig(BlxColumnInfo *columnInfo)
       if (!error)
         {
           const int newWidth = g_key_file_get_integer(key_file, COLUMN_WIDTHS_GROUP, columnInfo->title, &error);
-          
+
           if (error)
             {
               reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
@@ -1764,14 +1765,14 @@ static void getColumnWidthsConfig(BlxColumnInfo *columnInfo)
 }
 
 
-/* Check if the column has a column-summary flag set in the config and if so 
+/* Check if the column has a column-summary flag set in the config and if so
  * override the default value */
 static void getColumnSummaryConfig(BlxColumnInfo *columnInfo)
 {
   /* Do nothing if we can't show the summary for this column */
   if (!columnInfo->canShowSummary)
     return;
-    
+
   GKeyFile *key_file = blxGetConfig();
 
   if (key_file && g_key_file_has_group(key_file, COLUMN_SUMMARY_GROUP))
@@ -1785,7 +1786,7 @@ static void getColumnSummaryConfig(BlxColumnInfo *columnInfo)
 
 
 /* This checks if the column has any properties specified for it in the config
- * file and, if so, overrides the default values in the given column with 
+ * file and, if so, overrides the default values in the given column with
  * the config file values. */
 static void getColumnConfig(BlxColumnInfo *columnInfo)
 {
@@ -1796,12 +1797,12 @@ static void getColumnConfig(BlxColumnInfo *columnInfo)
 //static void destroyColumnList(GList **columnList)
 //{
 //  GList *column = *columnList;
-//  
+//
 //  for ( ; column; column = column->next)
 //    {
 //      g_free(column->data);
 //    }
-//    
+//
 //  g_list_free(*columnList);
 //  *columnList = NULL;
 //}
@@ -1812,21 +1813,21 @@ static void getColumnConfig(BlxColumnInfo *columnInfo)
 GList* blxCreateColumns(const gboolean optionalColumns, const gboolean customSeqHeader)
 {
   GList *columnList = NULL;
-  
+
   /* Create the columns' data structs. The columns appear in the order
    * that they are added here. */
   blxColumnCreate(BLXCOL_SEQNAME,     TRUE,             "Name",       G_TYPE_STRING, RENDERER_TEXT_PROPERTY,     BLXCOL_SEQNAME_WIDTH,        TRUE,            TRUE,  TRUE,  TRUE,  TRUE,   "Name",        NULL, NULL, &columnList);
   blxColumnCreate(BLXCOL_SOURCE,      TRUE,             "Source",     G_TYPE_STRING, RENDERER_TEXT_PROPERTY,     BLXCOL_SOURCE_WIDTH,         TRUE,            TRUE,  TRUE,  TRUE,  TRUE,   "Source",      NULL, NULL, &columnList);
-                                                                                                                                                                                                              
+
   blxColumnCreate(BLXCOL_ORGANISM,    TRUE,             "Organism",   G_TYPE_STRING, RENDERER_TEXT_PROPERTY,     BLXCOL_ORGANISM_WIDTH,       optionalColumns, TRUE,  TRUE,  TRUE,  TRUE,   "Organism",    "OS", NULL, &columnList);
   blxColumnCreate(BLXCOL_GENE_NAME,   TRUE,             "Gene Name",  G_TYPE_STRING, RENDERER_TEXT_PROPERTY,     BLXCOL_GENE_NAME_WIDTH,      optionalColumns, FALSE, TRUE,  TRUE,  TRUE,   "Gene name",   "GN", NULL, &columnList);
   blxColumnCreate(BLXCOL_TISSUE_TYPE, TRUE,             "Tissue Type",G_TYPE_STRING, RENDERER_TEXT_PROPERTY,     BLXCOL_TISSUE_TYPE_WIDTH,    optionalColumns, FALSE, TRUE,  TRUE,  TRUE,   "Tissue type", "FT", "tissue_type", &columnList);
   blxColumnCreate(BLXCOL_STRAIN,      TRUE,             "Strain",     G_TYPE_STRING, RENDERER_TEXT_PROPERTY,     BLXCOL_STRAIN_WIDTH,         optionalColumns, FALSE, TRUE,  TRUE,  TRUE,   "Strain",      "FT", "strain", &columnList);
-                                                                                                                                                                             
-  /* Insert optional columns here, with a dynamically-created IDs that are >= BLXCOL_NUM_COLS */                                                                             
-  int columnId = BLXCOL_NUM_COLUMNS;                                                                                                                                         
+
+  /* Insert optional columns here, with a dynamically-created IDs that are >= BLXCOL_NUM_COLS */
+  int columnId = BLXCOL_NUM_COLUMNS;
   blxColumnCreate((BlxColumnId)columnId++, TRUE,        "Description",G_TYPE_STRING, RENDERER_TEXT_PROPERTY,     BLXCOL_DEFAULT_WIDTH,        optionalColumns, FALSE, TRUE,  TRUE,  TRUE,   "Description", "DE", NULL, &columnList);
-                                                                                                                                                                                                             
+
   blxColumnCreate(BLXCOL_GROUP,       TRUE,             "Group",      G_TYPE_STRING, RENDERER_TEXT_PROPERTY,     BLXCOL_GROUP_WIDTH,          TRUE,            FALSE, FALSE, FALSE, TRUE,   "Group",       NULL, NULL, &columnList);
   blxColumnCreate(BLXCOL_SCORE,       TRUE,             "Score",      G_TYPE_DOUBLE, RENDERER_TEXT_PROPERTY,     BLXCOL_SCORE_WIDTH,          TRUE,            TRUE,  FALSE, FALSE, FALSE,  "Score",       NULL, NULL, &columnList);
   blxColumnCreate(BLXCOL_ID,          TRUE,             "%Id",        G_TYPE_DOUBLE, RENDERER_TEXT_PROPERTY,     BLXCOL_ID_WIDTH,             TRUE,            TRUE,  FALSE, FALSE, FALSE,  "Identity",    NULL, NULL, &columnList);
@@ -1858,7 +1859,7 @@ int getColumnWidth(const GList *columnList, const BlxColumnId columnId)
     {
       result = columnInfo->width;
     }
-  
+
   return result;
 }
 
@@ -1867,14 +1868,14 @@ int getColumnWidth(const GList *columnList, const BlxColumnId columnId)
 const char* getColumnTitle(const GList *columnList, const BlxColumnId columnId)
 {
   const char *result = NULL;
-  
+
   BlxColumnInfo *columnInfo = getColumnInfo(columnList, columnId);
 
   if (columnInfo)
     {
       result = columnInfo->title;
     }
-  
+
   return result;
 }
 
@@ -1884,14 +1885,14 @@ const char* getColumnTitle(const GList *columnList, const BlxColumnId columnId)
 void getColumnXCoords(const GList *columnList, const BlxColumnId columnId, IntRange *xRange)
 {
   xRange->set(0, 0);
-  
+
   /* Loop through all visible columns up to the given column, summing their widths. */
   const GList *columnItem = columnList;
-  
+
   for ( ; columnItem; columnItem = columnItem->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)(columnItem->data);
-      
+
       if (columnInfo->columnId != columnId)
         {
           if (showColumn(columnInfo))
@@ -1905,7 +1906,7 @@ void getColumnXCoords(const GList *columnList, const BlxColumnId columnId, IntRa
             xRange->setMax(xRange->min() + columnInfo->width);
           else
             xRange->setMax(xRange->min()); /* return zero-width if column is not visible */
-          
+
           break;
         }
     }
@@ -1924,7 +1925,7 @@ void saveColumnWidths(GList *columnList, GKeyFile *key_file)
 {
   /* Loop through each column */
   GList *listItem = columnList;
-  
+
   for ( ; listItem; listItem = listItem->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)(listItem->data);
@@ -1946,7 +1947,7 @@ void saveSummaryColumns(GList *columnList, GKeyFile *key_file)
 {
   /* Loop through each column */
   GList *listItem = columnList;
-  
+
   for ( ; listItem; listItem = listItem->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)(listItem->data);
diff --git a/src/blixemApp/blxview.hpp b/src/blixemApp/blxview.hpp
index 0b93e8a2cb8b6502e56a6373c47ebb6f9fe129aa..2023135aae5414a994878d1a394caf7503e75fe6 100644
--- a/src/blixemApp/blxview.hpp
+++ b/src/blixemApp/blxview.hpp
@@ -1,5 +1,6 @@
 /*  File: blxview.h
  *  Author: Erik Sonnhammer, 1992-02-20
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
diff --git a/src/blixemApp/blxwindow.cpp b/src/blixemApp/blxwindow.cpp
index 006a01f84c0ba71ed15e4e848473d6d1cce25b4e..03a8c79abd5f20d863664af7203ba3f1404df8f0 100644
--- a/src/blixemApp/blxwindow.cpp
+++ b/src/blixemApp/blxwindow.cpp
@@ -1,5 +1,6 @@
 /*  File: blxWindow.c
  *  Author: Gemma Barson, 2009-11-24
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -321,7 +322,7 @@ static gboolean userIsDeveloper()
   gboolean result = FALSE;
   const gchar *user = g_get_user_name();
   int numDevelopers = sizeof(developers) / sizeof(gchar*);
-  
+
   int i = 0;
   for (i = 0; i < numDevelopers; ++i)
     {
@@ -350,7 +351,7 @@ int sequenceGetGroupOrder(GtkWidget *blxWindow, const BlxSequence *seq)
 static void scrollDetailView(GtkWidget *window, const gboolean moveLeft, const gboolean modifier)
 {
   GtkWidget *detailView = blxWindowGetDetailView(window);
-  
+
   if (moveLeft && modifier)
     scrollDetailViewLeftPage(detailView);
   else if (moveLeft)
@@ -368,7 +369,7 @@ static gboolean moveRowSelection(GtkWidget *blxWindow, const gboolean moveUp, co
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
   const int activeFrame = detailViewGetActiveFrame(detailView);
   const BlxStrand activeStrand = detailViewGetSelectedStrand(detailView);
-  
+
   GtkWidget *tree = detailViewGetTree(detailView, activeStrand, activeFrame);
   return treeMoveRowSelection(tree, moveUp, shiftModifier);
 }
@@ -376,7 +377,7 @@ static gboolean moveRowSelection(GtkWidget *blxWindow, const gboolean moveUp, co
 
 /* Move the selected base index 1 base to the left/right. Moves by individual
  * DNA bases (i.e. you have to move 3 bases in order to scroll a full peptide
- * if viewing protein matches). Scrolls the detail view if necessary to keep 
+ * if viewing protein matches). Scrolls the detail view if necessary to keep
  * the new base in view. */
 static void moveSelectedBaseIdxBy1(GtkWidget *window, const gboolean moveLeft, const gboolean extend)
 {
@@ -385,7 +386,7 @@ static void moveSelectedBaseIdxBy1(GtkWidget *window, const gboolean moveLeft, c
 
   const gboolean displayRev = detailViewGetDisplayRev(detailView);
   const int direction = (moveLeft == displayRev ? 1 : -1);
-  
+
   int newDnaIdx = UNSET_INT;
   gboolean ok = FALSE;
 
@@ -394,13 +395,13 @@ static void moveSelectedBaseIdxBy1(GtkWidget *window, const gboolean moveLeft, c
       newDnaIdx = properties->selectedIndex->dnaIdx + direction;
       ok = TRUE;
     }
-  
+
   if (ok)
     {
-      detailViewSetSelectedDnaBaseIdx(detailView, 
-                                      newDnaIdx, 
+      detailViewSetSelectedDnaBaseIdx(detailView,
+                                      newDnaIdx,
                                       detailViewGetActiveFrame(detailView),
-                                      TRUE, 
+                                      TRUE,
                                       TRUE,
                                       extend);
     }
@@ -408,12 +409,12 @@ static void moveSelectedBaseIdxBy1(GtkWidget *window, const gboolean moveLeft, c
 
 
 /* Called when user pressed Home/End. If the modifier is pressed, scroll to the
-*  start/end of all matches in the current selection (or all matches, if no 
+*  start/end of all matches in the current selection (or all matches, if no
 * selection), or to the start/end of the entire display if the modifier is not pressed. */
 static void scrollToExtremity(GtkWidget *blxWindow, const gboolean moveLeft, const gboolean modifier, const gboolean extend)
 {
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
-  
+
   if (modifier)
     {
       GList *selectedSeqs = blxWindowGetSelectedSeqs(blxWindow);
@@ -441,20 +442,20 @@ static void scrollToExtremity(GtkWidget *blxWindow, const gboolean moveLeft, con
 static void goToMatch(GtkWidget *blxWindow, const gboolean moveLeft, const gboolean extend)
 {
   GList *selectedSeqs = blxWindowGetSelectedSeqs(blxWindow);
-  
+
   if (moveLeft)
     {
       prevMatch(blxWindowGetDetailView(blxWindow), selectedSeqs, extend);
     }
   else
     {
-      nextMatch(blxWindowGetDetailView(blxWindow), selectedSeqs, extend);  
+      nextMatch(blxWindowGetDetailView(blxWindow), selectedSeqs, extend);
     }
 }
 
 
 /* Move the selected display index 1 value to the left/right. Moves by full peptides
- * if viewing protein matches. Scrolls the detail view if necessary to keep the new 
+ * if viewing protein matches. Scrolls the detail view if necessary to keep the new
  * index in view. If extend is true we extend the current selection range, otherwise
  * just move the current selection index */
 static void moveSelectedDisplayIdxBy1(GtkWidget *window, const gboolean moveLeft, const gboolean extend)
@@ -471,7 +472,7 @@ static void moveSelectedDisplayIdxBy1(GtkWidget *window, const gboolean moveLeft
     {
       /* Decrement the index if moving left or increment if moving right */
       newSelectedBaseIdx = detailViewProperties->selectedIndex->displayIdx;
-      
+
       if (moveLeft)
         --newSelectedBaseIdx;
       else
@@ -528,16 +529,16 @@ void blxWindowRedrawAll(GtkWidget *blxWindow)
 
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
   detailViewRefreshAllHeaders(detailView);
-  
+
   callFuncOnAllDetailViewTrees(detailView, widgetClearCachedDrawable, NULL);
-  
+
   gtk_widget_queue_draw(blxWindow);
 }
 
 
 /* Utility to create a vbox with the given border and pack it into the given box.
  * Also put a frame around it with the given label if includeFrame is true */
-static GtkWidget* createVBoxWithBorder(GtkWidget *parent, 
+static GtkWidget* createVBoxWithBorder(GtkWidget *parent,
                                        const int borderWidth,
                                        const gboolean includeFrame,
                                        const char *frameTitle)
@@ -555,7 +556,7 @@ static GtkWidget* createVBoxWithBorder(GtkWidget *parent,
     {
       gtk_box_pack_start(GTK_BOX(parent), vbox, FALSE, FALSE, 0);
     }
-  
+
   return vbox;
 }
 
@@ -564,7 +565,7 @@ static GtkWidget* createHBoxWithBorder(GtkWidget *parent, const int borderWidth,
 {
   GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
   gtk_container_set_border_width(GTK_CONTAINER(hbox), borderWidth);
-  
+
   if (includeFrame)
     {
       GtkWidget *frame = gtk_frame_new(frameTitle);
@@ -575,7 +576,7 @@ static GtkWidget* createHBoxWithBorder(GtkWidget *parent, const int borderWidth,
     {
       gtk_container_add(GTK_CONTAINER(parent), hbox);
     }
-  
+
   return hbox;
 }
 
@@ -585,47 +586,47 @@ static GtkWidget* createHBoxWithBorder(GtkWidget *parent, const int borderWidth,
 static gboolean blxWindowGroupsExist(GtkWidget *blxWindow)
 {
   gboolean result = FALSE;
-  
+
   BlxContext *blxContext = blxWindowGetContext(blxWindow);
   GList *groupList = blxContext->sequenceGroups;
-  
+
   if (g_list_length(groupList) >= 1)
     {
       result = TRUE;
     }
-  
+
   return result;
 }
 
 
 /* Utility to create a text entry widget displaying the given double value. The
- * given callback will be called when the user OK's the dialog that this widget 
+ * given callback will be called when the user OK's the dialog that this widget
  * is a child of. */
 static GtkWidget* createTextEntryString(const char *value)
 {
   GtkWidget *entry = gtk_entry_new();
-  
+
   gtk_entry_set_text(GTK_ENTRY(entry), value);
   gtk_entry_set_width_chars(GTK_ENTRY(entry), strlen(value) + 2);
   gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-  
+
   return entry;
 }
 
 
 /* Utility to create a text entry widget displaying the given double value. The
- * given callback will be called when the user OK's the dialog that this widget 
+ * given callback will be called when the user OK's the dialog that this widget
  * is a child of. */
 static GtkWidget* createTextEntryInt(const int value)
 {
   GtkWidget *entry = gtk_entry_new();
-  
+
   char *displayText = convertIntToString(value);
   gtk_entry_set_text(GTK_ENTRY(entry), displayText);
-  
+
   gtk_entry_set_width_chars(GTK_ENTRY(entry), strlen(displayText) + 2);
   gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-  
+
   g_free(displayText);
 
   return entry;
@@ -637,17 +638,17 @@ static GtkWidget* createTextEntryInt(const int value)
  * source should be, and allows the user to edit the coordinate range
  * to fetch data for. If the user enters valid values and hits OK then
  * the return values are populated and we return TRUE; else return FALSE. */
-static gboolean showNonNativeFileDialog(GtkWidget *window, 
+static gboolean showNonNativeFileDialog(GtkWidget *window,
                                         const char *filename,
                                         GString **source_out,
                                         int *start_out,
                                         int *end_out)
 {
   BlxContext *bc = blxWindowGetContext(window);
-  
+
   char *title = g_strdup_printf("%sLoad Non-Native File", blxGetTitlePrefix(bc));
 
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
                                                   GTK_WINDOW(window),
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                                   GTK_STOCK_CANCEL,
@@ -657,20 +658,20 @@ static gboolean showNonNativeFileDialog(GtkWidget *window,
                                                   NULL);
 
   g_free(title);
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
 
   GtkContainer *contentArea = GTK_CONTAINER(GTK_DIALOG(dialog)->vbox);
 
-  char *labelStr = g_strdup_printf("\nFile '%s' is not a natively-supported file format.\n\nSpecify the Source to fetch data from this file using an external command\n(a fetch method for the Source must be specified in the config file)\n", filename);  
+  char *labelStr = g_strdup_printf("\nFile '%s' is not a natively-supported file format.\n\nSpecify the Source to fetch data from this file using an external command\n(a fetch method for the Source must be specified in the config file)\n", filename);
   GtkWidget *label = gtk_label_new(labelStr);
   g_free(labelStr);
-  
+
   GtkWidget *sourceEntry = createTextEntryString("");
   GtkWidget *label2 = gtk_label_new("\n\nRegion to fetch data for:");
   GtkWidget *startEntry = createTextEntryInt(bc->refSeqRange.min());
   GtkWidget *endEntry = createTextEntryInt(bc->refSeqRange.max());
-  
+
   GtkTable *table = GTK_TABLE(gtk_table_new(5, 2, FALSE));
   gtk_container_add(contentArea, GTK_WIDGET(table));
 
@@ -686,11 +687,11 @@ static gboolean showNonNativeFileDialog(GtkWidget *window,
   gtk_widget_show_all(dialog);
   gint response = gtk_dialog_run(GTK_DIALOG(dialog));
   gboolean result = FALSE;
-  
+
   if (response == GTK_RESPONSE_ACCEPT)
     {
       const gchar *source = gtk_entry_get_text(GTK_ENTRY(sourceEntry));
-      
+
       /* source is mandatory */
       if (source && *source)
         {
@@ -711,7 +712,7 @@ static gboolean showNonNativeFileDialog(GtkWidget *window,
  * file into blixem, using an external script to convert the file into
  * a supported file format such as GFF. A fetch method stanza must exist in the
  * config to define the script and its parameters.
- * This function asks the user what Source the file relates to so that it can 
+ * This function asks the user what Source the file relates to so that it can
  * look up the fetch method that should be used. It optionally also allows the
  * user to specify a coordinate range to limit the fetch to.. */
 static void loadNonNativeFile(const char *filename,
@@ -728,7 +729,7 @@ static void loadNonNativeFile(const char *filename,
 
   GString *source = NULL;
   int start = bc->refSeqRange.min(), end = bc->refSeqRange.max();
-  
+
   if (!showNonNativeFileDialog(blxWindow, filename, &source, &start, &end))
     return;
 
@@ -768,7 +769,7 @@ static void loadNonNativeFile(const char *filename,
           g_set_error(&tmp_error, BLX_ERROR, 1, "Expected fetch method output type to be '%s' but got '%s'\n", outputTypeStr(BLXFETCH_OUTPUT_GFF), outputTypeStr(fetchMethod->outputType));
         }
     }
-     
+
   if (!tmp_error)
     {
       MatchSequenceData match_data = {NULL, bc->refSeqName, start, end, bc->dataset, source->str, filename};
@@ -779,13 +780,13 @@ static void loadNonNativeFile(const char *filename,
           const char *fetchName = g_quark_to_string(fetchMethod->name);
           GSList *styles = blxReadStylesFile(NULL, NULL);
 
-          sendFetchOutputToFile(command, keyFile, &bc->blastMode, 
+          sendFetchOutputToFile(command, keyFile, &bc->blastMode,
                                 bc->featureLists, bc->supportedTypes, styles,
-                                &bc->matchSeqs, &bc->mspList, 
+                                &bc->matchSeqs, &bc->mspList,
                                 fetchName, bc->saveTempFiles, newMsps, newSeqs,
                                 bc->columnList, lookupTable, refSeqOffset, refSeqRange, &tmp_error);
         }
-    }          
+    }
 
   if (tmp_error)
     g_propagate_error(error, tmp_error);
@@ -843,7 +844,7 @@ static void dynamicLoadFeaturesFile(GtkWidget *blxWindow, const char *filename,
   g_return_if_fail(bc);
 
   GKeyFile *keyFile = blxGetConfig();
-  
+
   /* We'll load the features from the file into some temporary lists */
   MSP *newMsps = NULL;
   GList *newSeqs = NULL;
@@ -861,12 +862,12 @@ static void dynamicLoadFeaturesFile(GtkWidget *blxWindow, const char *filename,
     {
       /* Input file is not natively supported. We can still load it if
        * there is a fetch method associated with it: ask the user what
-       * the Source is so that we can find the fetch method. Probably 
+       * the Source is so that we can find the fetch method. Probably
        * should only get here if the input is an actual file so don't
        * support this for buffers for now. */
       g_error_free(tmp_error);
       tmp_error = NULL;
-      
+
       loadNonNativeFile(filename, blxWindow, &newMsps, &newSeqs, lookupTable, bc->refSeqOffset, &bc->refSeqRange, &tmp_error);
     }
 
@@ -894,7 +895,7 @@ static void dynamicLoadFeaturesFile(GtkWidget *blxWindow, const char *filename,
     {
       finaliseFetch(newSeqs, bc->columnList);
 
-      finaliseBlxSequences(bc->featureLists, &newMsps, &newSeqs, bc->columnList, bc->refSeqOffset, bc->seqType, 
+      finaliseBlxSequences(bc->featureLists, &newMsps, &newSeqs, bc->columnList, bc->refSeqOffset, bc->seqType,
                            bc->numFrames, &bc->refSeqRange, TRUE, lookupTable);
 
       double lowestId = calculateMspData(newMsps, bc);
@@ -917,15 +918,15 @@ static void dynamicLoadFeaturesFile(GtkWidget *blxWindow, const char *filename,
       /* Recalculate the coverage */
       bc->calculateDepth(numUnalignedBases);
       updateCoverageDepth(blxWindow);
-  
+
       /* Re-calculate the height of the exon views */
       GtkWidget *bigPicture = blxWindowGetBigPicture(blxWindow);
       calculateExonViewHeight(bigPictureGetFwdExonView(bigPicture));
       calculateExonViewHeight(bigPictureGetRevExonView(bigPicture));
       forceResize(bigPicture);
-  
+
       blxWindowRedrawAll(blxWindow);
-      
+
       if (numAdded == 0)
         g_warning("No features loaded\n");
       else if (numAdded == 1)
@@ -952,19 +953,19 @@ static void toggleTreeVisibility(GtkWidget *blxWindow, const int number)
 {
   const gboolean toggled = blxWindowGetDisplayRev(blxWindow);
   const BlxStrand activeStrand = toggled ? BLXSTRAND_REVERSE : BLXSTRAND_FORWARD;
-  
-  /* For protein matches, trees are always displayed in frame order (i.e. 1, 2, 3), 
+
+  /* For protein matches, trees are always displayed in frame order (i.e. 1, 2, 3),
    * so just use the number pressed for the frame, and the active strand for the
    * strand. */
   int frame = number;
   BlxStrand strand = activeStrand;
-  
+
   /* For DNA matches, the frame is always 1, but the strand depends on which number
    * was pressed: use 1 to toggle active strand, 2 for other strand */
   if (blxWindowGetSeqType(blxWindow) == BLXSEQ_DNA)
     {
       frame = 1;
-      
+
       if (number == 1)
         {
           strand = activeStrand;
@@ -974,10 +975,10 @@ static void toggleTreeVisibility(GtkWidget *blxWindow, const int number)
           strand = toggled ? BLXSTRAND_FORWARD : BLXSTRAND_REVERSE;
         }
     }
-  
+
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
   GtkWidget *tree = detailViewGetTreeContainer(detailView, strand, frame);
-  
+
   if (tree && gtk_widget_get_parent(tree))
     {
       widgetSetHidden(tree, !widgetGetHidden(tree));
@@ -992,7 +993,7 @@ static void toggleGridVisibility(GtkWidget *blxWindow, const int number)
     {
       GtkWidget *bigPicture = blxWindowGetBigPicture(blxWindow);
       const gboolean useFwdGrid = (number == 1) != blxWindowGetDisplayRev(blxWindow);
-      
+
       GtkWidget *grid = useFwdGrid ? bigPictureGetFwdGrid(bigPicture) : bigPictureGetRevGrid(bigPicture);
       widgetSetHidden(grid, !widgetGetHidden(grid));
 
@@ -1010,7 +1011,7 @@ static void toggleExonViewVisibility(GtkWidget *blxWindow, const int number)
     {
       GtkWidget *bigPicture = blxWindowGetBigPicture(blxWindow);
       const gboolean useFwdExonView = (number == 1) != blxWindowGetDisplayRev(blxWindow);
-      
+
       GtkWidget *exonView = useFwdExonView ? bigPictureGetFwdExonView(bigPicture) : bigPictureGetRevExonView(bigPicture);
       widgetSetHidden(exonView, !widgetGetHidden(exonView));
 
@@ -1061,24 +1062,24 @@ static void findAgain(GtkWidget *blxWindow, const gboolean modifier)
       const int newStart = getSearchStartCoord(blxWindow, TRUE, modifier);
       blxWindowFindDnaString(blxWindow, NULL, newStart, modifier, TRUE, &error);
     }
-  
+
   if (!error)
     {
       /* Try the search-from-list search. Returns NULL if last search was not a list search */
       GList *seqList = findSeqsFromList(blxWindow, NULL, BLXCOL_NONE, FALSE, TRUE, &error);
-      
+
       if (!seqList && !error)
         {
           /* Try the search-by-name search. Returns NULL if last search was not a name search. */
           seqList = findSeqsFromColumn(blxWindow, NULL, BLXCOL_NONE, FALSE, TRUE, &error);
         }
-      
-      /* If either the list or name search succeeded, select the prev/next MSP from the 
+
+      /* If either the list or name search succeeded, select the prev/next MSP from the
        * found sequence(s) depending on which direction we're searching. */
       if (seqList)
         {
           blxWindowSetSelectedSeqList(blxWindow, seqList);
-          
+
           if (modifier)
             {
               prevMatch(blxWindowGetDetailView(blxWindow), seqList, FALSE);
@@ -1089,7 +1090,7 @@ static void findAgain(GtkWidget *blxWindow, const gboolean modifier)
             }
         }
     }
-  
+
   if (error)
     {
       prefixError(error, "Find %s failed. ", (modifier ? "previous" : "next"));
@@ -1115,7 +1116,7 @@ static void createVisibilityButton(GtkWidget *widgetToToggle, const char *mnemon
 
   /* Set the state depending on the widget's current visibility */
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), GTK_WIDGET_VISIBLE(widgetToToggle));
-  
+
   g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(onVisibilityButtonToggled), widgetToToggle);
 }
 
@@ -1123,11 +1124,11 @@ static void createVisibilityButton(GtkWidget *widgetToToggle, const char *mnemon
 /* Create a check button to control visibility of the given tree. */
 static void createTreeVisibilityButton(GtkWidget *detailView, const BlxStrand strand, const int frame, GtkWidget *container)
 {
-  /* Some trees may have been removed from the blixem window if they are not on the active 
-   * strand, so only show check boxes for those that are in the window (i.e. have a parent). 
+  /* Some trees may have been removed from the blixem window if they are not on the active
+   * strand, so only show check boxes for those that are in the window (i.e. have a parent).
    * Note that we get the tree container here, which consists of the tree itself plus any headers etc. */
   GtkWidget *tree = detailViewGetTreeContainer(detailView, strand, frame);
-  
+
   if (gtk_widget_get_parent(tree))
     {
       const gboolean toggled = detailViewGetDisplayRev(detailView);
@@ -1172,7 +1173,7 @@ static void createExonButtons(GtkWidget *exonView, const char *visLabel, const c
   /* Pack everything in an hbox */
   GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(parent), hbox);
-  
+
   /* Create a check button to control visibility of the exon view */
   createVisibilityButton(exonView, visLabel, hbox);
 
@@ -1193,13 +1194,13 @@ void showViewPanesDialog(GtkWidget *blxWindow, const gboolean bringToFront)
   BlxContext *bc = blxWindowGetContext(blxWindow);
   const BlxDialogId dialogId = BLXDIALOG_VIEW;
   GtkWidget *dialog = getPersistentDialog(bc->dialogList, dialogId);
-  
+
   if (!dialog)
     {
       char *title = g_strdup_printf("%sView panes", blxGetTitlePrefix(bc));
 
-      dialog = gtk_dialog_new_with_buttons(title, 
-                                           GTK_WINDOW(blxWindow), 
+      dialog = gtk_dialog_new_with_buttons(title,
+                                           GTK_WINDOW(blxWindow),
                                            GTK_DIALOG_DESTROY_WITH_PARENT,
                                            GTK_STOCK_OK,
                                            GTK_RESPONSE_ACCEPT,
@@ -1210,7 +1211,7 @@ void showViewPanesDialog(GtkWidget *blxWindow, const gboolean bringToFront)
       /* These calls are required to make the dialog persistent... */
       addPersistentDialog(bc->dialogList, dialogId, dialog);
       g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-      
+
       g_signal_connect(dialog, "response", G_CALLBACK(onResponseDialog), GINT_TO_POINTER(TRUE));
     }
   else
@@ -1218,32 +1219,32 @@ void showViewPanesDialog(GtkWidget *blxWindow, const gboolean bringToFront)
       /* Clear contents and re-create */
       dialogClearContentArea(GTK_DIALOG(dialog));
     }
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
   GtkWidget *contentArea = GTK_DIALOG(dialog)->vbox;
 
   int borderWidth = 12;
-  
+
   /* Big picture */
   GtkWidget *bp = blxWindowGetBigPicture(blxWindow);
   GtkWidget *bpVbox = createVBoxWithBorder(contentArea, borderWidth, TRUE, "Big picture");
-  
+
   createVisibilityButton(bp, "Show _big picture", bpVbox);
   GtkWidget *bpSubBox = createVBoxWithBorder(bpVbox, borderWidth, FALSE, NULL);
-  
+
   GtkWidget *bpActiveStrand = createVBoxWithBorder(bpSubBox, 0, TRUE, "Active strand");
   createVisibilityButton(bigPictureGetActiveGrid(bp), "Show _grid", bpActiveStrand);
   createExonButtons(bigPictureGetActiveExonView(bp), "Show _exons    ", "_Bump exons    ", bpActiveStrand);
-  
+
   GtkWidget *bpOtherStrand = createVBoxWithBorder(bpSubBox, 0, TRUE, "Other strand");
   createVisibilityButton(bigPictureGetInactiveGrid(bp), "Show gr_id", bpOtherStrand);
   createExonButtons(bigPictureGetInactiveExonView(bp), "Show e_xons    ", "Bum_p exons    ", bpOtherStrand);
-  
+
   /* Detail view */
   GtkWidget *dvVbox = createVBoxWithBorder(contentArea, borderWidth, TRUE, "Alignment lists");
   GtkWidget *dv = blxWindowGetDetailView(blxWindow);
   createVisibilityButton(dv, "Show alignment _lists", dvVbox);
-  
+
   GtkWidget *dvSubBox = createVBoxWithBorder(dvVbox, borderWidth, FALSE, NULL);
   const int numFrames = blxWindowGetNumFrames(blxWindow);
   int frame = 1;
@@ -1252,7 +1253,7 @@ void showViewPanesDialog(GtkWidget *blxWindow, const gboolean bringToFront)
       createTreeVisibilityButton(dv, blxWindowGetActiveStrand(blxWindow), frame, dvSubBox);
       createTreeVisibilityButton(dv, blxWindowGetInactiveStrand(blxWindow), frame, dvSubBox);
     }
-  
+
   /* Coverage views */
   GtkWidget *bpCoverageView = blxWindowGetBigPictureCoverageView(blxWindow);
   GtkWidget *dvCoverageView = blxWindowGetDetailViewCoverageView(blxWindow);
@@ -1260,9 +1261,9 @@ void showViewPanesDialog(GtkWidget *blxWindow, const gboolean bringToFront)
   createVisibilityButton(bpCoverageView, "Show _coverage view (big picture)", coverageVbox);
   createVisibilityButton(dvCoverageView, "Show _coverage view (detail view)", coverageVbox);
 
-  
+
   gtk_widget_show_all(dialog);
-  
+
   if (bringToFront)
     {
       gtk_window_present(GTK_WINDOW(dialog));
@@ -1284,7 +1285,7 @@ static GList* findSeqsFromColumn(GtkWidget *blxWindow, const char *inputText, co
   /* Current values */
   char *searchStr = NULL;
   BlxColumnId searchCol = BLXCOL_NONE;
-  
+
   /* If it's a find-again, use the existing values; otherwise, use the input values */
   if (findAgain)
     {
@@ -1296,28 +1297,28 @@ static GList* findSeqsFromColumn(GtkWidget *blxWindow, const char *inputText, co
       g_free(searchStr);
       searchStr = g_strdup(inputText);
       searchCol = inputCol;
-    
+
       if (rememberSearch)
         {
           prevSearchStr = searchStr;
           prevSearchCol = searchCol;
         }
     }
-  
+
   if (!searchStr || searchCol == BLXCOL_NONE)
     {
       /* We will get here if we do a find-again when there wasn't a previous find */
       return NULL;
     }
-  
+
   /* Loop through all the sequences and see if the sequence data for this column
    * matches the search string */
   GList *seqList = blxWindowGetAllMatchSeqs(blxWindow);
   BlxContext *bc = blxWindowGetContext(blxWindow);
   SeqSearchData searchData = {searchStr, searchCol, bc, NULL, NULL};
-  
+
   g_list_foreach(seqList, getSequencesThatMatch, &searchData);
-  
+
   if (g_list_length(searchData.matchList) < 1)
     {
       GList *columnList = blxWindowGetColumnList(blxWindow);
@@ -1328,7 +1329,7 @@ static GList* findSeqsFromColumn(GtkWidget *blxWindow, const char *inputText, co
       else
         g_set_error(error, BLX_ERROR, BLX_ERROR_STRING_NOT_FOUND, "No sequences found where column '%s' matches text '%s'.\n", columnName, searchStr);
     }
-  
+
   return searchData.matchList;
 }
 
@@ -1342,13 +1343,13 @@ static const char* getStringFromTextView(GtkTextView *textView)
       g_critical("Could not set search string: invalid text entry box\n");
       return NULL;
     }
-  
+
   /* Get the input text from the text buffer and create the group */
   GtkTextBuffer *textBuffer = gtk_text_view_get_buffer(textView);
-  
+
   GtkTextIter start, end;
   gtk_text_buffer_get_bounds(textBuffer, &start, &end);
-  
+
   return gtk_text_buffer_get_text(textBuffer, &start, &end, TRUE);
 }
 
@@ -1357,20 +1358,20 @@ static const char* getStringFromTextView(GtkTextView *textView)
  * an item from the given input text. Returns the results as a GList of BlxSequences.
  * The input text may be a multi-line list (one search item per line). */
 static GList* findSeqsFromList(GtkWidget *blxWindow,
-                               const char *inputText, 
-                               const BlxColumnId inputCol, 
-                               const gboolean rememberSearch, 
-                               const gboolean findAgain, 
+                               const char *inputText,
+                               const BlxColumnId inputCol,
+                               const gboolean rememberSearch,
+                               const gboolean findAgain,
                                GError **error)
 {
   /* Previous values (if applicable) */
   static char *prevSearchStr = NULL;
   static BlxColumnId prevSearchCol = BLXCOL_NONE;
-  
+
   /* Current values */
   char *searchStr = NULL;
   BlxColumnId searchCol = BLXCOL_NONE;
-  
+
   /* If we-re doing a find-again, use the values from last time; otherwise use the input values */
   if (findAgain)
     {
@@ -1382,21 +1383,21 @@ static GList* findSeqsFromList(GtkWidget *blxWindow,
       g_free(searchStr);
       searchStr = g_strdup(inputText);
       searchCol = inputCol;
-    
+
       if (rememberSearch)
         {
           prevSearchStr = searchStr;
           prevSearchCol = searchCol;
         }
     }
-      
+
   if (!searchStr || searchCol == BLXCOL_NONE)
     {
       /* We may get here if we did a find-again when there was no previous find */
       return NULL;
     }
 
-  
+
   GError *tmpError = NULL;
   GList *seqList = getSeqStructsFromText(blxWindow, searchStr, searchCol, &tmpError);
 
@@ -1404,13 +1405,13 @@ static GList* findSeqsFromList(GtkWidget *blxWindow,
     {
       GList *columnList = blxWindowGetColumnList(blxWindow);
       const char *columnName = getColumnTitle(columnList, searchCol);
-      
+
       if (tmpError)
         g_propagate_error(error, tmpError);
       else
         g_set_error(error, BLX_ERROR, BLX_ERROR_STRING_NOT_FOUND, "No sequences found where column '%s' matches text '%s'.\n", columnName, searchStr);
     }
-  
+
   return seqList;
 }
 
@@ -1420,17 +1421,17 @@ static GList* findSeqsFromList(GtkWidget *blxWindow,
 static gboolean onFindSeqsFromName(GtkWidget *button, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   const char *inputText = NULL;
-  
+
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
     {
       inputText = getStringFromTextEntry(GTK_ENTRY(data));
     }
-  
+
   GtkWidget *dialog = gtk_widget_get_toplevel(button);
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(dialog)));
-  
+
   /* Find the combo box on the dialog (there should only be one), which tells
    * us which column to search. */
   GtkComboBox *combo = widgetGetComboBox(dialog);
@@ -1439,20 +1440,20 @@ static gboolean onFindSeqsFromName(GtkWidget *button, const gint responseId, gpo
   /* Find all sequences that match */
   GError *error = NULL;
   GList *seqList = findSeqsFromColumn(blxWindow, inputText, searchCol, TRUE, FALSE, &error);
-  
+
   if (error)
     {
       reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
       result = FALSE;
     }
-  
+
   if (seqList)
     {
       GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(button));
       GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
 
       blxWindowSetSelectedSeqList(blxWindow, seqList);
-      
+
       if (responseId == BLX_RESPONSE_FORWARD)
         {
           nextMatch(blxWindowGetDetailView(blxWindow), seqList, FALSE);
@@ -1466,7 +1467,7 @@ static gboolean onFindSeqsFromName(GtkWidget *button, const gint responseId, gpo
           firstMatch(blxWindowGetDetailView(blxWindow), seqList, FALSE);
         }
     }
-    
+
   return result;
 }
 
@@ -1476,15 +1477,15 @@ static gboolean onFindSeqsFromName(GtkWidget *button, const gint responseId, gpo
 static gboolean onFindSeqsFromList(GtkWidget *button, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   const char *inputText = NULL;
-  
+
   /* Nothing to do if this button is not active */
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
     {
       inputText = getStringFromTextView(GTK_TEXT_VIEW(data));
     }
-  
+
   /* Get the dialog and main window */
   GtkWidget *dialog = gtk_widget_get_toplevel(button);
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(dialog)));
@@ -1493,7 +1494,7 @@ static gboolean onFindSeqsFromList(GtkWidget *button, const gint responseId, gpo
    * us which column to search. */
   GtkComboBox *combo = widgetGetComboBox(dialog);
   BlxColumnId searchCol = getColumnFromComboBox(combo);
-  
+
   GError *error = NULL;
   GList *seqList = findSeqsFromList(blxWindow, inputText, searchCol, TRUE, FALSE, &error);
 
@@ -1502,11 +1503,11 @@ static gboolean onFindSeqsFromList(GtkWidget *button, const gint responseId, gpo
       reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
       result = FALSE;
     }
-  
+
   if (seqList)
     {
       blxWindowSetSelectedSeqList(blxWindow, seqList);
-      
+
       if (responseId == BLX_RESPONSE_FORWARD)
         {
           nextMatch(blxWindowGetDetailView(blxWindow), seqList, FALSE);
@@ -1520,7 +1521,7 @@ static gboolean onFindSeqsFromList(GtkWidget *button, const gint responseId, gpo
           firstMatch(blxWindowGetDetailView(blxWindow), seqList, FALSE);
         }
     }
-  
+
   return result;
 }
 
@@ -1528,25 +1529,25 @@ static gboolean onFindSeqsFromList(GtkWidget *button, const gint responseId, gpo
 /* Search for the given DNA string in the reference sequence. Searches for the next (rightwards)
  * value from the given start coord, unless searchLeft is true in which case it searches leftwards.
  * If findAgain is true it repeats the last DNA search. */
-static void blxWindowFindDnaString(GtkWidget *blxWindow, 
-                                   const char *inputSearchStr, 
+static void blxWindowFindDnaString(GtkWidget *blxWindow,
+                                   const char *inputSearchStr,
                                    const int refSeqStart,
-                                   const gboolean searchLeft, 
-                                   const gboolean findAgain, 
+                                   const gboolean searchLeft,
+                                   const gboolean findAgain,
                                    GError **error)
 {
   /* Remember the last input string for use with findAgain */
   static char *searchStr = NULL;
-  
+
   if (!findAgain)
     {
       /* We must copy the input string because it may not exist if/when we come to do a 'find again' */
       g_free(searchStr);
       searchStr = g_strdup(inputSearchStr);
     }
-  
+
   const int searchStrMax = searchStr ? strlen(searchStr) - 1 : -1;
-  
+
   if (searchStrMax < 0)
     {
       return;
@@ -1555,40 +1556,40 @@ static void blxWindowFindDnaString(GtkWidget *blxWindow,
   const int searchStart = searchLeft ? searchStrMax : 0;
   const int searchEnd = searchLeft ? 0 : searchStrMax;
   const int searchStrIncrement = searchLeft ? -1 : 1;
-  
+
   /* Values increase left-to-right in normal display or right-to-left in reversed display */
   BlxContext *bc = blxWindowGetContext(blxWindow);
   const gboolean searchForward = (searchLeft == bc->displayRev);
   const int refSeqIncrement = searchForward ? 1 : -1;
-  
+
   /* We'll need to complement ref seq bases if the active strand is the reverse strand */
   const gboolean complement = (blxWindowGetActiveStrand(blxWindow) == BLXSTRAND_REVERSE);
-  
+
   int refSeqIdx = refSeqStart;
   int searchStrIdx = searchStart;
   int matchStart = UNSET_INT;
-  
+
   while (refSeqIdx >= bc->refSeqRange.min() && refSeqIdx <= bc->refSeqRange.max() && searchStrIdx >= 0 && searchStrIdx <= searchStrMax)
     {
       const char refSeqBase = getSequenceIndex(bc->refSeq, refSeqIdx, complement, &bc->refSeqRange, BLXSEQ_DNA);
-      char searchStrBase = convertBaseToCorrectCase(searchStr[searchStrIdx], BLXSEQ_DNA);      
-      
+      char searchStrBase = convertBaseToCorrectCase(searchStr[searchStrIdx], BLXSEQ_DNA);
+
       if (refSeqBase == searchStrBase)
         {
-          /* The base matches. If it's the first matching base, set the match-start coord (or if we're 
-           * searching leftwards, then always set the match-start coord, because the start is actually 
+          /* The base matches. If it's the first matching base, set the match-start coord (or if we're
+           * searching leftwards, then always set the match-start coord, because the start is actually
            * the last coord that will be found). Then proceed to the next position in the search string */
           if (matchStart == UNSET_INT)
             {
               matchStart = refSeqIdx;
             }
-          
+
           searchStrIdx += searchStrIncrement;
           refSeqIdx += refSeqIncrement;
         }
       else if (matchStart != UNSET_INT)
         {
-          /* We were in a match but this base doesn't match. Reset to the start of the 
+          /* We were in a match but this base doesn't match. Reset to the start of the
            * search string, and start looking again from one base after the place where the last
            * match started. (We need to re-check all bases from there because we're comparing
            * against a different section of the search string now.) */
@@ -1601,28 +1602,28 @@ static void blxWindowFindDnaString(GtkWidget *blxWindow,
           refSeqIdx += refSeqIncrement;
         }
     }
-  
+
   /* Undo the last increment, so that we have the final coords of the matching section (if found) */
   refSeqIdx -= refSeqIncrement;
   searchStrIdx -= searchStrIncrement;
-  
+
   /* If we reached the end of the search string, then we matched the whole lot. */
   const gboolean finished = searchStrIdx == searchEnd;
-  
+
   if (matchStart != UNSET_INT && finished)
     {
       GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
       const int frame = 1;
-      
+
       int resultStart = searchLeft ? refSeqIdx : matchStart;
       int resultEnd = searchLeft ? matchStart : refSeqIdx;
-      
+
       /* Select the start index in the result */
       detailViewSetSelectedDnaBaseIdx(detailView, resultStart, frame, TRUE, FALSE, FALSE);
 
       /* Extend the selection to the end index */
       detailViewSetSelectedDnaBaseIdx(detailView, resultEnd, frame, FALSE, TRUE, TRUE);
-      
+
       detailViewRedrawAll(detailView);
     }
   else
@@ -1635,23 +1636,23 @@ static void blxWindowFindDnaString(GtkWidget *blxWindow,
 /* Get the start coord for a search. If startBeginning is false, this gets the currently-selected display
  * index (shifted by one base so that we don't start searching at the same position as a previous
  * find result) or, if no base index is selected, returns the start coord of the current display range. If
- * startBeginning is true, just start from the beginning of the reference sequence. The result is 
+ * startBeginning is true, just start from the beginning of the reference sequence. The result is
  * nucleotide coord on the ref sequence. */
 static int getSearchStartCoord(GtkWidget *blxWindow, const gboolean startBeginning, const gboolean searchLeft)
 {
   int result = UNSET_INT;
-  
+
   const BlxContext *bc = blxWindowGetContext(blxWindow);
-  
+
   if (startBeginning)
     {
       result = (searchLeft == bc->displayRev) ? bc->refSeqRange.min() : bc->refSeqRange.max();
     }
-  else  
+  else
     {
       GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
       result = detailViewGetSelectedDisplayIdx(detailView);
-      
+
       if (result != UNSET_INT)
         {
           /* Increment by one to make sure we don't re-find a previously-found match
@@ -1675,7 +1676,7 @@ static int getSearchStartCoord(GtkWidget *blxWindow, const gboolean startBeginni
       /* Convert the display coord to a nucleotide coord */
       result = convertDisplayIdxToDnaIdx(result, bc->seqType, 1, 1, bc->numFrames, bc->displayRev, &bc->refSeqRange);
     }
-  
+
   return result;
 }
 
@@ -1686,7 +1687,7 @@ static int getSearchStartCoord(GtkWidget *blxWindow, const gboolean startBeginni
 static gboolean onFindDnaString(GtkWidget *button, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   /* Get the search string from the text entry. If the toggle button is not active, call
    * blxWindowFindDnaString with a NULL search string to "cancel" any previous searches
    * so that "findAgain" will not attempt to perform a DNA search). */
@@ -1708,13 +1709,13 @@ static gboolean onFindDnaString(GtkWidget *button, const gint responseId, gpoint
 
   GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(button));
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
-  
+
   const gboolean startBeginning = (responseId != BLX_RESPONSE_FORWARD && responseId != BLX_RESPONSE_BACK);
   int startCoord = getSearchStartCoord(blxWindow, startBeginning, searchLeft);
-  
+
   GError *error = NULL;
   blxWindowFindDnaString(blxWindow, searchStr, startCoord, searchLeft, FALSE, &error);
-  
+
   if (error)
     {
       if (!startBeginning)
@@ -1722,19 +1723,19 @@ static gboolean onFindDnaString(GtkWidget *button, const gint responseId, gpoint
           /* Try looping round to the beginning */
           postfixError(error, " Trying again from the %s of the range.\n", (searchLeft ? "end" : "start"));
           reportAndClearIfError(&error, G_LOG_LEVEL_WARNING);
-          
+
           startCoord = getSearchStartCoord(blxWindow, TRUE, searchLeft);
           blxWindowFindDnaString(blxWindow, searchStr, startCoord, searchLeft, FALSE, &error);
         }
     }
-  
+
   if (error)
     {
       result = FALSE;
       prefixError(error, "DNA search failed. ");
       reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
     }
-  
+
   return result;
 }
 
@@ -1744,19 +1745,19 @@ static void createSearchColumnCombo(GtkTable *table, const int col, const int ro
 {
   GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
   gtk_table_attach(table, hbox, col, col + 1, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_SHRINK, DEFAULT_TABLE_XPAD, DEFAULT_TABLE_YPAD);
-  
+
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
   DetailViewProperties *dvProperties = detailViewGetProperties(detailView);
   GList *columnList = blxWindowGetColumnList(dvProperties->blxWindow());
 
-  createSortBox(GTK_BOX(hbox), detailView, BLXCOL_SEQNAME, columnList, "Search column: ", TRUE);  
+  createSortBox(GTK_BOX(hbox), detailView, BLXCOL_SEQNAME, columnList, "Search column: ", TRUE);
 }
 
 
 static void onClearFindDialog(GtkWidget *button, gpointer data)
 {
   GSList *entryList = (GSList*)data;
-  
+
   for ( ; entryList; entryList = entryList->next)
     {
       if (GTK_IS_ENTRY(entryList->data))
@@ -1797,28 +1798,28 @@ void showFindDialog(GtkWidget *blxWindow, const gboolean bringToFront)
   BlxContext *bc = blxWindowGetContext(blxWindow);
   const BlxDialogId dialogId = BLXDIALOG_FIND;
   GtkWidget *dialog = getPersistentDialog(bc->dialogList, dialogId);
-  
+
   if (!dialog)
     {
       char *title = g_strdup_printf("%sFind sequences", blxGetTitlePrefix(bc));
 
       /* Note that we add some buttons here but some more at the end because
        * we want to create a custom Clear button in the middle somewhere */
-      dialog = gtk_dialog_new_with_buttons(title, 
-                                           GTK_WINDOW(blxWindow), 
+      dialog = gtk_dialog_new_with_buttons(title,
+                                           GTK_WINDOW(blxWindow),
                                            GTK_DIALOG_DESTROY_WITH_PARENT,
                                            GTK_STOCK_GO_BACK,     /* previous match */
                                            BLX_RESPONSE_BACK,
                                            GTK_STOCK_GO_FORWARD,  /* next match */
                                            BLX_RESPONSE_FORWARD,
                                            NULL);
-      
+
       g_free(title);
-      
+
       /* These calls are required to make the dialog persistent... */
       addPersistentDialog(bc->dialogList, dialogId, dialog);
       g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-      
+
       GtkBox *contentArea = GTK_BOX(GTK_DIALOG(dialog)->vbox);
       GtkBox *actionArea = GTK_BOX(GTK_DIALOG(dialog)->action_area);
       const int numRows = 3;
@@ -1833,10 +1834,10 @@ void showFindDialog(GtkWidget *blxWindow, const gboolean bringToFront)
       GtkRadioButton *button1 = createRadioButton(table, 1, 1, NULL, "_Text search (wildcards * and ?)", TRUE, TRUE, FALSE, onFindSeqsFromName, blxWindow, &entryList);
       createRadioButton(table, 1, 2, button1, "_List search", FALSE, TRUE, TRUE, onFindSeqsFromList, blxWindow, &entryList);
       createSearchColumnCombo(table, 1, 3, blxWindow);
-      
+
       /* Column 2: ref-seq search options */
       createRadioButton(table, 2, 1, button1, "_DNA search", FALSE, TRUE, FALSE, onFindDnaString, blxWindow, &entryList);
-      
+
       /* Add a button to clear the text entry fields. It's easier to do this
        * here than in the response callback because we want to send different data */
       GtkWidget *clearButton = gtk_button_new_from_stock(GTK_STOCK_CLEAR);
@@ -1857,9 +1858,9 @@ void showFindDialog(GtkWidget *blxWindow, const gboolean bringToFront)
     }
 
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-  
+
   gtk_widget_show_all(dialog);
-  
+
   if (bringToFront)
     {
       gtk_window_present(GTK_WINDOW(dialog));
@@ -1870,24 +1871,24 @@ void showFindDialog(GtkWidget *blxWindow, const gboolean bringToFront)
 /* Show the 'Info' dialog, which displays info about the currently-selected sequence(s) */
 void showInfoDialog(GtkWidget *blxWindow)
 {
-  GtkWidget *dialog = gtk_dialog_new_with_buttons("Blixem - Sequence info", 
-						  NULL, 
+  GtkWidget *dialog = gtk_dialog_new_with_buttons("Blixem - Sequence info",
+						  NULL,
 						  GTK_DIALOG_DESTROY_WITH_PARENT,
 						  GTK_STOCK_CLOSE,
 						  GTK_RESPONSE_REJECT,
 						  NULL);
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_REJECT);
 
   int width = blxWindow->allocation.width * 0.7;
   int height = blxWindow->allocation.height * 0.9;
-  
+
   BlxContext *bc = blxWindowGetContext(blxWindow);
 
   /* Compile the message text from the selected sequence(s) */
   GString *resultStr = g_string_new("");
   GList *seqItem = bc->selectedSeqs;
-  
+
   for ( ; seqItem; seqItem = seqItem->next)
     {
       BlxSequence *blxSeq = (BlxSequence*)(seqItem->data);
@@ -1895,19 +1896,19 @@ void showInfoDialog(GtkWidget *blxWindow)
       g_string_append_printf(resultStr, "%s\n\n", seqText);
       g_free(seqText);
     }
-  
+
   /* We'll use the same fixed-width font as the detail-view */
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
   PangoFontDescription *fontDesc = detailViewGetFontDesc(detailView);
-  
+
   GtkWidget *child = createScrollableTextView(resultStr->str, TRUE, fontDesc, TRUE, NULL, &height, NULL);
-                             
+
   gtk_window_set_default_size(GTK_WINDOW(dialog), width, height);
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), child, TRUE, TRUE, 0);
-  
+
   g_signal_connect(dialog, "response", G_CALLBACK(onResponseDialog), NULL);
   gtk_widget_show_all(dialog);
-  
+
   g_string_free(resultStr, TRUE);
 }
 
@@ -1917,7 +1918,7 @@ void showInfoDialog(GtkWidget *blxWindow)
 static void toggleBumpState(GtkWidget *blxWindow)
 {
   GtkWidget *bigPicture = blxWindowGetBigPicture(blxWindow);
-  
+
   exonViewToggleExpanded(bigPictureGetFwdExonView(bigPicture));
   exonViewToggleExpanded(bigPictureGetRevExonView(bigPicture));
 }
@@ -1930,7 +1931,7 @@ static void toggleBumpState(GtkWidget *blxWindow)
 static void blxWindowDeleteSequenceGroup(GtkWidget *blxWindow, SequenceGroup *group)
 {
   BlxContext *blxContext = blxWindowGetContext(blxWindow);
-  
+
   if (blxContext->sequenceGroups)
     {
       blxContext->destroySequenceGroup(&group);
@@ -1953,10 +1954,10 @@ static void blxWindowGroupsChanged(GtkWidget *blxWindow)
 {
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
   GtkWidget *bigPicture = blxWindowGetBigPicture(blxWindow);
-  
+
   /* Re-sort all trees, because grouping affects sort order */
   detailViewResortTrees(detailView);
-  
+
   /* Refilter the trees (because groups affect whether sequences are visible) */
   callFuncOnAllDetailViewTrees(detailView, refilterTree, NULL);
 
@@ -1971,14 +1972,14 @@ static void blxWindowGroupsChanged(GtkWidget *blxWindow)
 
 
 /* Create a new sequence group from the given list of sequence names, with a
- * unique ID and name, and add it to the blxWindow's list of groups. The group 
+ * unique ID and name, and add it to the blxWindow's list of groups. The group
  * should be destroyed with destroySequenceGroup. If ownSeqNames is true, the group
- * will take ownership of the sequence names and free them when it is destroyed. 
+ * will take ownership of the sequence names and free them when it is destroyed.
  * Caller can optionally provide the group name; if not provided, a default name
  * will be allocated. */
-static SequenceGroup* createSequenceGroup(GtkWidget *blxWindow, 
-                                          GList *seqList, 
-                                          const gboolean ownSeqNames, 
+static SequenceGroup* createSequenceGroup(GtkWidget *blxWindow,
+                                          GList *seqList,
+                                          const gboolean ownSeqNames,
                                           const char *groupName,
                                           const bool isQuickGroup = false,
                                           const bool isFilter = false,
@@ -1986,20 +1987,20 @@ static SequenceGroup* createSequenceGroup(GtkWidget *blxWindow,
                                           const bool hide = false)
 {
   BlxContext *bc = blxWindowGetContext(blxWindow);
-  
+
   /* Create the new group */
   SequenceGroup *group = new SequenceGroup;
-  
+
   group->seqList = seqList;
   group->ownsSeqNames = ownSeqNames;
   group->hidden = hide;
   group->highlighted = highlight;
   group->isQuickGroup = isQuickGroup;
   group->isFilter = isFilter;
-  
+
   /* Find a unique ID */
   GList *lastItem = g_list_last(bc->sequenceGroups);
-  
+
   if (lastItem)
     {
       SequenceGroup *lastGroup = (SequenceGroup*)(lastItem->data);
@@ -2022,12 +2023,12 @@ static SequenceGroup* createSequenceGroup(GtkWidget *blxWindow,
         ss << "Filter";
       else
         ss << "Group";
-          
+
       ss << group->groupId;
-      
+
       group->groupName = g_strdup(ss.str().c_str());
     }
-  
+
   /* Set the order number. For simplicity, set the default order to be the same
    * as the ID number, so groups are sorted in the order they were added */
   group->order = group->groupId;
@@ -2040,7 +2041,7 @@ static SequenceGroup* createSequenceGroup(GtkWidget *blxWindow,
   /* Add it to the list, and update */
   bc->sequenceGroups = g_list_append(bc->sequenceGroups, group);
   blxWindowGroupsChanged(blxWindow);
-  
+
   return group;
 }
 
@@ -2052,9 +2053,9 @@ static gboolean onGroupNameChanged(GtkWidget *widget, const gint responseId, gpo
 
   GtkEntry *entry = GTK_ENTRY(widget);
   SequenceGroup *group = (SequenceGroup*)data;
-  
+
   const gchar *newName = gtk_entry_get_text(entry);
-  
+
   if (!newName || strlen(newName) < 1)
     {
       g_critical("Invalid group name '%s' entered; reverting to previous group name '%s'.", newName, group->groupName);
@@ -2063,12 +2064,12 @@ static gboolean onGroupNameChanged(GtkWidget *widget, const gint responseId, gpo
     }
   else
     {
-      if (group->groupName) 
+      if (group->groupName)
         g_free(group->groupName);
-      
+
       group->groupName = g_strdup(newName);
     }
-  
+
   return result;
 }
 
@@ -2078,12 +2079,12 @@ static gboolean onGroupNameChanged(GtkWidget *widget, const gint responseId, gpo
 static gboolean onGroupOrderChanged(GtkWidget *widget, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   GtkEntry *entry = GTK_ENTRY(widget);
   SequenceGroup *group = (SequenceGroup*)data;
-  
+
   const gchar *newOrder = gtk_entry_get_text(entry);
-  
+
   if (!newOrder || strlen(newOrder) < 1)
     {
       g_critical("Invalid order number '%s' entered; reverting to previous order number '%d'.", newOrder, group->order);
@@ -2095,13 +2096,13 @@ static gboolean onGroupOrderChanged(GtkWidget *widget, const gint responseId, gp
   else
     {
       group->order = convertStringToInt(newOrder);
-      
+
       GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(widget));
       GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
 
       blxWindowGroupsChanged(blxWindow);
     }
-  
+
   return result;
 }
 
@@ -2111,7 +2112,7 @@ static gboolean onGroupOrderChanged(GtkWidget *widget, const gint responseId, gp
 static gboolean onGroupFilterToggled(GtkWidget *button, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   SequenceGroup *group = (SequenceGroup*)data;
   group->isFilter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
 
@@ -2120,7 +2121,7 @@ static gboolean onGroupFilterToggled(GtkWidget *button, const gint responseId, g
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(dialog)));
 
   blxWindowGroupsChanged(blxWindow);
-  
+
   return result;
 }
 
@@ -2130,7 +2131,7 @@ static gboolean onGroupFilterToggled(GtkWidget *button, const gint responseId, g
 static gboolean onGroupHiddenToggled(GtkWidget *button, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   SequenceGroup *group = (SequenceGroup*)data;
   group->hidden = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
 
@@ -2139,7 +2140,7 @@ static gboolean onGroupHiddenToggled(GtkWidget *button, const gint responseId, g
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(dialog)));
 
   blxWindowGroupsChanged(blxWindow);
-  
+
   return result;
 }
 
@@ -2149,36 +2150,36 @@ static gboolean onGroupHiddenToggled(GtkWidget *button, const gint responseId, g
 static gboolean onGroupHighlightedToggled(GtkWidget *button, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   SequenceGroup *group = (SequenceGroup*)data;
   group->highlighted = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
-  
+
   /* Redraw the blixem window to immediately show the new status. The toplevel
    * parent of the button is the dialog, and the blixem window is the transient
    * parent of the dialog. */
   GtkWidget *dialog = gtk_widget_get_toplevel(button);
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(dialog)));
-  
+
   blxWindowRedrawAll(blxWindow);
-  
+
   return result;
 }
 
 
 /* Called when the user has changed the color of a group in the 'edit groups' dialog */
 static gboolean onGroupColorChanged(GtkWidget *button, const gint responseId, gpointer data)
-{  
+{
   gboolean result = TRUE;
-  
+
   SequenceGroup *group = (SequenceGroup*)data;
   gtk_color_button_get_color(GTK_COLOR_BUTTON(button), &group->highlightColor);
   gdk_colormap_alloc_color(gdk_colormap_get_system(), &group->highlightColor, TRUE, TRUE);
-  
+
   /* Redraw everything in the new colors */
   GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(button)));
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
   blxWindowRedrawAll(blxWindow);
-  
+
   return result;
 }
 
@@ -2193,13 +2194,13 @@ static void createEditGroupWidget(GtkWidget *blxWindow, SequenceGroup *group, Gt
   gtk_entry_set_text(GTK_ENTRY(nameWidget), group->groupName);
   gtk_entry_set_activates_default(GTK_ENTRY(nameWidget), TRUE);
   widgetSetCallbackData(nameWidget, onGroupNameChanged, group);
-      
+
   /* Add a check box for the 'isFilter' flag */
   GtkWidget *isFilterWidget = gtk_check_button_new();
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(isFilterWidget), group->isFilter);
   gtk_widget_set_tooltip_text(isFilterWidget, "If any Filter groups are set, Blixem will filter out features of the same type that are not in a Filter group");
   widgetSetCallbackData(isFilterWidget, onGroupFilterToggled, group);
-      
+
   /* Add a check box for the 'hidden' flag */
   GtkWidget *isHiddenWidget = gtk_check_button_new();
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(isHiddenWidget), group->hidden);
@@ -2211,14 +2212,14 @@ static void createEditGroupWidget(GtkWidget *blxWindow, SequenceGroup *group, Gt
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(isHighlightedWidget), group->highlighted);
   gtk_widget_set_tooltip_text(isHighlightedWidget, "Highlight features that are in this group (use the colour selector to set the highlight color)");
   widgetSetCallbackData(isHighlightedWidget, onGroupHighlightedToggled, group);
-      
+
   /* Show the group's order number in an editable text box */
   GtkWidget *orderWidget = gtk_entry_new();
 
   char *orderStr = convertIntToString(group->order);
   gtk_entry_set_text(GTK_ENTRY(orderWidget), orderStr);
   g_free(orderStr);
-      
+
   gtk_entry_set_activates_default(GTK_ENTRY(orderWidget), TRUE);
   gtk_widget_set_size_request(orderWidget, 30, -1);
   widgetSetCallbackData(orderWidget, onGroupOrderChanged, group);
@@ -2226,11 +2227,11 @@ static void createEditGroupWidget(GtkWidget *blxWindow, SequenceGroup *group, Gt
   /* Show the group's highlight color in a button that will also launch a color-picker */
   GtkWidget *colorButton = gtk_color_button_new_with_color(&group->highlightColor);
   widgetSetCallbackData(colorButton, onGroupColorChanged, group);
-      
+
   /* Create a button that will delete this group */
   GtkWidget *deleteButton = gtk_button_new_from_stock(GTK_STOCK_DELETE);
   g_signal_connect(G_OBJECT(deleteButton), "clicked", G_CALLBACK(onButtonClickedDeleteGroup), group);
-      
+
   /* Put everything in the table */
   gtk_table_attach(table, nameWidget,               1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_SHRINK, xpad, ypad);
   gtk_table_attach(table, isFilterWidget,           2, 3, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
@@ -2244,7 +2245,7 @@ static void createEditGroupWidget(GtkWidget *blxWindow, SequenceGroup *group, Gt
 
 /* Like blxSequenceGetColumn but also supports the group column (which
  * needs the context for its data) */
-static const char* blxSequenceGetColumnData(const BlxSequence* const blxSeq, 
+static const char* blxSequenceGetColumnData(const BlxSequence* const blxSeq,
                                             const BlxColumnId columnId,
                                             const BlxContext *bc)
 {
@@ -2261,10 +2262,10 @@ static const char* blxSequenceGetColumnData(const BlxSequence* const blxSeq,
     {
       result = blxSequenceGetColumn(blxSeq, columnId);
     }
-  
+
   return result;
 }
-          
+
 
 /* Called for an entry from a list of BlxSequences. Compares the relevant data
  * from the BlxSequence (as indicated by the searchCol member of the SeqSearchData
@@ -2274,16 +2275,16 @@ static void getSequencesThatMatch(gpointer listDataItem, gpointer data)
 {
   /* Get the BlxSequence for this list item */
   BlxSequence *seq = (BlxSequence*)listDataItem;
-  
+
   /* Get the search data */
   SeqSearchData *searchData = (SeqSearchData*)data;
-  
+
   if (searchData->error)
     return; /* already hit an error so don't try any more */
 
   /* Get the relevant data for the search column */
   const char *dataToCompare = blxSequenceGetColumnData(seq, searchData->searchCol, searchData->bc);
-  
+
   if (!dataToCompare)
     {
       if (searchData->error)
@@ -2292,10 +2293,10 @@ static void getSequencesThatMatch(gpointer listDataItem, gpointer data)
           reportAndClearIfError(&searchData->error, G_LOG_LEVEL_DEBUG);
           g_set_error(&searchData->error, BLX_ERROR, BLX_ERROR_INVALID_COLUMN, "Invalid search column.\n");
         }
-      
+
       return;
     }
-  
+
   /* Do the search */
   gboolean found = wildcardSearch(dataToCompare, searchData->searchStr);
 
@@ -2307,22 +2308,22 @@ static void getSequencesThatMatch(gpointer listDataItem, gpointer data)
         {
           char *seqName = g_strdup(dataToCompare);
           char *cutPoint = strchr(seqName, '.');
-          
+
           if (cutPoint)
             {
               *cutPoint = '\0';
               found = wildcardSearch(seqName, searchData->searchStr);
             }
-          
+
           g_free(seqName);
         }
     }
-  
+
   if (found)
     {
       /* Add this BlxSequence onto the result list. */
       searchData->matchList = g_list_prepend(searchData->matchList, seq);
-    }  
+    }
 }
 
 
@@ -2331,14 +2332,14 @@ static void getSequencesThatMatch(gpointer listDataItem, gpointer data)
 static gboolean onAddGroupFromSelection(GtkWidget *button, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
-    {  
+    {
       GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(button));
       GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
 
       BlxContext *blxContext = blxWindowGetContext(blxWindow);
-      
+
       if (g_list_length(blxContext->selectedSeqs) > 0)
         {
           GList *list = g_list_copy(blxContext->selectedSeqs); /* group takes ownership of this */
@@ -2350,7 +2351,7 @@ static gboolean onAddGroupFromSelection(GtkWidget *button, const gint responseId
           g_critical("Warning: cannot create group; no sequences are currently selected");
         }
     }
-  
+
   return result;
 }
 
@@ -2362,13 +2363,13 @@ static gboolean onAddGroupFromSelection(GtkWidget *button, const gint responseId
 static gboolean onAddGroupFromText(GtkWidget *button, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   /* Nothing to do if this radio button is not active */
   if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
     {
       return result;
     }
-  
+
   /* Get the dialog and main window */
   GtkWidget *dialog = gtk_widget_get_toplevel(button);
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(dialog)));
@@ -2380,7 +2381,7 @@ static gboolean onAddGroupFromText(GtkWidget *button, const gint responseId, gpo
    * us which column to search. */
   GtkComboBox *combo = widgetGetComboBox(dialog);
   BlxColumnId searchCol = getColumnFromComboBox(combo);
-  
+
   GError *error = NULL;
   GList *seqList = findSeqsFromColumn(blxWindow, inputText, searchCol, FALSE, FALSE, &error);
 
@@ -2397,7 +2398,7 @@ static gboolean onAddGroupFromText(GtkWidget *button, const gint responseId, gpo
 
       createSequenceGroup(blxWindow, seqList, FALSE, inputText);
     }
-  
+
   return result;
 }
 
@@ -2405,14 +2406,14 @@ static gboolean onAddGroupFromText(GtkWidget *button, const gint responseId, gpo
 /* Utility function to take a list of search strings (newline separated), and
  * return a list of BlxSequences whose column data matches one of those search
  * strings. */
-static GList* getSeqStructsFromSearchStringList(GList *searchStringList, 
-                                                GList *seqList, 
-                                                BlxContext *bc, 
+static GList* getSeqStructsFromSearchStringList(GList *searchStringList,
+                                                GList *seqList,
+                                                BlxContext *bc,
                                                 const BlxColumnId searchCol,
                                                 GError **error)
 {
   SeqSearchData searchData = {NULL, searchCol, bc, NULL, NULL};
-  
+
   /* Loop through all the names in the input list */
   GList *nameItem = searchStringList;
   for ( ; nameItem; nameItem = nameItem->next)
@@ -2421,14 +2422,14 @@ static GList* getSeqStructsFromSearchStringList(GList *searchStringList,
        * add it to the result list. */
       searchData.searchStr = (const char*)(nameItem->data);
       g_list_foreach(seqList, getSequencesThatMatch, &searchData);
-      
+
       if (searchData.error)
         break;
     }
 
   if (searchData.error)
     g_propagate_error(error, searchData.error);
-  
+
   return searchData.matchList;
 }
 
@@ -2451,31 +2452,31 @@ static GList* getSeqStructsFromText(GtkWidget *blxWindow, const char *inputText,
 
   if (tmpError)
     g_propagate_error(error, tmpError);
-  
+
   /* Must free the original name list and all its data. */
   freeStringList(&searchStringList, TRUE);
-  
+
   if (g_list_length(seqList) < 1)
     {
       g_list_free(seqList);
       seqList = NULL;
     }
-  
+
   return seqList;
 }
 
 
 /* Create a group/filter from features on the clipboard. Adds to an existing quick group/filter
  * if exists, otherwise creates one. */
-static void createGroupOrFilterFromClipboard(GtkClipboard *clipboard, 
-                                             const char *clipboardText, 
+static void createGroupOrFilterFromClipboard(GtkClipboard *clipboard,
+                                             const char *clipboardText,
                                              const bool isFilter,
                                              gpointer data)
 {
   /* Get the list of sequences to include */
   GtkWidget *blxWindow = GTK_WIDGET(data);
   GList *seqList = getSeqStructsFromText(blxWindow, clipboardText, BLXCOL_SEQNAME, NULL);
-  
+
   if (seqList)
     {
       /* See if there's already a quick group/filter */
@@ -2521,7 +2522,7 @@ void findSeqsFromClipboard(GtkClipboard *clipboard, const char *clipboardText, g
   /* Get the list of sequences to include */
   GtkWidget *blxWindow = GTK_WIDGET(data);
   GList *seqList = getSeqStructsFromText(blxWindow, clipboardText, BLXCOL_SEQNAME, NULL);
-  
+
   if (seqList)
     {
       blxWindowSetSelectedSeqList(blxWindow, seqList);
@@ -2537,7 +2538,7 @@ void findAndSelectSeqsFromClipboard(GtkClipboard *clipboard, const char *clipboa
   /* Get the list of sequences to include */
   GtkWidget *blxWindow = GTK_WIDGET(data);
   GList *seqList = getSeqStructsFromText(blxWindow, clipboardText, BLXCOL_SEQNAME, NULL);
-  
+
   if (seqList)
     {
       blxWindowSetSelectedSeqList(blxWindow, seqList);
@@ -2557,7 +2558,7 @@ static void hideSelectedSources(GtkWidget *blxWindow, const bool refresh = true)
   if (seqList)
     {
       createSequenceGroup(blxWindow, seqList, FALSE, "HideSource", false, false, false, true);
-  
+
       if (refresh)
         {
           blxWindowGroupsChanged(blxWindow);
@@ -2573,7 +2574,7 @@ static void clearGroups(GtkWidget *blxWindow, const bool refresh = true)
   BlxContext *blxContext = blxWindowGetContext(blxWindow);
 
   blxContext->disableAllGroups();
-  
+
   if (refresh)
     {
       blxWindowGroupsChanged(blxWindow);
@@ -2582,7 +2583,7 @@ static void clearGroups(GtkWidget *blxWindow, const bool refresh = true)
 }
 
 
-/* This function creates a group (or filter, if filter=true) from features 
+/* This function creates a group (or filter, if filter=true) from features
  * on the clipboard text (which should contain valid sequence name(s)). */
 static void createQuickGroup(GtkWidget *blxWindow, const bool isFilter, const bool clearPrevious)
 {
@@ -2590,7 +2591,7 @@ static void createQuickGroup(GtkWidget *blxWindow, const bool isFilter, const bo
 
   if (clearPrevious)
     blxContext->disableAllQuickGroups();
-  
+
   if (isFilter)
     requestPrimaryClipboardText(createFilterFromClipboard, blxWindow);
   else
@@ -2603,33 +2604,33 @@ static void createQuickGroup(GtkWidget *blxWindow, const bool isFilter, const bo
 static gboolean onAddGroupFromList(GtkWidget *button, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
     {
       return result;
     }
-  
+
   /* Get the dialog and main window */
   GtkWidget *dialog = gtk_widget_get_toplevel(button);
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(GTK_WINDOW(dialog)));
-  
+
   /* Find the combo box on the dialog (there should only be one), which tells
    * us which column to search. */
   GtkComboBox *combo = widgetGetComboBox(dialog);
   BlxColumnId searchCol = getColumnFromComboBox(combo);
-  
+
   /* The text entry box was passed as the user data. We should have a (multi-line) text view */
   const char *inputText = getStringFromTextView(GTK_TEXT_VIEW(data));
 
   GError *error = NULL;
   GList *seqList = findSeqsFromList(blxWindow, inputText, searchCol, FALSE, FALSE, &error);
-  
+
   if (error)
     {
       reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
       result = FALSE;
     }
-  
+
   if (seqList)
     {
       GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(button));
@@ -2637,7 +2638,7 @@ static gboolean onAddGroupFromList(GtkWidget *button, const gint responseId, gpo
 
       createSequenceGroup(blxWindow, seqList, FALSE, NULL);
     }
-  
+
   return result;
 }
 
@@ -2657,7 +2658,7 @@ static void onButtonClickedDeleteAllGroups(GtkWidget *button, gpointer data)
   if (response == GTK_RESPONSE_ACCEPT)
     {
       blxWindowDeleteAllSequenceGroups(blxWindow);
-      
+
       /* Close the dialog, because there are no groups left to display. */
       gtk_widget_hide_all(GTK_WIDGET(dialogWindow));
     }
@@ -2668,20 +2669,20 @@ static void onButtonClickedDeleteAllGroups(GtkWidget *button, gpointer data)
 static void onButtonClickedDeleteGroup(GtkWidget *button, gpointer data)
 {
   SequenceGroup *group = (SequenceGroup*)data;
-  
+
   GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(button));
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
-  
+
   /* Ask the user if they're sure */
   char formatStr[] = "Are you sure you wish to delete group '%s'?";
   char messageText[strlen(formatStr) + strlen(group->groupName)];
   sprintf(messageText, formatStr, group->groupName);
-  
+
   BlxContext *bc = blxWindowGetContext(blxWindow);
   char *title = g_strdup_printf("%sDelete group", blxGetTitlePrefix(bc));
   gint response = runConfirmationBox(blxWindow, title, messageText);
   g_free(title);
-  
+
   if (response == GTK_RESPONSE_ACCEPT)
     {
       blxWindowDeleteSequenceGroup(blxWindow, group);
@@ -2705,7 +2706,7 @@ static gboolean onSwitchPageGroupsDialog(GtkNotebook *notebook, GtkNotebookPage
       /* For other pages, set default response to be 'apply' */
       gtk_dialog_set_default_response(dialog, GTK_RESPONSE_APPLY);
     }
-    
+
   return FALSE;
 }
 
@@ -2715,14 +2716,14 @@ static gboolean onSwitchPageGroupsDialog(GtkNotebook *notebook, GtkNotebookPage
 static GtkNotebook* containerGetChildNotebook(GtkContainer *container)
 {
   GtkNotebook *result = NULL;
-  
+
   GList *children = gtk_container_get_children(container);
   GList *child = children;
-  
+
   for ( ; child; child = child->next)
     {
       GtkWidget *childWidget = GTK_WIDGET(child->data);
-      
+
       if (GTK_IS_NOTEBOOK(childWidget))
         {
           result = GTK_NOTEBOOK(childWidget);
@@ -2736,7 +2737,7 @@ static GtkNotebook* containerGetChildNotebook(GtkContainer *container)
     }
 
   g_list_free(children);
- 
+
   return result;
 }
 
@@ -2746,10 +2747,10 @@ void onResponseGroupsDialog(GtkDialog *dialog, gint responseId, gpointer data)
 {
   gboolean destroy = FALSE;
   gboolean refresh = FALSE;
-  
+
   /* If a notebook was passed, only call callbacks for widgets in the active tab */
   GtkNotebook *notebook = containerGetChildNotebook(GTK_CONTAINER(dialog->vbox));
-               
+
   if (!notebook)
     {
       g_warning("Expected Groups dialog to contain a notebook widget. Dialog may not refresh properly.\n");
@@ -2757,7 +2758,7 @@ void onResponseGroupsDialog(GtkDialog *dialog, gint responseId, gpointer data)
 
   guint pageNo = notebook ? gtk_notebook_get_current_page(notebook) : 0;
   GtkWidget *page = notebook ? gtk_notebook_get_nth_page(notebook, pageNo) : NULL;
-  
+
   switch (responseId)
   {
     case GTK_RESPONSE_ACCEPT:
@@ -2770,17 +2771,17 @@ void onResponseGroupsDialog(GtkDialog *dialog, gint responseId, gpointer data)
       destroy = FALSE;
       refresh = (pageNo == 0); /* if created a new group, Edit Groups section must be refreshed */
       break;
-      
+
     case GTK_RESPONSE_CANCEL:
     case GTK_RESPONSE_REJECT:
       destroy = TRUE;
       refresh = FALSE;
       break;
-      
+
     default:
       break;
   };
-  
+
   if (destroy)
     {
       /* Groups dialog is persistent, so hide it rather than destroying it */
@@ -2800,18 +2801,18 @@ static void createCreateGroupTab(GtkNotebook *notebook, BlxContext *bc, GtkWidge
   const int numRows = 3;
   const int numCols = 2;
   const gboolean seqsSelected = g_list_length(bc->selectedSeqs) > 0;
-  
+
   /* Put everything in a table */
   GtkTable *table = GTK_TABLE(gtk_table_new(numRows, numCols, FALSE));
 
   /* Append the table as a new tab to the notebook */
   gtk_notebook_append_page(notebook, GTK_WIDGET(table), gtk_label_new("Create group"));
-  
+
   /* Create the left-hand-side column */
   GtkRadioButton *button1 = createRadioButton(table, 1, 1, NULL, "_Text search (wildcards * and ?)", !seqsSelected, TRUE, FALSE, onAddGroupFromText, blxWindow, NULL);
   createRadioButton(table, 1, 2, button1, "_List search", FALSE, TRUE, TRUE, onAddGroupFromList, blxWindow, NULL);
   createSearchColumnCombo(table, 1, 3, blxWindow);
-  
+
   /* Create the right-hand-side column */
   createRadioButton(table, 2, 1, button1, "Use current _selection", seqsSelected, FALSE, FALSE, onAddGroupFromSelection, blxWindow, NULL);
 }
@@ -2826,16 +2827,16 @@ static void createEditGroupsTab(GtkNotebook *notebook, BlxContext *bc, GtkWidget
   const int xpad = DEFAULT_TABLE_XPAD;
   const int ypad = DEFAULT_TABLE_YPAD;
   int row = 1;
-  
+
   /* Put everything in a table inside a scrolled window */
   GtkTable *table = GTK_TABLE(gtk_table_new(numRows, numCols, FALSE));
   GtkWidget *scrollWin = gtk_scrolled_window_new(NULL, NULL);
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollWin), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
   gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollWin), GTK_WIDGET(table));
-  
+
   /* Append the table as a new tab to the notebook */
   gtk_notebook_append_page(GTK_NOTEBOOK(notebook), GTK_WIDGET(scrollWin), gtk_label_new("Edit groups"));
-  
+
   /* Add labels for each column in the table */
   gtk_table_attach(table, gtk_label_new("Group name"),    1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_SHRINK, xpad, ypad);
   gtk_table_attach(table, gtk_label_new("Filter"),        2, 3, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
@@ -2843,7 +2844,7 @@ static void createEditGroupsTab(GtkNotebook *notebook, BlxContext *bc, GtkWidget
   gtk_table_attach(table, gtk_label_new("Highlight"),     4, 5, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
   gtk_table_attach(table, gtk_label_new("Order"),         5, 6, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
   ++row;
-  
+
   /* Add a set of widgets for each group */
   GList *groupItem = blxWindowGetSequenceGroups(blxWindow);
   for ( ; groupItem; groupItem = groupItem->next)
@@ -2852,7 +2853,7 @@ static void createEditGroupsTab(GtkNotebook *notebook, BlxContext *bc, GtkWidget
       createEditGroupWidget(blxWindow, group, table, row, xpad, ypad);
       ++row;
     }
-  
+
   /* Add a button to delete all groups */
   GtkWidget *deleteGroupsButton = gtk_button_new_with_label("Delete all groups");
   gtk_button_set_image(GTK_BUTTON(deleteGroupsButton), gtk_image_new_from_stock(GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON));
@@ -2871,13 +2872,13 @@ void showGroupsDialog(GtkWidget *blxWindow, const gboolean editGroups, const gbo
   BlxContext *bc = blxWindowGetContext(blxWindow);
   const BlxDialogId dialogId = BLXDIALOG_GROUPS;
   GtkWidget *dialog = getPersistentDialog(bc->dialogList, dialogId);
-  
+
   if (!dialog)
     {
       char *title = g_strdup_printf("%sGroups", blxGetTitlePrefix(bc));
 
       dialog = gtk_dialog_new_with_buttons(title,
-                                           GTK_WINDOW(blxWindow), 
+                                           GTK_WINDOW(blxWindow),
                                            GTK_DIALOG_DESTROY_WITH_PARENT,
                                            GTK_STOCK_CANCEL,
                                            GTK_RESPONSE_REJECT,
@@ -2888,11 +2889,11 @@ void showGroupsDialog(GtkWidget *blxWindow, const gboolean editGroups, const gbo
                                            NULL);
 
       g_free(title);
-      
+
       /* These calls are required to make the dialog persistent... */
       addPersistentDialog(bc->dialogList, dialogId, dialog);
       g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-      
+
       /* Make sure we only connect the response event once */
       g_signal_connect(dialog, "response", G_CALLBACK(onResponseGroupsDialog), blxWindow);
     }
@@ -2901,7 +2902,7 @@ void showGroupsDialog(GtkWidget *blxWindow, const gboolean editGroups, const gbo
       /* Refresh by deleting the dialog contents and re-creating them. */
       dialogClearContentArea(GTK_DIALOG(dialog));
     }
-  
+
   /* Create tabbed pages */
   GtkWidget *notebook = gtk_notebook_new();
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook, TRUE, TRUE, 0);
@@ -2909,11 +2910,11 @@ void showGroupsDialog(GtkWidget *blxWindow, const gboolean editGroups, const gbo
   createCreateGroupTab(GTK_NOTEBOOK(notebook), bc, blxWindow);
   createEditGroupsTab(GTK_NOTEBOOK(notebook), bc, blxWindow);
 
-  
+
   /* Connect signals and show */
   gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(blxWindow));
   g_signal_connect(notebook, "switch-page", G_CALLBACK(onSwitchPageGroupsDialog), dialog);
-  
+
   int width = 450, height = 300;
   int maxwidth = width, maxheight = height;
   gbtools::GUIGetTrueMonitorSizeFraction(dialog, 0.33, 0.33, &maxwidth, &maxheight);
@@ -2929,7 +2930,7 @@ void showGroupsDialog(GtkWidget *blxWindow, const gboolean editGroups, const gbo
     {
       gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0); /* 'create' page is the 1st page */
     }
-  
+
   if (bringToFront)
     {
       /* If user has asked to edit groups (and some groups exist), make the second tab
@@ -2950,14 +2951,14 @@ void showGroupsDialog(GtkWidget *blxWindow, const gboolean editGroups, const gbo
 static GtkWidget* dialogChildGetBlxWindow(GtkWidget *child)
 {
   GtkWidget *result = NULL;
-  
+
   GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(child));
-  
+
   if (dialogWindow)
     {
       result = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
     }
-  
+
   return result;
 }
 
@@ -2968,24 +2969,24 @@ static gboolean setFlagFromButton(GtkWidget *button, gpointer data)
 {
   GtkWidget *blxWindow = dialogChildGetBlxWindow(button);
   BlxContext *bc = blxWindowGetContext(blxWindow);
-  
+
   BlxFlag flag = (BlxFlag)GPOINTER_TO_INT(data);
   const gboolean newValue = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
 
   if (flag > BLXFLAG_MIN && flag < BLXFLAG_NUM_FLAGS)
     bc->flags[flag] = newValue;
-  
+
   return newValue;
 }
 
 
 /* This callback is called when one of the boolean flags is toggled on the settings dialog.
- * This generic function sets the flag and redraws everything; if different 
+ * This generic function sets the flag and redraws everything; if different
  * updates are required a custom callback function can be used instead. */
 static void onToggleFlag(GtkWidget *button, gpointer data)
 {
   setFlagFromButton(button, data);
-  
+
   GtkWidget *blxWindow = dialogChildGetBlxWindow(button);
   blxWindowRedrawAll(blxWindow);
 }
@@ -2998,7 +2999,7 @@ static void onSquashMatches(GtkWidget *button, gpointer data)
 
   GtkWidget *blxWindow = dialogChildGetBlxWindow(button);
   BlxWindowProperties *properties = blxWindowGetProperties(blxWindow);
-  
+
   setToggleMenuStatus(properties->actionGroup, "SquashMatches", squash);
 }
 
@@ -3007,33 +3008,33 @@ static void onSquashMatches(GtkWidget *button, gpointer data)
 static void onShowVariationTrackToggled(GtkWidget *button, gpointer data)
 {
   const gboolean showSnpTrack = setFlagFromButton(button, data);
-  
+
   GtkWidget *blxWindow = dialogChildGetBlxWindow(button);
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
-  
+
   detailViewUpdateShowSnpTrack(detailView, showSnpTrack);
 }
 
 
 /* Utility to create a check button with certain given properties, and to pack it into the parent.
  * Returns the new button. */
-static GtkWidget* createCheckButton(GtkBox *box, 
-                                    const char *mnemonic, 
+static GtkWidget* createCheckButton(GtkBox *box,
+                                    const char *mnemonic,
                                     const char *tooltip,
-                                    const gboolean isActive, 
-                                    GCallback callback, 
+                                    const gboolean isActive,
+                                    GCallback callback,
                                     gpointer data)
 {
   GtkWidget *button = gtk_check_button_new_with_mnemonic(mnemonic);
   gtk_box_pack_start(box, button, FALSE, FALSE, 0);
-  
+
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), isActive);
-  
+
   g_signal_connect(G_OBJECT(button), "toggled", callback, data);
 
   if (tooltip)
     gtk_widget_set_tooltip_text(button, tooltip);
-  
+
   return button;
 }
 
@@ -3042,13 +3043,13 @@ static GtkWidget* createCheckButton(GtkBox *box,
 static gboolean onColumnSizeChanged(GtkWidget *widget, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   GtkEntry *entry = GTK_ENTRY(widget);
   BlxColumnInfo *columnInfo = (BlxColumnInfo*)data;
-  
+
   const gchar *newSizeText = gtk_entry_get_text(entry);
   const int newWidth = convertStringToInt(newSizeText);
-  
+
   if (newWidth != columnInfo->width)
     {
       /* Check it's a sensible value. We could do with a better check really but
@@ -3056,7 +3057,7 @@ static gboolean onColumnSizeChanged(GtkWidget *widget, const gint responseId, gp
        * catches excessively large values, which can cause Blixem to crash. Slightly
        * too-large values may make things look odd but should be recoverable. */
       GtkWidget *blxWindow = dialogChildGetBlxWindow(widget);
-      
+
       int maxWidth = 300;
       gbtools::GUIGetTrueMonitorSize(blxWindow, &maxWidth, NULL);
 
@@ -3072,7 +3073,7 @@ static gboolean onColumnSizeChanged(GtkWidget *widget, const gint responseId, gp
           updateDynamicColumnWidths(detailView);
         }
     }
-  
+
   return result;
 }
 
@@ -3081,15 +3082,15 @@ static gboolean onColumnSizeChanged(GtkWidget *widget, const gint responseId, gp
 static gboolean onColumnVisibilityChanged(GtkWidget *button, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   BlxColumnInfo *columnInfo = (BlxColumnInfo*)data;
   columnInfo->showColumn = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
-  
+
   GtkWidget *blxWindow = dialogChildGetBlxWindow(button);
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
 
   updateDynamicColumnWidths(detailView);
-  
+
   return result;
 }
 
@@ -3098,17 +3099,17 @@ static gboolean onColumnVisibilityChanged(GtkWidget *button, const gint response
 static gboolean onSummaryColumnsChanged(GtkWidget *button, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   BlxColumnInfo *columnInfo = (BlxColumnInfo*)data;
   columnInfo->showSummary = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
-  
+
   GtkWidget *blxWindow = dialogChildGetBlxWindow(button);
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
 
   /* Just clear the moused-over feedback area to make sure it's not showing invalid data. The
    * user can mouse-over again to see the new data. */
   clearFeedbackArea(detailView);
-  
+
   return result;
 }
 
@@ -3129,7 +3130,7 @@ static void onButtonClickedLoadOptional(GtkWidget *button, gpointer data)
 
   /* Create a temporary lookup table for BlxSequences so we can link them on GFF ID */
   GHashTable *lookupTable = g_hash_table_new(g_direct_hash, g_direct_equal);
-  
+
   GError *error = NULL;
   BulkFetch bulk_fetch(bc->external, bc->flags[BLXFLAG_SAVE_TEMP_FILES],
                        bc->seqType, &bc->matchSeqs, bc->columnList, bc->optionalFetchDefault, bc->fetchMethods, &bc->mspList,
@@ -3140,7 +3141,7 @@ static void onButtonClickedLoadOptional(GtkWidget *button, gpointer data)
                        bc->cainfo,
 #endif
                        bc->fetch_debug);
-  
+
   gboolean success = bulk_fetch.performFetch();
 
   finaliseFetch(bc->matchSeqs, bc->columnList);
@@ -3150,30 +3151,30 @@ static void onButtonClickedLoadOptional(GtkWidget *button, gpointer data)
       prefixError(error, "Error loading optional data. ");
       reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
     }
-  
+
   if (success)
     {
       /* Set the flag to say that the data has now been loaded */
       bc->flags[BLXFLAG_OPTIONAL_COLUMNS] = TRUE;
-      
+
       /* Disable the button so user can't try to load data again. */
       gtk_widget_set_sensitive(button, FALSE);
-      
+
       /* Enable the text entry boxes for all columns. They are all in the container passed
        * as the user data. */
       GtkContainer *container = GTK_CONTAINER(data);
       gtk_container_foreach(container, widgetSetSensitive, GINT_TO_POINTER(TRUE));
-      
+
       /* Update the flag in all columns to indicate that the data is now loaded */
       GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
       GList *listItem = detailViewGetColumnList(detailView);
-      
+
       for ( ; listItem; listItem = listItem->next)
         {
           BlxColumnInfo *columnInfo = (BlxColumnInfo*)(listItem->data);
           columnInfo->dataLoaded = TRUE;
-        }   
-      
+        }
+
       /* Re-sort the trees, because the new data may affect the sort order. Also
        * resize them, because whether data is loaded affects whether columns are shown. */
       detailViewResortTrees(detailView);
@@ -3185,7 +3186,7 @@ static void onButtonClickedLoadOptional(GtkWidget *button, gpointer data)
       callFuncOnAllDetailViewTrees(detailView, resizeTreeColumns, NULL);
       resizeDetailViewHeaders(detailView);
       updateDetailViewRange(detailView);
-      
+
       detailViewRedrawAll(detailView);
     }
 
@@ -3194,7 +3195,7 @@ static void onButtonClickedLoadOptional(GtkWidget *button, gpointer data)
 
 
 /* Create a button to allow the user to load the data for optional columns, if not already loaded */
-static GtkWidget* createColumnLoadDataButton(GtkTable *table, 
+static GtkWidget* createColumnLoadDataButton(GtkTable *table,
                                              GtkWidget *detailView,
                                              int *row,
                                              const int cols,
@@ -3210,7 +3211,7 @@ static GtkWidget* createColumnLoadDataButton(GtkTable *table,
 
   /* Add the button to the table, spanning all of the remaining columns */
   gtk_table_attach(table, button, 0, 1, *row, *row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
-  
+
   /* Create an explanatory label spanning the rest of the columns */
   GtkWidget *label = gtk_label_new("Fetches additional information e.g. from an\nEMBL file (as determined by the config).");
   gtk_table_attach(table, label, 1, cols, *row, *row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
@@ -3227,7 +3228,7 @@ static void createColumnButton(BlxColumnInfo *columnInfo, GtkTable *table, int *
   /* Create a label showing the column name */
   GtkWidget *label = gtk_label_new(columnInfo->title);
   gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
-  
+
   /* Tick-box controlling whether column is displayed */
   GtkWidget *showColButton = gtk_check_button_new();
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(showColButton), columnInfo->showColumn);
@@ -3239,10 +3240,10 @@ static void createColumnButton(BlxColumnInfo *columnInfo, GtkTable *table, int *
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(showSummaryButton), columnInfo->showSummary);
   widgetSetCallbackData(showSummaryButton, onSummaryColumnsChanged, (gpointer)columnInfo);
   gtk_widget_set_tooltip_text(showSummaryButton, "Whether to include this data in the moused-over-item feedback area");
-  
+
   GtkWidget *entry = gtk_entry_new();
   gtk_widget_set_tooltip_text(label, "The column width, in pixels");
-  
+
   if (columnInfo->columnId == BLXCOL_SEQUENCE)
     {
       /* The sequence column updates dynamically, so don't allow the user to edit it */
@@ -3264,20 +3265,20 @@ static void createColumnButton(BlxColumnInfo *columnInfo, GtkTable *table, int *
         }
       else if (!columnInfo->canShowSummary)
         {
-          gtk_widget_set_sensitive(showSummaryButton, FALSE);          
+          gtk_widget_set_sensitive(showSummaryButton, FALSE);
         }
 
       char *displayText = convertIntToString(columnInfo->width);
       gtk_entry_set_text(GTK_ENTRY(entry), displayText);
-      
+
       gtk_entry_set_width_chars(GTK_ENTRY(entry), strlen(displayText) + 2);
       gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-      
+
       widgetSetCallbackData(entry, onColumnSizeChanged, (gpointer)columnInfo);
-      
+
       g_free(displayText);
     }
-  
+
   gtk_table_attach(table, label,             0, 1, *row, *row + 1, GTK_FILL, GTK_SHRINK, 4, 4);
   gtk_table_attach(table, showColButton,     1, 2, *row, *row + 1, GTK_FILL, GTK_SHRINK, 4, 4);
   gtk_table_attach(table, showSummaryButton, 2, 3, *row, *row + 1, GTK_FILL, GTK_SHRINK, 4, 4);
@@ -3314,20 +3315,20 @@ static void createColumnButtons(GtkWidget *parent, GtkWidget *detailView, const
    * scrolled window, because there are likely to be many rows */
   GtkWidget *scrollWin = gtk_scrolled_window_new(NULL, NULL);
   gtk_container_add(GTK_CONTAINER(parent), scrollWin);
-  
+
   GList *columnList = detailViewGetColumnList(detailView);
   const int rows = g_list_length(columnList) + 1;
   const int cols = 4;
   int row = 1;
 
-  GtkTable *table = GTK_TABLE(gtk_table_new(rows, cols, FALSE));  
+  GtkTable *table = GTK_TABLE(gtk_table_new(rows, cols, FALSE));
 
   gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollWin), GTK_WIDGET(table));
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollWin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
   /* Create a button to allow the user to load the full EMBL data, if not already loaded */
   GtkWidget *button = createColumnLoadDataButton(table, detailView, &row, cols, border, border);
-  
+
   /* Loop through each column and create widgets to control the properties */
   createColumnButtonHeaders(table, &row);
 
@@ -3337,7 +3338,7 @@ static void createColumnButtons(GtkWidget *parent, GtkWidget *detailView, const
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)(listItem->data);
       createColumnButton(columnInfo, table, &row);
     }
-  
+
   g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(onButtonClickedLoadOptional), table);
 }
 
@@ -3345,17 +3346,17 @@ static void createColumnButtons(GtkWidget *parent, GtkWidget *detailView, const
 /* Callback to be called when the user has entered a new percent-ID per cell */
 static gboolean onIdPerCellChanged(GtkWidget *widget, const gint responseId, gpointer data)
 {
-  GtkWidget *bigPicture = GTK_WIDGET(data);  
+  GtkWidget *bigPicture = GTK_WIDGET(data);
   const char *text = gtk_entry_get_text(GTK_ENTRY(widget));
   const gdouble newValue = g_strtod(text, NULL);
   return bigPictureSetIdPerCell(bigPicture, newValue);
 }
 
- 
+
 /* Callback to be called when the user has entered a new maximum percent-ID to display */
 static gboolean onMaxPercentIdChanged(GtkWidget *widget, const gint responseId, gpointer data)
 {
-  GtkWidget *bigPicture = GTK_WIDGET(data);  
+  GtkWidget *bigPicture = GTK_WIDGET(data);
   const char *text = gtk_entry_get_text(GTK_ENTRY(widget));
   const gdouble newValue = g_strtod(text, NULL);
   return bigPictureSetMaxPercentId(bigPicture, newValue);
@@ -3364,7 +3365,7 @@ static gboolean onMaxPercentIdChanged(GtkWidget *widget, const gint responseId,
 /* Callback to be called when the user has entered a new minimum percent-ID to display */
 static gboolean onMinPercentIdChanged(GtkWidget *widget, const gint responseId, gpointer data)
 {
-  GtkWidget *bigPicture = GTK_WIDGET(data);  
+  GtkWidget *bigPicture = GTK_WIDGET(data);
   const char *text = gtk_entry_get_text(GTK_ENTRY(widget));
   const gdouble newValue = g_strtod(text, NULL);
   return bigPictureSetMinPercentId(bigPicture, newValue);
@@ -3374,7 +3375,7 @@ static gboolean onMinPercentIdChanged(GtkWidget *widget, const gint responseId,
 /* Callback to be called when the user has changed the depth-per-cell on the coverage view */
 static gboolean onDepthPerCellChanged(GtkWidget *widget, const gint responseId, gpointer data)
 {
-  CoverageViewProperties *coverageViewP = (CoverageViewProperties*)data;  
+  CoverageViewProperties *coverageViewP = (CoverageViewProperties*)data;
   const char *text = gtk_entry_get_text(GTK_ENTRY(widget));
   const gdouble newValue = g_strtod(text, NULL);
   return coverageViewP->setDepthPerCell(newValue);
@@ -3382,12 +3383,12 @@ static gboolean onDepthPerCellChanged(GtkWidget *widget, const gint responseId,
 
 
 ///* Utility to create a text entry widget displaying the given integer value. The
-// * given callback will be called when the user OK's the dialog that this widget 
+// * given callback will be called when the user OK's the dialog that this widget
 // * is a child of. */
-//static void createTextEntryFromInt(GtkWidget *parent, 
-//                                 const char *title, 
-//                                 const int value, 
-//                                 BlxResponseCallback callbackFunc, 
+//static void createTextEntryFromInt(GtkWidget *parent,
+//                                 const char *title,
+//                                 const int value,
+//                                 BlxResponseCallback callbackFunc,
 //                                 gpointer callbackData)
 //{
 //  /* Pack label and text entry into a vbox */
@@ -3406,37 +3407,37 @@ static gboolean onDepthPerCellChanged(GtkWidget *widget, const gint responseId,
 //  gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
 //
 //  widgetSetCallbackData(entry, callbackFunc, callbackData);
-//  
+//
 //  g_free(displayText);
 //}
 
 
 /* Utility to create a text entry widget displaying the given double value. The
- * given callback will be called when the user OK's the dialog that this widget 
+ * given callback will be called when the user OK's the dialog that this widget
  * is a child of. */
-static void createTextEntry(GtkWidget *parent, 
-                            const char *title, 
-                            const gdouble value, 
-                            BlxResponseCallback callbackFunc, 
+static void createTextEntry(GtkWidget *parent,
+                            const char *title,
+                            const gdouble value,
+                            BlxResponseCallback callbackFunc,
                             gpointer callbackData)
 {
   /* Pack label and text entry into a vbox */
   GtkWidget *vbox = createVBoxWithBorder(parent, 4, FALSE, NULL);
-  
+
   GtkWidget *label = gtk_label_new(title);
   gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
-  
+
   GtkWidget *entry = gtk_entry_new();
   gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
-  
+
   char *displayText = convertDoubleToString(value, 1);
   gtk_entry_set_text(GTK_ENTRY(entry), displayText);
-  
+
   gtk_entry_set_width_chars(GTK_ENTRY(entry), strlen(displayText) + 2);
   gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-  
+
   widgetSetCallbackData(entry, callbackFunc, callbackData);
-  
+
   g_free(displayText);
 }
 
@@ -3451,7 +3452,7 @@ static void createGridSettingsButtons(GtkWidget *parent, GtkWidget *bigPicture)
   /* Arrange the widgets horizontally */
   GtkWidget *hbox = createHBoxWithBorder(frame, 12, FALSE, NULL);
   const DoubleRange* const percentIdRange = bigPictureGetPercentIdRange(bigPicture);
-  
+
   createTextEntry(hbox, "%ID per cell", bigPictureGetIdPerCell(bigPicture), onIdPerCellChanged, bigPicture);
   createTextEntry(hbox, "Max %ID", percentIdRange->max, onMaxPercentIdChanged, bigPicture);
   createTextEntry(hbox, "Min %ID", percentIdRange->min, onMinPercentIdChanged, bigPicture);
@@ -3463,19 +3464,19 @@ static void createCoverageSettingsButtons(GtkWidget *parent, GtkWidget *bigPictu
 {
   BigPictureProperties *bpProperties = bigPictureGetProperties(bigPicture);
   DetailViewProperties *dvProperties = detailViewGetProperties(detailView);
-  
+
   /* Group these buttons in a frame */
   GtkWidget *frame = gtk_frame_new("Coverage section");
   gtk_box_pack_start(GTK_BOX(parent), frame, FALSE, FALSE, 0);
-  
+
   /* Arrange the widgets horizontally */
   GtkWidget *hbox = createHBoxWithBorder(frame, 12, FALSE, NULL);
-  
-  createTextEntry(hbox, "Depth per cell (big picture)", 
+
+  createTextEntry(hbox, "Depth per cell (big picture)",
                   bpProperties->coverageViewProperties()->depthPerCell(),
                   onDepthPerCellChanged, bpProperties->coverageViewProperties());
 
-  createTextEntry(hbox, "Depth per cell (detail view)", 
+  createTextEntry(hbox, "Depth per cell (detail view)",
                   dvProperties->coverageViewProperties()->depthPerCell(),
                   onDepthPerCellChanged, dvProperties->coverageViewProperties());
 }
@@ -3485,16 +3486,16 @@ static void createCoverageSettingsButtons(GtkWidget *parent, GtkWidget *bigPictu
 static gboolean onChangeBlxColor(GtkWidget *button, const gint responseId, gpointer data)
 {
   GdkColor *color = (GdkColor*)data;
-  
+
   /* update the color */
   gtk_color_button_get_color(GTK_COLOR_BUTTON(button), color);
   gdk_colormap_alloc_color(gdk_colormap_get_system(), color, TRUE, TRUE);
-  
+
   /* Redraw */
   GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(button));
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
   blxWindowRedrawAll(blxWindow);
-  
+
   return TRUE;
 }
 
@@ -3503,16 +3504,16 @@ static gboolean onChangeBlxColor(GtkWidget *button, const gint responseId, gpoin
 static gboolean onChangeBackgroundColor(GtkWidget *button, const gint responseId, gpointer data)
 {
   GdkColor *color = (GdkColor*)data;
-  
+
   /* update the color */
   gtk_color_button_get_color(GTK_COLOR_BUTTON(button), color);
   gdk_colormap_alloc_color(gdk_colormap_get_system(), color, TRUE, TRUE);
-  
+
   /* Update */
   GtkWindow *dialogWindow = GTK_WINDOW(gtk_widget_get_toplevel(button));
   GtkWidget *blxWindow = GTK_WIDGET(gtk_window_get_transient_for(dialogWindow));
   onUpdateBackgroundColor(blxWindow);
-  
+
   return TRUE;
 }
 
@@ -3532,12 +3533,12 @@ static void createColorButton(GtkTable *table, GdkColor *color, BlxResponseCallb
 static void createColorButtons(GtkWidget *parent, GtkWidget *blxWindow, const int borderWidth)
 {
   BlxContext *bc = blxWindowGetContext(blxWindow);
-  
+
   /* put all the colors in a table. Put the table in a scrolled window, because
    * there are likely to be many rows */
   GtkWidget *scrollWin = gtk_scrolled_window_new(NULL, NULL);
   gtk_container_add(GTK_CONTAINER(parent), scrollWin);
-  
+
   const int numCols = 5;
   const int numRows = BLXCOL_NUM_COLORS + 1; /* add one for header row */
   const int xpad = 2;
@@ -3553,21 +3554,21 @@ static void createColorButtons(GtkWidget *parent, GtkWidget *blxWindow, const in
   gtk_table_attach(table, gtk_label_new("(selected)   "), 3, 4, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
   gtk_table_attach(table, gtk_label_new("Print   "), 4, 5, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
   gtk_table_attach(table, gtk_label_new("(selected)   "), 5, 6, row, row + 1, GTK_SHRINK, GTK_SHRINK, xpad, ypad);
-  
+
   /* loop through all defined blixem colours */
   int colorId = BLXCOLOR_MIN + 1;
-  
+
   for ( ; colorId < BLXCOL_NUM_COLORS; ++colorId)
     {
       ++row;
-    
+
       BlxColor *blxCol = getBlxColor(bc->defaultColors, colorId);
       GtkWidget *label = gtk_label_new(blxCol->name);
       gtk_table_attach(table, label, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_SHRINK, xpad, ypad);
 
       /* Special callback for the background color */
       BlxResponseCallback callbackFunc = (colorId == BLXCOLOR_BACKGROUND) ? onChangeBackgroundColor : onChangeBlxColor;
-      
+
       createColorButton(table, &blxCol->normal, callbackFunc, &blxCol->normal, row, 2, xpad, ypad);
       createColorButton(table, &blxCol->print, callbackFunc, &blxCol->print, row, 4, xpad, ypad);
       createColorButton(table, &blxCol->selected, callbackFunc, &blxCol->selected, row, 3, xpad, ypad);
@@ -3593,17 +3594,17 @@ static void onParentBtnToggled(GtkWidget *button, gpointer data)
   const gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
   GtkWidget *subComponents = GTK_WIDGET(data);
 
-  gtk_widget_set_sensitive(subComponents, active); 
+  gtk_widget_set_sensitive(subComponents, active);
 }
 
 
 /* Callback function called when the 'Show unaligned bases' or 'Show polyA tails'
- * buttons are toggled. These are parent buttons so will cause child buttons 
+ * buttons are toggled. These are parent buttons so will cause child buttons
  * to be enabled/disabled. */
 static void onShowAdditionalSeqToggled(GtkWidget *button, gpointer data)
 {
   onParentBtnToggled(button, data);
-  
+
   /* Perform any required updates */
   GtkWidget *blxWindow = dialogChildGetBlxWindow(button);
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
@@ -3619,12 +3620,12 @@ static void onLimitUnalignedBasesToggled(GtkWidget *button, gpointer data)
 
   /* Enable/disable the sub-options. Their widgets are all in the container passed as the data. */
   GtkWidget *subComponents = GTK_WIDGET(data);
-  gtk_widget_set_sensitive(subComponents, limitUnalignedBases); 
-  
+  gtk_widget_set_sensitive(subComponents, limitUnalignedBases);
+
   /* Get the detail view from the main window */
   GtkWidget *blxWindow = dialogChildGetBlxWindow(button);
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
-  
+
   /* Perform any required updates */
   detailViewUpdateMspLengths(detailView, detailViewGetNumUnalignedBases(detailView));
 }
@@ -3636,7 +3637,7 @@ static gboolean onSetNumUnalignedBases(GtkWidget *entry, const gint responseId,
 {
   const char *numStr = gtk_entry_get_text(GTK_ENTRY(entry));
   int numBases = convertStringToInt(numStr);
-  
+
   GtkWidget *detailView = GTK_WIDGET(data);
   detailViewSetNumUnalignedBases(detailView, numBases);
 
@@ -3653,7 +3654,7 @@ static void onToggleShowUnalignedSelected(GtkWidget *button, gpointer data)
 {
   /* Get the new value */
   setFlagFromButton(button, GINT_TO_POINTER(BLXFLAG_SHOW_UNALIGNED_SELECTED));
- 
+
   /* Perform any required updates */
   GtkWidget *detailView = GTK_WIDGET(data);
 //  detailViewUpdateMspLengths(detailView, detailViewGetNumUnalignedBases(detailView));
@@ -3670,24 +3671,24 @@ static void createLimitUnalignedBasesButton(GtkContainer *parent, GtkWidget *det
    * entry and some labels. Pack the hbox into the given parent. */
   GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
   gtk_container_add(parent, hbox);
-  
+
   /* Create a text entry box so the user can enter the number of bases */
   GtkWidget *entry = gtk_entry_new();
   gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
   widgetSetCallbackData(entry, onSetNumUnalignedBases, detailView);
-  
+
   DetailViewProperties *properties = detailViewGetProperties(detailView);
   char *numStr = convertIntToString(properties->numUnalignedBases);
-  
+
   gtk_entry_set_text(GTK_ENTRY(entry), numStr);
   gtk_entry_set_width_chars(GTK_ENTRY(entry), strlen(numStr) + 2); /* fudge up width a bit in case user enters longer text */
   g_free(numStr);
-  
+
   /* Check button to enable/disable setting the limit */
   GtkWidget *button = gtk_check_button_new_with_mnemonic("Li_mit to ");
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), bc->flags[BLXFLAG_LIMIT_UNALIGNED_BASES]);
   g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(onLimitUnalignedBasesToggled), entry);
-  
+
   GtkWidget *label = gtk_label_new(" additional bases");
 
   /* Pack it all in the hbox */
@@ -3702,10 +3703,10 @@ static void createLimitUnalignedBasesButton(GtkContainer *parent, GtkWidget *det
 }
 
 
-/* Create a "parent" option button that has a vbox container for "sub-components", i.e. more 
+/* Create a "parent" option button that has a vbox container for "sub-components", i.e. more
  * option buttons (or other dialog widgets) that will be enabled only when the parent option is
  * active. Returns the container for the sub-options, which should be packed with the sub-option widgets. */
-static GtkContainer* createParentCheckButton(GtkWidget *parent, 
+static GtkContainer* createParentCheckButton(GtkWidget *parent,
                                              GtkWidget *detailView,
                                              BlxContext *bc,
                                              const char *label,
@@ -3723,8 +3724,8 @@ static GtkContainer* createParentCheckButton(GtkWidget *parent,
    * components are only active if the main check button is active. */
   const gboolean active = bc->flags[flag];
   GtkWidget *subContainer = gtk_vbox_new(FALSE, 0);
-  gtk_widget_set_sensitive(subContainer, active); 
-  
+  gtk_widget_set_sensitive(subContainer, active);
+
   /* Main check button to enable/disable the option. This call puts it in the vbox. Set two callbacks:
    * one to update the flag, and one to enable/disable the child buttons. */
   GtkWidget *btn = gtk_check_button_new_with_mnemonic(label);
@@ -3736,21 +3737,21 @@ static GtkContainer* createParentCheckButton(GtkWidget *parent,
 
   /* Connect the toggleFlag callback first so that the flag is set correctly before the callbackFunc is called */
   g_signal_connect(G_OBJECT(btn), "toggled", G_CALLBACK(onToggleFlag), GINT_TO_POINTER(flag));
-  
+
   if (callbackFunc)
     g_signal_connect(G_OBJECT(btn), "toggled", callbackFunc, subContainer);
 
   if (buttonOut)
     *buttonOut = btn;
 
-  /* Now add the subcomponent container to the vbox. Bit of a hack - put it inside an hbox with 
+  /* Now add the subcomponent container to the vbox. Bit of a hack - put it inside an hbox with
    * a blank label preceeding it, so that the sub-components appear offset to the right slightly
    * from the main button. */
   GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new("   "), FALSE, FALSE, 0);
   gtk_box_pack_start(GTK_BOX(hbox), subContainer, FALSE, FALSE, 0);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-  
+
   return GTK_CONTAINER(subContainer);
 }
 
@@ -3766,7 +3767,7 @@ void refreshDialog(const BlxDialogId dialogId, GtkWidget *blxWindow)
     {
       BlxContext *bc = blxWindowGetContext(blxWindow);
       GtkWidget *dialog = getPersistentDialog(bc->dialogList, dialogId);
-      
+
       if (dialog && GTK_WIDGET_VISIBLE(dialog))
         {
            switch (dialogId)
@@ -3778,7 +3779,7 @@ void refreshDialog(const BlxDialogId dialogId, GtkWidget *blxWindow)
                case BLXDIALOG_SORT:
                  showSortDialog(blxWindow, FALSE);
                  break;
-                 
+
                case BLXDIALOG_HELP:
                  showHelpDialog(blxWindow, FALSE);
                  break;
@@ -3794,11 +3795,11 @@ void refreshDialog(const BlxDialogId dialogId, GtkWidget *blxWindow)
                case BLXDIALOG_DOTTER:
                  showDotterDialog(blxWindow, FALSE);
                  break;
-                 
+
                case BLXDIALOG_GROUPS:
                  showGroupsDialog(blxWindow, TRUE, FALSE); /* show the 'edit' pane because we've got here by adding/deleting a group */
                  break;
-                 
+
                default:
                  break;
              };
@@ -3821,13 +3822,13 @@ static void onResponseFontSelectionDialog(GtkDialog *dialog, gint responseId, gp
       /* Check that the user selected a monospace font (unfortunately there's no easy way to get the
        * font family in older GTK versions so don't bother checking) */
       gboolean ok = TRUE;
-    
-#if CHECK_GTK_VERSION(2, 6)  
+
+#if CHECK_GTK_VERSION(2, 6)
       GtkFontSelection *fontSeln = GTK_FONT_SELECTION(gtk_buildable_get_internal_child(GTK_BUILDABLE(dialog), gtk_builder_new(), "font_selection"));
       PangoFontFamily *family = gtk_font_selection_get_family(fontSeln);
       ok = pango_font_family_is_monospace(family);
 #endif
-      
+
       /* Get the selected font name */
       gchar *fontName = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(dialog));
 
@@ -3845,20 +3846,20 @@ static void onResponseFontSelectionDialog(GtkDialog *dialog, gint responseId, gp
 
           ok = (response == GTK_RESPONSE_ACCEPT);
         }
-      
+
       if (ok)
         {
           GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
           DetailViewProperties *properties = detailViewGetProperties(detailView);
-          
+
           pango_font_description_free(properties->fontDesc);
           properties->fontDesc = pango_font_description_from_string(fontName);
-          
+
           updateDetailViewFontDesc(detailView);
 
           g_debug("Set font family to '%s'\n", fontName);
           blxWindowRedrawAll(blxWindow);
-          
+
           if (responseId != GTK_RESPONSE_APPLY)
             {
               gtk_widget_destroy(GTK_WIDGET(dialog));
@@ -3889,7 +3890,7 @@ static void createFontSelectionButton(GtkBox *parent, GtkWidget *blxWindow)
   gtk_box_pack_start(parent, hbox, FALSE, FALSE, 0);
 
   gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new("Change fixed-width font:   "), FALSE, FALSE, 0);
-  
+
   GtkWidget *button = gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT);
   g_signal_connect(G_OBJECT(button), "pressed", G_CALLBACK(onFontSelectionButtonPressed), blxWindow);
   gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
@@ -3899,9 +3900,9 @@ static void createFontSelectionButton(GtkBox *parent, GtkWidget *blxWindow)
 /* This function restores all settings to defaults */
 static void resetSettings(GtkWidget *blxWindow)
 {
-  gint responseId = runConfirmationBox(blxWindow, "Reset all settings", 
+  gint responseId = runConfirmationBox(blxWindow, "Reset all settings",
     "This will reset all settings to their default values: are you sure you want to continue?");
-  
+
   if (responseId == GTK_RESPONSE_ACCEPT)
     {
       resetColumnWidths(blxWindowGetColumnList(blxWindow));
@@ -3932,7 +3933,7 @@ void showSettingsDialog(GtkWidget *blxWindow, const gboolean bringToFront)
   BlxContext *bc = blxWindowGetContext(blxWindow);
   const BlxDialogId dialogId = BLXDIALOG_SETTINGS;
   GtkWidget *dialog = getPersistentDialog(bc->dialogList, dialogId);
-  
+
   if (!dialog)
     {
       /* note: reset-to-defaults option commented out because it is incomplete:
@@ -3941,7 +3942,7 @@ void showSettingsDialog(GtkWidget *blxWindow, const gboolean bringToFront)
       char *title = g_strdup_printf("%sSettings", blxGetTitlePrefix(bc));
 
       dialog = gtk_dialog_new_with_buttons(title,
-                                           GTK_WINDOW(blxWindow), 
+                                           GTK_WINDOW(blxWindow),
                                            GTK_DIALOG_DESTROY_WITH_PARENT,
 //                                           "Reset to defaults",
 //                                           BLX_RESPONSE_RESET,
@@ -3954,11 +3955,11 @@ void showSettingsDialog(GtkWidget *blxWindow, const gboolean bringToFront)
                                            NULL);
 
       g_free(title);
-      
+
       int width = 300, height = 200;
       gbtools::GUIGetTrueMonitorSizeFraction(dialog, 0.33, 0.33, &width, &height);
       gtk_window_set_default_size(GTK_WINDOW(dialog), width, height);
-      
+
       /* These calls are required to make the dialog persistent... */
       addPersistentDialog(bc->dialogList, dialogId, dialog);
       g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
@@ -3976,7 +3977,7 @@ void showSettingsDialog(GtkWidget *blxWindow, const gboolean bringToFront)
   int borderWidth = 12;
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
   GtkWidget *bigPicture = blxWindowGetBigPicture(blxWindow);
-  
+
   /* We'll put everything into a tabbed notebook */
   GtkWidget *notebook = gtk_notebook_new();
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), notebook, TRUE, TRUE, 0);
@@ -4001,7 +4002,7 @@ void showSettingsDialog(GtkWidget *blxWindow, const gboolean bringToFront)
                                                              BLXFLAG_HIGHLIGHT_VARIATIONS,
                                                              NULL,
                                                              G_CALLBACK(onParentBtnToggled));
-  createCheckButton(GTK_BOX(variationContainer), 
+  createCheckButton(GTK_BOX(variationContainer),
                     "Show variations trac_k",
                     "Show a track above the reference sequence which shows the details of any variations that are highlighted in the reference sequence",
                     bc->flags[BLXFLAG_SHOW_VARIATION_TRACK],
@@ -4030,14 +4031,14 @@ void showSettingsDialog(GtkWidget *blxWindow, const gboolean bringToFront)
   g_signal_connect(G_OBJECT(polyABtn), "toggled", G_CALLBACK(onToggleFlag), GINT_TO_POINTER(BLXFLAG_SHOW_POLYA_SIG_SELECTED));
 
   const gboolean squashMatches = (bc->modelId == BLXMODEL_SQUASHED);
-  
+
 
   /* show-unaligned-sequence option and its sub-options */
   GtkContainer *unalignContainer = createParentCheckButton(optionsBox,
                                                            detailView,
                                                            bc,
                                                            "Show _unaligned sequence",
-                                                           "Show unaligned sections of match sequences", 
+                                                           "Show unaligned sections of match sequences",
                                                            BLXFLAG_SHOW_UNALIGNED,
                                                            NULL,
                                                            G_CALLBACK(onShowAdditionalSeqToggled));
@@ -4061,7 +4062,7 @@ void showSettingsDialog(GtkWidget *blxWindow, const gboolean bringToFront)
                                                                G_CALLBACK(onParentBtnToggled));
   createCheckButton(GTK_BOX(colinearityContainer),
                     "Selected sequences only",
-                    "Only show colinearity lines in the Detail section for the currently-selected sequence(s). (Note that in the Overview section they are only ever displayed for the selected sequence.)", 
+                    "Only show colinearity lines in the Detail section for the currently-selected sequence(s). (Note that in the Overview section they are only ever displayed for the selected sequence.)",
                     bc->flags[BLXFLAG_SHOW_COLINEARITY_SELECTED],
                     G_CALLBACK(onToggleFlag),
                     GINT_TO_POINTER(BLXFLAG_SHOW_COLINEARITY_SELECTED));
@@ -4072,13 +4073,13 @@ void showSettingsDialog(GtkWidget *blxWindow, const gboolean bringToFront)
                                                                detailView,
                                                                bc,
                                                                "Show Sp_lice Sites for selected seqs",
-                                                               "Highlights splice sites in the reference sequence for the currently selected feature(s). Green means canonical and red non-canonical.", 
+                                                               "Highlights splice sites in the reference sequence for the currently selected feature(s). Green means canonical and red non-canonical.",
                                                                BLXFLAG_SHOW_SPLICE_SITES,
                                                                NULL,
                                                                G_CALLBACK(onParentBtnToggled));
   createCheckButton(GTK_BOX(spliceSitesContainer),
                     "Highlight \"maybe canonical\" splice sites",
-                    "With this option enabled, splice sites that would be canonical if they were on the other strand are highlighted in orange, rather than in red for non-canonical. This option can help find problems with strand representation in the input data.", 
+                    "With this option enabled, splice sites that would be canonical if they were on the other strand are highlighted in orange, rather than in red for non-canonical. This option can help find problems with strand representation in the input data.",
                     bc->flags[BLXFLAG_SHOW_MAYBE_CANONICAL],
                     G_CALLBACK(onToggleFlag),
                     GINT_TO_POINTER(BLXFLAG_SHOW_MAYBE_CANONICAL));
@@ -4137,9 +4138,9 @@ void showSettingsDialog(GtkWidget *blxWindow, const gboolean bringToFront)
 
   createColorButtons(appearancePage, blxWindow, borderWidth);
 
-  
+
   gtk_widget_show_all(dialog);
-  
+
   if (bringToFront)
     {
       gtk_window_present(GTK_WINDOW(dialog));
@@ -4155,7 +4156,7 @@ void showSettingsDialog(GtkWidget *blxWindow, const gboolean bringToFront)
 static GtkComboBox* widgetGetComboBox(GtkWidget *widget)
 {
   GtkComboBox *result = NULL;
-  
+
   if (GTK_IS_COMBO_BOX(widget))
     {
       result = GTK_COMBO_BOX(widget);
@@ -4164,19 +4165,19 @@ static GtkComboBox* widgetGetComboBox(GtkWidget *widget)
     {
       GList *children = gtk_container_get_children(GTK_CONTAINER(widget));
       GList *childItem = children;
-      
+
       for ( ; childItem; childItem = childItem->next)
         {
           GtkWidget *childWidget = GTK_WIDGET(childItem->data);
           result = widgetGetComboBox(childWidget);
-          
+
           if (result)
             break;
         }
 
       g_list_free(children);
     }
-  
+
   return result;
 }
 
@@ -4186,23 +4187,23 @@ static GtkComboBox* widgetGetComboBox(GtkWidget *widget)
 static BlxColumnId getColumnFromComboBox(GtkComboBox *combo)
 {
   BlxColumnId result = BLXCOL_NONE;
-  
+
   if (combo)
     {
       /* Get the combo box value */
       GtkTreeIter iter;
-      
+
       if (gtk_combo_box_get_active_iter(combo, &iter))
         {
           GtkTreeModel *model = gtk_combo_box_get_model(combo);
-          
+
           GValue val = {0};
           gtk_tree_model_get_value(model, &iter, SORT_TYPE_COL, &val);
-          
+
           result = (BlxColumnId)g_value_get_int(&val);
         }
     }
-  
+
   return result;
 }
 
@@ -4211,12 +4212,12 @@ static BlxColumnId getColumnFromComboBox(GtkComboBox *combo)
 static gboolean onInvertSortChanged(GtkWidget *button, const gint responseId, gpointer data)
 {
   const gboolean invert = setFlagFromButton(button, data);
-  
+
   GtkWidget *blxWindow = dialogChildGetBlxWindow(button);
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
-  
+
   detailViewUpdateSortInverted(detailView, invert);
-  
+
   return TRUE;
 }
 
@@ -4236,7 +4237,7 @@ static gboolean onSortOrderChanged(GtkWidget *widget, const gint responseId, gpo
       GList *childItem = children;
       const int numColumns = g_list_length(columnList);
       int priority = 0;
-      
+
       for ( ; childItem; childItem = childItem->next, ++priority)
         {
           if (priority >= numColumns)
@@ -4244,66 +4245,66 @@ static gboolean onSortOrderChanged(GtkWidget *widget, const gint responseId, gpo
               g_critical("Exceeded max number of sort columns (%d).\n", numColumns);
               break;
             }
-          
+
           /* See if this is a (or has a child) combo box */
           GtkWidget *childWidget = GTK_WIDGET(childItem->data);
           GtkComboBox *combo = widgetGetComboBox(childWidget);
-          
+
           if (combo)
             {
               dvProperties->sortColumns[priority] = getColumnFromComboBox(combo);
             }
         }
-      
+
       g_list_free(children);
 
       /* Re-sort trees */
       detailViewResortTrees(detailView);
     }
-  
+
   return TRUE;
 }
 
 
 /* Add an option for the sorting drop-down box */
-static GtkTreeIter* addSortBoxItem(GtkTreeStore *store, 
-                                   GtkTreeIter *parent, 
-                                   BlxColumnId sortColumn, 
+static GtkTreeIter* addSortBoxItem(GtkTreeStore *store,
+                                   GtkTreeIter *parent,
+                                   BlxColumnId sortColumn,
                                    const char *sortName,
                                    BlxColumnId initSortColumn,
                                    GtkComboBox *combo)
 {
   GtkTreeIter iter;
   gtk_tree_store_append(store, &iter, parent);
-  
+
   gtk_tree_store_set(store, &iter, SORT_TYPE_COL, sortColumn, SORT_TEXT_COL, sortName, -1);
-  
+
   if (sortColumn == initSortColumn)
     {
       gtk_combo_box_set_active_iter(combo, &iter);
     }
-  
+
   return NULL;
 }
 
 
 /* Create the combo box used for selecting sort criteria */
-static void createSortBox(GtkBox *parent, 
-                          GtkWidget *detailView, 
-                          const BlxColumnId initSortColumn, 
-                          GList *columnList, 
+static void createSortBox(GtkBox *parent,
+                          GtkWidget *detailView,
+                          const BlxColumnId initSortColumn,
+                          GList *columnList,
                           const char *labelText,
                           const gboolean searchableOnly)
 {
   /* Put the label and drop-down in a box */
   GtkWidget *box = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(parent, box, FALSE, FALSE, 0);
-  
+
   /* Add a label, to make it obvious what the combo box is for */
   GtkWidget *label = gtk_label_new(labelText);
   gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
   gtk_container_add(GTK_CONTAINER(box), label);
-  
+
   /* Create the data for the drop-down box. Use a tree so that we can sort by
    * multiple criteria. */
   GtkTreeStore *store = gtk_tree_store_new(N_SORT_COLUMNS, G_TYPE_INT, G_TYPE_STRING);
@@ -4315,9 +4316,9 @@ static void createSortBox(GtkBox *parent,
   GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
   gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, FALSE);
   gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "text", SORT_TEXT_COL, NULL);
-  
+
   GtkTreeIter *iter = NULL;
-  
+
   /* Add a blank row for the case where nothing is selected (unless we only
    * want searchable columns, because we can't search the NONE column) */
   if (!searchableOnly)
@@ -4354,7 +4355,7 @@ static void onAddNewSortByBox(GtkButton *button, gpointer data)
 
   /* Add another sort-by box to the container */
   createSortBox(box, detailView, BLXCOL_NONE, columnList, "then by", FALSE);
-  
+
   gtk_widget_show_all(GTK_WIDGET(box));
 }
 
@@ -4365,13 +4366,13 @@ void showSortDialog(GtkWidget *blxWindow, const gboolean bringToFront)
   BlxContext *bc = blxWindowGetContext(blxWindow);
   const BlxDialogId dialogId = BLXDIALOG_SORT;
   GtkWidget *dialog = getPersistentDialog(bc->dialogList, dialogId);
-  
+
   if (!dialog)
     {
       char *title = g_strdup_printf("%sSort", blxGetTitlePrefix(bc));
 
       dialog = gtk_dialog_new_with_buttons(title,
-                                           GTK_WINDOW(blxWindow), 
+                                           GTK_WINDOW(blxWindow),
                                            GTK_DIALOG_DESTROY_WITH_PARENT,
                                            GTK_STOCK_CANCEL,
                                            GTK_RESPONSE_REJECT,
@@ -4382,11 +4383,11 @@ void showSortDialog(GtkWidget *blxWindow, const gboolean bringToFront)
                                            NULL);
 
       g_free(title);
-      
+
       /* These calls are required to make the dialog persistent... */
       addPersistentDialog(bc->dialogList, dialogId, dialog);
       g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-      
+
       g_signal_connect(dialog, "response", G_CALLBACK(onResponseDialog), GINT_TO_POINTER(TRUE));
     }
   else
@@ -4394,9 +4395,9 @@ void showSortDialog(GtkWidget *blxWindow, const gboolean bringToFront)
       /* Need to refresh the dialog contents, so clear and re-create content area */
       dialogClearContentArea(GTK_DIALOG(dialog));
     }
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_APPLY);
-  
+
   const int borderWidth = 12;
   GtkWidget *contentArea = GTK_DIALOG(dialog)->vbox;
 
@@ -4411,11 +4412,11 @@ void showSortDialog(GtkWidget *blxWindow, const gboolean bringToFront)
   gtk_container_add(GTK_CONTAINER(contentArea), vbox);
   int sortPriority = 0;
   const int minBoxes = 3;
-  
+
   for ( ; sortPriority < numColumns; ++sortPriority)
     {
       const BlxColumnId columnId = dvProperties->sortColumns[sortPriority];
-      
+
       if (columnId != BLXCOL_NONE || sortPriority < minBoxes)
         {
           if (sortPriority == 0)
@@ -4428,27 +4429,27 @@ void showSortDialog(GtkWidget *blxWindow, const gboolean bringToFront)
           break;
         }
     }
-  
+
   widgetSetCallbackData(vbox, onSortOrderChanged, detailView);
 
-  
+
   /* Add a button to add a new sort-by box */
   GtkWidget *button = gtk_button_new_from_stock(GTK_STOCK_ADD);
   gtk_box_pack_end(GTK_BOX(vbox), button, FALSE, FALSE, 0);
   g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(onAddNewSortByBox), vbox);
-  
-  
+
+
   /* Add a toggle button for the 'invert sort order' option */
   GtkWidget *toggle = gtk_check_button_new_with_mnemonic("_Invert sort order");
   gtk_box_pack_end(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
-  
+
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), bc->flags[BLXFLAG_INVERT_SORT]);
   widgetSetCallbackData(toggle, onInvertSortChanged, GINT_TO_POINTER(BLXFLAG_INVERT_SORT));
-  
+
 
   /* Shot the dialog */
   gtk_widget_show_all(dialog);
-  
+
   if (bringToFront)
     {
       gtk_window_present(GTK_WINDOW(dialog));
@@ -4485,7 +4486,7 @@ static void getStats(GtkWidget *blxWindow, GString *result, MSP *MSPlist)
           seqDataSize += strlen(sequence) * sizeof(char);
         }
     }
-  
+
 
   /* Compile data for MSPs */
   int numMSPs = 0;                /* total number of MSPs */
@@ -4498,11 +4499,11 @@ static void getStats(GtkWidget *blxWindow, GString *result, MSP *MSPlist)
       mspStructSize += sizeof(MSP);
     }
 
-  
+
   /* Other data */
   int refSeqLen = strlen(blxWindowGetRefSeq(blxWindow));
 
-  
+
   /* Create the text based on the results */
   g_string_printf(result, "%s%d%s %s%d%s %s%d%s %s%d%s %s%d%s %s%d%s %s%d%s %s%d%s %s%d%s",
                   "Length of reference sequence\t\t\t\t\t\t\t= ", refSeqLen, " characters\n\n",
@@ -4523,7 +4524,7 @@ static void showStatsDialog(GtkWidget *blxWindow, MSP *MSPlist)
   BlxContext *bc = blxWindowGetContext(blxWindow);
   char *title = g_strdup_printf("%sStatistics", blxGetTitlePrefix(bc));
 
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
                                                   GTK_WINDOW(blxWindow),
                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
                                                   GTK_STOCK_OK,
@@ -4531,23 +4532,23 @@ static void showStatsDialog(GtkWidget *blxWindow, MSP *MSPlist)
                                                   NULL);
 
   g_free(title);
-  
+
   /* Ensure that the dialog box (along with any children) is destroyed when the user responds. */
   g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
-  
+
   /* Create a text buffer containing the required text*/
   GString *displayText = g_string_sized_new(200); /* will be extended if we need more space */
   getStats(blxWindow, displayText, MSPlist);
   GtkTextBuffer *textBuffer = gtk_text_buffer_new(gtk_text_tag_table_new());
-  
+
   gtk_text_buffer_set_text(GTK_TEXT_BUFFER(textBuffer), displayText->str, -1);
-  
+
   g_string_free(displayText, TRUE);
-  
+
   /* Create a text view widget and put it in the vbox area of the dialog */
   GtkWidget *textView = gtk_text_view_new_with_buffer(GTK_TEXT_BUFFER(textBuffer));
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), textView, TRUE, TRUE, 0);
-  
+
   /* Show the dialog */
   gtk_widget_show(textView);
   gtk_widget_show(dialog);
@@ -4562,9 +4563,9 @@ static void showStatsDialog(GtkWidget *blxWindow, MSP *MSPlist)
 static void aboutDialogOpenLinkCB(GtkAboutDialog *about, const gchar *link, gpointer data)
 {
   GError *error = NULL ;
-    
+
   if (!seqtoolsLaunchWebBrowser(link, &error))
-    g_critical("Cannot show link in web browser: \"%s\"", link) ;    
+    g_critical("Cannot show link in web browser: \"%s\"", link) ;
 }
 
 
@@ -4575,12 +4576,12 @@ void showAboutDialog(GtkWidget *parent)
   const gchar *authors[] = {AUTHOR_LIST, NULL} ;
 
   gtk_about_dialog_set_url_hook(aboutDialogOpenLinkCB, NULL, NULL) ;
-  
+
   char *comments_string = blxGetCommentsString();
 
   gtk_show_about_dialog(GTK_WINDOW(parent),
                         "authors", authors,
-                        "comments", blxGetCommentsString(), 
+                        "comments", blxGetCommentsString(),
                         "copyright", blxGetCopyrightString(),
                         "license", blxGetLicenseString(),
                         "name", blxGetAppName(),
@@ -4600,32 +4601,32 @@ void showAboutDialog(GtkWidget *parent)
 void onResponseHelpDialog(GtkDialog *dialog, gint responseId, gpointer data)
 {
   gboolean destroy = TRUE;
-  
+
   switch (responseId)
   {
     case GTK_RESPONSE_ACCEPT:
       destroy = TRUE;
       break;
-      
+
     case GTK_RESPONSE_HELP:
       showAboutDialog(NULL);
       destroy = FALSE;
       break;
-      
+
     case GTK_RESPONSE_CANCEL:
     case GTK_RESPONSE_REJECT:
       destroy = TRUE;
       break;
-      
+
     default:
       break;
   };
-  
+
   if (destroy)
     {
       /* If it's a persistent dialog, just hide it, otherwise destroy it */
       const gboolean isPersistent = GPOINTER_TO_INT(data);
-      
+
       if (isPersistent)
         {
           gtk_widget_hide_all(GTK_WIDGET(dialog));
@@ -4655,16 +4656,16 @@ void showHelpDialog(GtkWidget *blxWindow, const gboolean bringToFront)
     {
       /* Get the executable's directory */
       char *dir = g_path_get_dirname(exe);
-      
+
       ok = dir != NULL;
-      
+
       if (ok)
         {
           /* Get the path to the html page */
           char *path = g_strdup_printf("%s/%s", dir, rel_path);
-          
+
           ok = path != NULL;
-          
+
           if (ok)
             {
               g_message("Opening help page '%s'\n", path);
@@ -4677,7 +4678,7 @@ void showHelpDialog(GtkWidget *blxWindow, const gboolean bringToFront)
 
       g_free(exe);
     }
-  
+
   if (!ok)
     {
       if (error)
@@ -4720,10 +4721,10 @@ static void onFindMenu(GtkAction *action, gpointer data)
 static void onGoToMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *blxWindow = GTK_WIDGET(data);
-  
+
   /* We currently only accept input in terms of DNA coords on the ref seq */
   const BlxSeqType seqType = BLXSEQ_DNA;
-  
+
   goToDetailViewCoord(blxWindowGetDetailView(blxWindow), seqType);
 }
 
@@ -4762,7 +4763,7 @@ static void onPageLeftMenu(GtkAction *action, gpointer data)
 }
 
 static void onPageRightMenu(GtkAction *action, gpointer data)
-{  
+{
   GtkWidget *blxWindow = GTK_WIDGET(data);
   scrollDetailViewRightPage(blxWindowGetDetailView(blxWindow));
 }
@@ -4782,12 +4783,12 @@ static void onScrollRight1Menu(GtkAction *action, gpointer data)
 static void onSquashMatchesMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *blxWindow = GTK_WIDGET(data);
-  
+
   const gboolean squash = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-  
+
   GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
   detailViewUpdateSquashMatches(detailView, squash);
-  
+
   /* Refresh the settings dialog, if it is open */
   refreshDialog(BLXDIALOG_SETTINGS, blxWindow);
 }
@@ -4866,7 +4867,7 @@ static void onLoadMenu(GtkAction *action, gpointer data)
 
   char *filename = getLoadFileName(blxWindow, NULL, "Load file");
   dynamicLoadFeaturesFile(blxWindow, filename, NULL, &tmp_error);
-  
+
   g_free(filename);
 
   reportAndClearIfError(&tmp_error, G_LOG_LEVEL_CRITICAL);
@@ -4934,7 +4935,7 @@ static void onCopyRefSeqDnaMenu(GtkAction *action, gpointer data)
     }
 }
 
-/* Copy the translation of the ref seq for the currently-selected range of coords 
+/* Copy the translation of the ref seq for the currently-selected range of coords
  * to the clipboard. Uses the currently-active reading frame. */
 static void onCopyRefSeqDisplayMenu(GtkAction *action, gpointer data)
 {
@@ -4995,7 +4996,7 @@ static void onCloseAllDottersMenu(GtkAction *action, gpointer data)
   /* Check if there are actually any spawned processes */
   if (g_slist_length(bc->spawnedProcesses) > 0)
     {
-      gint responseId = runConfirmationBox(blxWindow, "Close all Dotters", 
+      gint responseId = runConfirmationBox(blxWindow, "Close all Dotters",
         "Are you sure you want to close all Dotters started from this Blixem?");
 
       if (responseId == GTK_RESPONSE_ACCEPT)
@@ -5042,9 +5043,9 @@ static void onPrintMenu(GtkAction *action, gpointer data)
 
   /* We need to do some work to prepare the big picture for printing */
   bigPicturePrepareForPrinting(properties->bigPicture);
-  
+
   blxPrintWidget(blxWindow, NULL, GTK_WINDOW(blxWindow), &properties->printSettings, &properties->pageSetup, NULL, TRUE, PRINT_FIT_BOTH);
-  
+
   bigPictureRedrawAll(properties->bigPicture);
 }
 
@@ -5057,14 +5058,14 @@ static void onPageSetupMenu(GtkAction *action, gpointer data)
 
   if (!properties->pageSetup)
     properties->pageSetup = gtk_page_setup_new();
-  
+
   if (!properties->printSettings)
     properties->printSettings = gtk_print_settings_new();
-  
-  properties->pageSetup = gtk_print_run_page_setup_dialog(GTK_WINDOW(blxWindow), 
-                                                          properties->pageSetup, 
+
+  properties->pageSetup = gtk_print_run_page_setup_dialog(GTK_WINDOW(blxWindow),
+                                                          properties->pageSetup,
                                                           properties->printSettings);
-}  
+}
 
 /***********************************************************
  *                         Events                          *
@@ -5078,7 +5079,7 @@ static gboolean onButtonPressBlxWindow(GtkWidget *window, GdkEventButton *event,
       gtk_menu_popup (GTK_MENU (data), NULL, NULL, NULL, NULL, event->button, event->time);
       return TRUE;
   }
-  
+
   return TRUE;
 }
 
@@ -5087,7 +5088,7 @@ static gboolean onButtonPressBlxWindow(GtkWidget *window, GdkEventButton *event,
 static gboolean onButtonPressPanedWin(GtkWidget *panedWin, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   switch (event->button)
     {
     case 1: /* left button */
@@ -5104,11 +5105,11 @@ static gboolean onButtonPressPanedWin(GtkWidget *panedWin, GdkEventButton *event
 
         break;
       }
-      
+
     default:
       break;
     };
-    
+
   return handled;
 }
 
@@ -5122,9 +5123,9 @@ static gboolean onKeyPressEscape(GtkWidget *window, const gboolean ctrlModifier,
   return TRUE;
 }
 
-static gboolean onKeyPressLeftRight(GtkWidget *window, 
-                                    const gboolean left, 
-                                    const gboolean ctrlModifier, 
+static gboolean onKeyPressLeftRight(GtkWidget *window,
+                                    const gboolean left,
+                                    const gboolean ctrlModifier,
                                     const gboolean shiftModifier,
                                     const gboolean metaModifier)
 {
@@ -5140,7 +5141,7 @@ static gboolean onKeyPressLeftRight(GtkWidget *window,
     {
       moveSelectedDisplayIdxBy1(window, left, shiftModifier);
     }
-  
+
   return TRUE;
 }
 
@@ -5177,14 +5178,14 @@ static gboolean onKeyPressPlusMinus(GtkWidget *window, const gboolean zoomIn, co
 static gboolean onKeyPressV(GtkWidget *window, const gboolean ctrlModifier, const gboolean shiftModifier)
 {
   gboolean result = FALSE;
-  
+
   if (ctrlModifier)
     {
       /* Paste from the default clipboard */
       requestDefaultClipboardText(findAndSelectSeqsFromClipboard, window);
       result = TRUE;
     }
-  
+
   return result;
 }
 
@@ -5205,36 +5206,36 @@ static gboolean onKeyPressF(GtkWidget *window, const gboolean ctrlModifier, cons
 static gboolean onKeyPressP(GtkWidget *window, const gboolean ctrlModifier, const gboolean shiftModifier)
 {
   gboolean result = FALSE;
-  
+
   if (!ctrlModifier)
     {
       goToDetailViewCoord(blxWindowGetDetailView(window), BLXSEQ_DNA); /* for now, only accept input in terms of DNA seq coords */
       result = TRUE;
     }
-  
+
   return result;
 }
 
 static gboolean onKeyPressG(GtkWidget *window, const gboolean ctrlModifier, const gboolean shiftModifier)
 {
   gboolean result = FALSE;
-  
+
   if (!ctrlModifier)
-    {       
+    {
       createQuickGroup(window, false, !shiftModifier);
       result = TRUE;
     }
-  
+
   return result;
 }
 
 static gboolean onKeyPressB(GtkWidget *window, const gboolean ctrlModifier, const gboolean shiftModifier)
 {
   toggleBumpState(window);
-  
+
   /* Refresh the view dialog, if it is open */
   refreshDialog(BLXDIALOG_VIEW, window);
-  
+
   return TRUE;
 }
 
@@ -5253,10 +5254,10 @@ static gboolean onKeyPressI(GtkWidget *window, const gboolean ctrlModifier, cons
 static gboolean onKeyPressNumber(GtkWidget *window, const int number, const gboolean ctrlModifier, const gboolean shiftModifier)
 {
   togglePaneVisibility(window, number, ctrlModifier, shiftModifier);
-  
+
   /* Refresh the view dialog, if it is open */
   refreshDialog(BLXDIALOG_VIEW, window);
-  
+
   return TRUE;
 }
 
@@ -5270,21 +5271,21 @@ static gboolean onKeyPressF3(GtkWidget *window, const gboolean ctrlModifier, con
 static gboolean onKeyPressBlxWindow(GtkWidget *window, GdkEventKey *event, gpointer data)
 {
   gboolean result = FALSE;
-  
+
   const gboolean ctrlModifier = (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
   const gboolean shiftModifier = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
   const gboolean metaModifier = (event->state & GDK_META_MASK) == GDK_META_MASK;
-  
+
   switch (event->keyval)
     {
       case GDK_Escape:      result = onKeyPressEscape(window, ctrlModifier, shiftModifier);           break;
-      
+
       case GDK_Left:        result = onKeyPressLeftRight(window, TRUE, ctrlModifier, shiftModifier, metaModifier);  break;
       case GDK_Right:       result = onKeyPressLeftRight(window, FALSE, ctrlModifier, shiftModifier, metaModifier); break;
-      
+
       case GDK_Up:          result = onKeyPressUpDown(window, TRUE, ctrlModifier, shiftModifier);     break;
       case GDK_Down:        result = onKeyPressUpDown(window, FALSE, ctrlModifier, shiftModifier);    break;
-        
+
       case GDK_Home:        result = onKeyPressHomeEnd(window, TRUE, ctrlModifier, shiftModifier);    break;
       case GDK_End:         result = onKeyPressHomeEnd(window, FALSE, ctrlModifier, shiftModifier);   break;
 
@@ -5293,15 +5294,15 @@ static gboolean onKeyPressBlxWindow(GtkWidget *window, GdkEventKey *event, gpoin
 
       case GDK_equal:       /* fall through */
       case GDK_plus:        result = onKeyPressPlusMinus(window, TRUE, ctrlModifier, shiftModifier);  break;
-      
+
       case GDK_minus:       /* fall through */
       case GDK_underscore:  result = onKeyPressPlusMinus(window, FALSE, ctrlModifier, shiftModifier); break;
-      
+
       case GDK_F3:          result = onKeyPressF3(window, ctrlModifier, shiftModifier);               break;
 
       case GDK_v:           /* fall through */
       case GDK_V:           result = onKeyPressV(window, ctrlModifier, shiftModifier);                break;
-        
+
       case GDK_f:           /* fall through */
       case GDK_F:           result = onKeyPressF(window, ctrlModifier, shiftModifier);                break;
 
@@ -5310,10 +5311,10 @@ static gboolean onKeyPressBlxWindow(GtkWidget *window, GdkEventKey *event, gpoin
 
       case GDK_p:           /* fall through */
       case GDK_P:           result = onKeyPressP(window, ctrlModifier, shiftModifier);                break;
-                
+
       case GDK_b:           /* fall through */
       case GDK_B:           result = onKeyPressB(window, ctrlModifier, shiftModifier);                break;
-        
+
       case GDK_t:           /* fall through */
       case GDK_T:           result = onKeyPressT(window, ctrlModifier, shiftModifier);                break;
 
@@ -5330,7 +5331,7 @@ static gboolean onKeyPressBlxWindow(GtkWidget *window, GdkEventKey *event, gpoin
       case GDK_3:           /* fall through */
       case GDK_currency:    result = onKeyPressNumber(window, 3, ctrlModifier, shiftModifier);        break;
     };
-  
+
   return result;
 }
 
@@ -5342,10 +5343,10 @@ static BlxWindowProperties* blxWindowGetProperties(GtkWidget *widget)
 {
   /* optimisation: cache result, because we know there is only ever one main window */
   static BlxWindowProperties *properties = NULL;
-  
+
   if (!properties && widget)
     properties = (BlxWindowProperties*)(g_object_get_data(G_OBJECT(widget), "BlxWindowProperties"));
-  
+
   return properties;
 }
 
@@ -5373,7 +5374,7 @@ static void saveBlixemSettings(GtkWidget *blxWindow)
   GKeyFile *key_file = g_key_file_new();
   GKeyFileFlags flags = G_KEY_FILE_NONE;
   GError *error = NULL;
-  
+
   /* Load existing contents so they can be merged, if the file already exists */
   g_key_file_load_from_file(key_file, filename, flags, &error);
   g_message("Saving Blixem settings to '%s'.\n", filename);
@@ -5385,7 +5386,7 @@ static void saveBlixemSettings(GtkWidget *blxWindow)
 
   /* Output to the config file */
   gchar *file_content = g_key_file_to_data(key_file, NULL, NULL);
-      
+
   if (!g_file_set_contents(filename, file_content, -1, NULL))
     g_warning("Error saving settings to '%s'.\n", filename);
 
@@ -5397,7 +5398,7 @@ static void saveBlixemSettings(GtkWidget *blxWindow)
 static void onDestroyBlxWindow(GtkWidget *widget)
 {
   BlxWindowProperties *properties = blxWindowGetProperties(widget);
-  
+
   if (properties)
     {
       delete properties->blxContext;
@@ -5414,14 +5415,14 @@ static void onDestroyBlxWindow(GtkWidget *widget)
           gtk_widget_destroy(properties->seqHeaderMenu);
           properties->seqHeaderMenu = NULL;
         }
-      
+
       /* Destroy the print settings */
       if (properties->printSettings)
         {
           g_object_unref(properties->printSettings);
           properties->printSettings = NULL;
         }
-      
+
       /* Free the properties struct itself */
       delete properties;
       properties = NULL;
@@ -5430,7 +5431,7 @@ static void onDestroyBlxWindow(GtkWidget *widget)
 
   /* Reset any globals */
   blviewResetGlobals();
-  
+
   gtk_main_quit();
 }
 
@@ -5438,8 +5439,8 @@ static void onDestroyBlxWindow(GtkWidget *widget)
 /* Create the properties struct and initialise all values. */
 static void blxWindowCreateProperties(CommandLineOptions *options,
                                       BlxContext *blxContext,
-                                      GtkWidget *widget, 
-                                      GtkWidget *bigPicture, 
+                                      GtkWidget *widget,
+                                      GtkWidget *bigPicture,
                                       GtkWidget *detailView,
                                       GtkWidget *mainmenu,
                                       GtkWidget *seqHeaderMenu,
@@ -5451,7 +5452,7 @@ static void blxWindowCreateProperties(CommandLineOptions *options,
   if (widget)
     {
       BlxWindowProperties *properties = new BlxWindowProperties;
-      
+
       properties->widget = widget;
       properties->blxContext = blxContext;
 
@@ -5463,12 +5464,12 @@ static void blxWindowCreateProperties(CommandLineOptions *options,
 
       properties->pageSetup = gtk_page_setup_new();
       gtk_page_setup_set_orientation(properties->pageSetup, GTK_PAGE_ORIENTATION_LANDSCAPE);
-      
+
       properties->printSettings = gtk_print_settings_new();
       gtk_print_settings_set_orientation(properties->printSettings, GTK_PAGE_ORIENTATION_LANDSCAPE);
       gtk_print_settings_set_quality(properties->printSettings, GTK_PRINT_QUALITY_HIGH);
       gtk_print_settings_set_resolution(properties->printSettings, DEFAULT_PRINT_RESOLUTION);
-    
+
       g_object_set_data(G_OBJECT(widget), "BlxWindowProperties", properties);
       g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK (onDestroyBlxWindow), NULL);
     }
@@ -5500,7 +5501,7 @@ GtkWidget* blxWindowGetBigPictureCoverageView(GtkWidget *blxWindow)
   if (properties && properties->bigPicture)
     {
       BigPictureProperties *bpProperties = bigPictureGetProperties(properties->bigPicture);
-      
+
       if (bpProperties)
         coverageView = bpProperties->coverageView();
     }
@@ -5516,7 +5517,7 @@ GtkWidget* blxWindowGetDetailViewCoverageView(GtkWidget *blxWindow)
   if (properties && properties->detailView)
     {
       DetailViewProperties *dvProperties = detailViewGetProperties(properties->detailView);
-      
+
       if (dvProperties)
         coverageView = dvProperties->coverageView();
     }
@@ -5646,9 +5647,9 @@ gboolean blxWindowGetNegateCoords(GtkWidget *blxWindow)
 BlxColumnInfo *getColumnInfo(const GList *columnList, const BlxColumnId columnId)
 {
   BlxColumnInfo *result = NULL;
-  
+
   const GList *listItem = columnList;
-  
+
   for ( ; listItem; listItem = listItem->next)
   {
     BlxColumnInfo *columnInfo = (BlxColumnInfo*)(listItem->data);
@@ -5658,7 +5659,7 @@ BlxColumnInfo *getColumnInfo(const GList *columnList, const BlxColumnId columnId
         break;
       }
   }
-  
+
   return result;
 }
 
@@ -5694,7 +5695,7 @@ static void onUpdateBackgroundColor(GtkWidget *blxWindow)
 
   GdkColor *defaultBgColor = getGdkColor(BLXCOLOR_BACKGROUND, bc->defaultColors, FALSE, bc->usePrintColors);
   setWidgetBackgroundColor(blxWindow, defaultBgColor);
-  
+
   blxWindowRedrawAll(blxWindow);
 }
 
@@ -5751,7 +5752,7 @@ static GString* blxWindowGetSelectedSeqNames(GtkWidget *blxWindow)
   GList *listItem = blxWindowGetSelectedSeqs(blxWindow);
   GString *result = g_string_new_len(NULL, 50);
   gboolean first = TRUE;
-  
+
   for ( ; listItem; listItem = listItem->next)
     {
       /* Add a separator before the name, unless it's the first one */
@@ -5824,9 +5825,9 @@ static void copySelectedSeqDataToClipboard(GtkWidget *blxWindow)
   if (displayText)
     {
       const int len = strlen(displayText);
-      
+
       /* Warn user if they're about to copy a large sequence */
-      if (len <= MAX_RECOMMENDED_COPY_LENGTH || 
+      if (len <= MAX_RECOMMENDED_COPY_LENGTH ||
           runConfirmationBox(blxWindow, "Copy sequence", "You are about to copy a large amount of text to the clipboard\n\nAre you sure you want to continue?") == GTK_RESPONSE_ACCEPT)
         {
           setDefaultClipboardText(displayText);
@@ -5872,7 +5873,7 @@ static void copySelectedSeqRangeToClipboard(GtkWidget *blxWindow, const int from
               fromIdx = toIdx;
               toIdx = tmp;
             }
-          
+
           /* Find the match-sequence coord at these ref-seq coords */
           GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
           const int numUnalignedBases = detailViewGetNumUnalignedBases(detailView);
@@ -5910,7 +5911,7 @@ static void copySelectedSeqRangeToClipboard(GtkWidget *blxWindow, const int from
 
               const int sourceLen = strlen(sequence);
               const int len = matchEnd - matchStart + 1;
-              DEBUG_OUT("Copying %s (%d, %d) (len=%d) for ref seq (%d, %d)\n", 
+              DEBUG_OUT("Copying %s (%d, %d) (len=%d) for ref seq (%d, %d)\n",
                         blxSequenceGetName(seq), matchStart, matchEnd, sourceLen, fromIdx, toIdx);
 
               if (matchStart >= sourceLen || matchEnd >= sourceLen)
@@ -5923,7 +5924,7 @@ static void copySelectedSeqRangeToClipboard(GtkWidget *blxWindow, const int from
                 }
               else if (len < 0)
                 {
-                  g_critical("Error: range length is negative (ref = %d, %d, match = %d, %d, len=%d)", 
+                  g_critical("Error: range length is negative (ref = %d, %d, match = %d, %d, len=%d)",
                              fromIdx, toIdx, matchStart, matchEnd, len);
                 }
               else if (len == 0)
@@ -5939,7 +5940,7 @@ static void copySelectedSeqRangeToClipboard(GtkWidget *blxWindow, const int from
                   /* Ok, now do the copy */
 
                   /* Warn user if they're about to copy a large sequence and ask to confirm */
-                  if (len <= MAX_RECOMMENDED_COPY_LENGTH || 
+                  if (len <= MAX_RECOMMENDED_COPY_LENGTH ||
                       runConfirmationBox(blxWindow, "Copy sequence", "You are about to copy a large amount of text to the clipboard\n\nAre you sure you want to continue?") == GTK_RESPONSE_ACCEPT)
                     {
                       char *displayText = g_strndup(sequence + matchStart, len);
@@ -5950,7 +5951,7 @@ static void copySelectedSeqRangeToClipboard(GtkWidget *blxWindow, const int from
                         displayText = g_strreverse(displayText);
 
                       setDefaultClipboardText(displayText);
-                      g_message("Copied sequence data for %s (%d, %d) to clipboard (%d, %d)\n", 
+                      g_message("Copied sequence data for %s (%d, %d) to clipboard (%d, %d)\n",
                                 blxSequenceGetName(seq), matchStart + 1, matchEnd + 1, fromIdx, toIdx);
 
                       g_free(displayText);
@@ -5959,7 +5960,7 @@ static void copySelectedSeqRangeToClipboard(GtkWidget *blxWindow, const int from
             }
           else
             {
-              g_critical("Failed to find a match from sequence '%s' which contains the range (%d, %d)", 
+              g_critical("Failed to find a match from sequence '%s' which contains the range (%d, %d)",
                          blxSequenceGetName(seq), fromIdx, toIdx);
             }
         }
@@ -5982,17 +5983,17 @@ static char* getRefSeqSegment(GtkWidget *blxWindow, const int fromIdx_in, const
     {
       /* Need to get 0-based indices */
       const IntRange* const refSeqRange = blxWindowGetRefSeqRange(blxWindow);
-      
+
       const int fromIdx = min(fromIdx_in, toIdx_in) - refSeqRange->min();
       const int toIdx = max(fromIdx_in, toIdx_in) - refSeqRange->min();
       const int len = toIdx - fromIdx + 1;
 
       /* Warn user if they're about to copy a large sequence */
-      if (len <= MAX_RECOMMENDED_COPY_LENGTH || 
+      if (len <= MAX_RECOMMENDED_COPY_LENGTH ||
           runConfirmationBox(blxWindow, "Copy sequence", "You are about to copy a large amount of text to the clipboard\n\nAre you sure you want to continue?") == GTK_RESPONSE_ACCEPT)
         {
           result = g_strndup(refSeq + fromIdx, toIdx - fromIdx + 1);
-      
+
           if (result)
             {
               /*! \todo Currently in dna mode the active strand pane is ignored (the strand is
@@ -6023,7 +6024,7 @@ static char* getRefSeqSegment(GtkWidget *blxWindow, const int fromIdx_in, const
 }
 
 
-/* This function copies the reference sequence, from the 
+/* This function copies the reference sequence, from the
  * clicked position to the marked position, onto the clipboard. */
 static void copyRefSeqToClipboard(GtkWidget *blxWindow, const int fromIdx, const int toIdx)
 {
@@ -6043,7 +6044,7 @@ static void copyRefSeqToClipboard(GtkWidget *blxWindow, const int fromIdx, const
 }
 
 
-/* This function copies the reference sequence, from the 
+/* This function copies the reference sequence, from the
  * clicked position to the marked position, onto the clipboard. */
 static void copyRefSeqTranslationToClipboard(GtkWidget *blxWindow, const int fromIdx, const int toIdx)
 {
@@ -6083,7 +6084,7 @@ static void copyRefSeqTranslationToClipboard(GtkWidget *blxWindow, const int fro
           if (pepSeq)
             {
               setDefaultClipboardText(pepSeq);
-              
+
               g_message("Copied reference sequence translation from %d to %d for frame %d\n", fromIdx, toIdx, requiredFrame);
               g_free(pepSeq);
             }
@@ -6118,16 +6119,16 @@ void blxWindowSelectionChanged(GtkWidget *blxWindow)
        * affect which MPSs are visible, so we need to re-filter the trees */
       refilterDetailView(detailView, NULL);
     }
-  
+
   /* Redraw */
   updateFeedbackBox(detailView);
   blxWindowRedrawAll(blxWindow);
-  
+
   /* Copy the selected sequence names to the PRIMARY clipboard */
   GString *displayText = blxWindowGetSelectedSeqNames(blxWindow);
   setPrimaryClipboardText(displayText->str);
   g_string_free(displayText, TRUE);
-  
+
   /* Refresh the dotter dialog, if it happens to be open */
   refreshDialog(BLXDIALOG_DOTTER, blxWindow);
 }
@@ -6211,16 +6212,16 @@ void blxWindowSetSeqSelected(GtkWidget *blxWindow, BlxSequence *seq, const gbool
 BlxSequence* blxWindowGetLastSelectedSeq(GtkWidget *blxWindow)
 {
   BlxSequence *result = NULL;
-  
+
   GList *selectedSeqs = blxWindowGetSelectedSeqs(blxWindow);
-  
+
   if (g_list_length(selectedSeqs) > 0)
     {
       /* Get the last-selected sequence */
       GList *lastItem = g_list_last(selectedSeqs);
       result = (BlxSequence*)(lastItem->data);
     }
-  
+
   return result;
 }
 
@@ -6229,12 +6230,12 @@ BlxSequence* blxWindowGetLastSelectedSeq(GtkWidget *blxWindow)
  *                      Initialisation                     *
  ***********************************************************/
 
-static void onDragDataReceived(GtkWidget *widget, 
-                               GdkDragContext *context, 
-                               int x, 
+static void onDragDataReceived(GtkWidget *widget,
+                               GdkDragContext *context,
+                               int x,
                                int y,
-                               GtkSelectionData *selectionData, 
-                               guint info, 
+                               GtkSelectionData *selectionData,
+                               guint info,
                                guint time,
                                gpointer userdata)
 {
@@ -6246,7 +6247,7 @@ static void onDragDataReceived(GtkWidget *widget,
     {
       DEBUG_OUT("Received drag and drop text:\n%s\n", selectionData->data);
       GError *tmp_error = NULL;
-      
+
       /* For now just assume the text contains supported file contents. The file parsing
        * will fail if it's not a supported format. */
       char *text = (char*)(gtk_selection_data_get_text(selectionData));
@@ -6284,13 +6285,13 @@ static void setDragDropProperties(GtkWidget *widget)
       { (gchar*)"text/plain",    0, TARGET_STRING },
       { (gchar*)"text/uri-list", 0, TARGET_URL },
     };
-  
+
   gtk_drag_dest_set(widget, GTK_DEST_DEFAULT_ALL, targetentries, 3,
                     (GdkDragAction)(GDK_ACTION_COPY|GDK_ACTION_MOVE|GDK_ACTION_LINK));
- 
+
   g_signal_connect(widget, "drag-data-received", G_CALLBACK(onDragDataReceived), NULL);
   g_signal_connect(widget, "drag-motion", G_CALLBACK(onDragMotion),	NULL);
-  
+
   DEBUG_EXIT("setDragDropProperties returning ")
 }
 
@@ -6303,12 +6304,12 @@ static void setStyleProperties(GtkWidget *widget, char *windowColor)
   int width = 300, height = 200;
   gbtools::GUIGetTrueMonitorSizeFraction(widget, DEFAULT_WINDOW_WIDTH_FRACTION, DEFAULT_WINDOW_HEIGHT_FRACTION,
                                   &width, &height);
-  
+
   gtk_window_set_default_size(GTK_WINDOW(widget), width, height);
-  
-  gtk_container_set_border_width (GTK_CONTAINER(widget), DEFAULT_WINDOW_BORDER_WIDTH); 
+
+  gtk_container_set_border_width (GTK_CONTAINER(widget), DEFAULT_WINDOW_BORDER_WIDTH);
   gtk_window_set_mnemonic_modifier(GTK_WINDOW(widget), GDK_MOD1_MASK); /* MOD1 is ALT on most systems */
-  
+
   /* Set the default font size to be a bit smaller than usual */
   int origSize = pango_font_description_get_size(widget->style->font_desc) / PANGO_SCALE;
   const char *origFamily = pango_font_description_get_family(widget->style->font_desc);
@@ -6330,34 +6331,34 @@ static void createMainMenu(GtkWidget *window,
                            GtkActionGroup **actionGroupOut)
 {
   GtkActionGroup *action_group = gtk_action_group_new ("MenuActions");
-  
+
   if (actionGroupOut)
     *actionGroupOut = action_group;
 
   /* Set the squash-matches toggle button depending on the initial state */
-  toggleMenuEntries[0].is_active = (bc->modelId == BLXMODEL_SQUASHED);  
+  toggleMenuEntries[0].is_active = (bc->modelId == BLXMODEL_SQUASHED);
 
   gtk_action_group_add_actions (action_group, mainMenuEntries, G_N_ELEMENTS (mainMenuEntries), window);
   gtk_action_group_add_toggle_actions(action_group, toggleMenuEntries, G_N_ELEMENTS (toggleMenuEntries), window);
 
   GtkUIManager *ui_manager = gtk_ui_manager_new ();
   gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
-  
+
   GtkAccelGroup *accel_group = gtk_ui_manager_get_accel_group (ui_manager);
   gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
-  
+
   GError *error = NULL;
   gboolean ok = gtk_ui_manager_add_ui_from_string (ui_manager, standardMenuDescription, -1, &error);
-  
+
   if (ok && userIsDeveloper())
     ok = gtk_ui_manager_add_ui_from_string (ui_manager, developerMenuDescription, -1, &error);
-    
+
   if (!ok)
     {
       prefixError(error, "Building menus failed: ");
       reportAndClearIfError(&error, G_LOG_LEVEL_ERROR);
     }
-  
+
   *mainmenu = gtk_ui_manager_get_widget (ui_manager, "/ContextMenu");
   *seqHeaderMenu = gtk_ui_manager_get_widget (ui_manager, "/SeqHeaderContextMenu");
   *toolbar = gtk_ui_manager_get_widget (ui_manager, "/Toolbar");
@@ -6365,22 +6366,22 @@ static void createMainMenu(GtkWidget *window,
 
 
 /* calcID: caculated percent identity of an MSP
- * 
+ *
  * There seems to be a general problem with this routine for protein
  * alignments, the existing code certainly does not do the right thing.
  * I have fixed this routine for gapped sequence alignments but not for
  * protein stuff at all.
- * 
+ *
  * To be honest I think this routine is a _waste_ of time, the alignment
  * programs that feed data to blixem produce an identity anyway so why
  * not use that...why reinvent the wheel......
- * 
+ *
  * */
 static void calcID(MSP *msp, BlxContext *bc)
 {
   const gboolean sForward = (mspGetMatchStrand(msp) == BLXSTRAND_FORWARD);
   const gboolean qForward = (mspGetRefStrand(msp) == BLXSTRAND_FORWARD);
-  
+
   if (mspIsBlastMatch(msp) && msp->id < 0) /* Only calculate if ID is not already set */
     {
       msp->id = 0.0;
@@ -6390,15 +6391,15 @@ static void calcID(MSP *msp, BlxContext *bc)
 
       if (matchSeq)
         {
-          /* Note that this will reverse complement the ref seq if it is the reverse 
+          /* Note that this will reverse complement the ref seq if it is the reverse
            * strand. This means that where there is no gaps array the comparison is trivial
            * as coordinates can be ignored and the two sequences just whipped through. */
           GError *error = NULL;
           IntRange qRange(msp->qRange); /* make a copy because it will be updated */
-          
+
           char *refSeqSegment = getSequenceSegment(bc->refSeq,
                                                    &qRange,
-                                                   mspGetRefStrand(msp), 
+                                                   mspGetRefStrand(msp),
                                                    BLXSEQ_DNA,        /* msp q coords are always nucleotide coords */
                                                    bc->seqType,       /* required seq type is the display seq type */
                                                    mspGetRefFrame(msp, bc->seqType),
@@ -6410,7 +6411,7 @@ static void calcID(MSP *msp, BlxContext *bc)
                                                    !qForward,
                                                    TRUE,
                                                    &error);
-          
+
           if (!refSeqSegment)
             {
               prefixError(error, "Failed to calculate ID for sequence '%s' (match coords = %d - %d). ", mspGetSName(msp), msp->sRange.min(), msp->sRange.max());
@@ -6419,30 +6420,30 @@ static void calcID(MSP *msp, BlxContext *bc)
             }
           else
             {
-              /* If there's an error but the sequence was still returned it's 
+              /* If there's an error but the sequence was still returned it's
                * a non-critical warning. Only issue one warning because we can
                * get many thousands and it can fill up the terminal if we output
                * them all. */
               if (error)
                 {
                   static gboolean done = FALSE;
-                  
+
                   if (!done)
                     {
                       g_warning("There were errors calculating the percent ID for some sequences because the match extends out of the reference sequence range; some IDs may be incorrect.\n");
                       done = TRUE;
                     }
-                  
+
                   g_error_free(error);
                   error = NULL;
                 }
             }
-          
+
           /* We need to find the number of characters that match out of the total number */
           int numMatchingChars = 0;
           int totalNumChars = 0;
           const int numGaps = msp->gaps ? g_slist_length(msp->gaps) : 0;
-          
+
           if (numGaps == 0)
             {
               /* Ungapped alignments. */
@@ -6491,22 +6492,22 @@ static void calcID(MSP *msp, BlxContext *bc)
                   /* blastn and blastp remain simple but blastx is more complex since the query
                    * coords are nucleic not protein. */
                   GSList *rangeItem = msp->gaps;
-                  
+
                   for ( ; rangeItem; rangeItem = rangeItem->next)
                     {
                       CoordRange *range = (CoordRange*)(rangeItem->data);
-                      
+
                       int qRangeMin = 0, qRangeMax = 0, sRangeMin = 0, sRangeMax = 0;
                       getCoordRangeExtents(range, &qRangeMin, &qRangeMax, &sRangeMin, &sRangeMax);
-                      
+
                       totalNumChars += sRangeMax - sRangeMin + 1;
-                      
+
                       /* Note that refSeqSegment is just the section of the ref seq relating to this msp.
                        * We need to translate the first coord in the range (which is in terms of the full
                        * reference sequence) into coords in the cut-down ref sequence. */
                       int q_start = qForward ? (qRangeMin - qRange.min()) / bc->numFrames : (qRange.max() - qRangeMax) / bc->numFrames;
                       const int qLen = strlen(refSeqSegment);
-                      
+
                       /* We can index sseq directly (but we need to adjust by 1 for zero-indexing). We'll loop forwards
                        * through sseq if we have the forward strand or backwards if we have the reverse strand,
                        * so start from the lower or upper end accordingly. */
@@ -6530,22 +6531,22 @@ static void calcID(MSP *msp, BlxContext *bc)
                     }
                 }
             }
-          
+
           msp->id = (100.0 * numMatchingChars / totalNumChars);
-          
+
           g_free(refSeqSegment);
         }
     }
-  
+
   return ;
 }
 
 
-/* Calculate the ID and q frame for the given MSP and store 
+/* Calculate the ID and q frame for the given MSP and store
  * them in the MSP struct. Returns the calculated ID (or UNSET_INT if this msp
  * is not a blast match). */
 static void calcMspData(MSP *msp, BlxContext *bc)
-{  
+{
   /* Calculate the ID */
   if (mspIsBlastMatch(msp))
     {
@@ -6558,35 +6559,35 @@ static gdouble calculateMspData(MSP *mspList, BlxContext *bc)
 {
   MSP *msp = mspList;
   gdouble lowestId = -1.0;
-  
+
   for ( ; msp; msp = msp->next)
     {
       calcMspData(msp, bc);
-      
+
       if (mspIsBlastMatch(msp) && (lowestId == -1.0 || msp->id < lowestId))
         {
           lowestId = msp->id;
         }
     }
-  
+
   return lowestId;
 }
 
 
-/* Calculate the reference sequence range from the range and offset given in 
+/* Calculate the reference sequence range from the range and offset given in
  * the option. Also translate this to display coords. */
 static void calculateRefSeqRange(CommandLineOptions *options,
                                  IntRange &refSeqRange,
                                  IntRange &fullDisplayRange)
 {
-  
-  /* Offset the reference sequence range, if an offset was specified. */ 
+
+  /* Offset the reference sequence range, if an offset was specified. */
   refSeqRange.set(options->refSeqRange);
   refSeqRange.set(refSeqRange.min() + options->refSeqOffset,
                   refSeqRange.max() + options->refSeqOffset);
-  
+
   fullDisplayRange.set(refSeqRange);
-  
+
   if (options->seqType == BLXSEQ_PEPTIDE)
     {
       /* Adjust the reference sequence reading frame so that it always starts at
@@ -6594,49 +6595,49 @@ static void calculateRefSeqRange(CommandLineOptions *options,
         * start drawing from the 1st base in the reference sequence. */
       int base = UNSET_INT;
       convertDnaIdxToDisplayIdx(refSeqRange.min(), options->seqType, 1, options->numFrames, FALSE, &refSeqRange, &base);
-      
+
       int offset = (options->numFrames - base + 1);
-      
+
       if (offset >= options->numFrames)
           offset -= options->numFrames;
-      
+
       refSeqRange.setMin(refSeqRange.min() + offset);
       options->refSeq = options->refSeq + offset;
-      
+
       /* Now do the same for when the ref seq is reversed */
       convertDnaIdxToDisplayIdx(refSeqRange.max(), options->seqType, 1, options->numFrames, TRUE, &refSeqRange, &base);
       offset = (options->numFrames - base + 1);
-      
-      if (offset >= options->numFrames) 
+
+      if (offset >= options->numFrames)
           offset -= options->numFrames;
-      
+
       refSeqRange.setMax(refSeqRange.max() - offset);
       options->refSeq[refSeqRange.length()] = '\0';
-      
+
       /* Now calculate the full display range in display coords */
       fullDisplayRange.setMin(convertDnaIdxToDisplayIdx(refSeqRange.min(), options->seqType, 1, options->numFrames, FALSE, &refSeqRange, NULL));
       fullDisplayRange.setMax(convertDnaIdxToDisplayIdx(refSeqRange.max(), options->seqType, 1, options->numFrames, FALSE, &refSeqRange, NULL));
-    }  
+    }
 }
 
 
 /* Create the main blixem window */
-GtkWidget* createBlxWindow(CommandLineOptions *options, 
-                           const char *paddingSeq, 
+GtkWidget* createBlxWindow(CommandLineOptions *options,
+                           const char *paddingSeq,
                            GArray* featureLists[],
-                           GList *seqList, 
+                           GList *seqList,
                            GSList *supportedTypes,
                            const gboolean External,
                            GSList *styles)
 {
   IntRange refSeqRange;
   IntRange fullDisplayRange;
-  
+
   calculateRefSeqRange(options, refSeqRange, fullDisplayRange);
-  
-  g_message("Reference sequence [%d - %d], display range [%d - %d]\n", 
+
+  g_message("Reference sequence [%d - %d], display range [%d - %d]\n",
             refSeqRange.min(), refSeqRange.max(), fullDisplayRange.min(), fullDisplayRange.max());
-  
+
   /* Offset the start coords, if applicable, and convert it to display coords */
   int startCoord = options->startCoord + options->refSeqOffset;
   if (options->seqType == BLXSEQ_PEPTIDE)
@@ -6658,9 +6659,9 @@ GtkWidget* createBlxWindow(CommandLineOptions *options,
           options->bigPictRange.setMax(convertDnaIdxToDisplayIdx(options->bigPictRange.max(), options->seqType, 1, options->numFrames, FALSE, &refSeqRange, NULL));
         }
     }
-  
-  
-  
+
+
+
   /* Create the main blixem window */
   GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   setStyleProperties(window, options->windowColor);
@@ -6670,15 +6671,15 @@ GtkWidget* createBlxWindow(CommandLineOptions *options,
   GtkWidget *statusBar = gtk_statusbar_new();
   gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(statusBar), TRUE);
   setStatusBarShadowStyle(statusBar, "GTK_SHADOW_NONE");
-  
+
   /* Set the window and statusbar in the message handler data, now that we know them */
   options->msgData.parent = GTK_WINDOW(window);
   options->msgData.statusBar = GTK_STATUSBAR(statusBar);
-  
+
   /* Create a vertical box to pack everything in */
   GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(window), vbox);
-  
+
   /* Create the widgets. We need a single adjustment for the entire detail view, which will also be referenced
    * by the big picture view, so create it first. */
   GtkAdjustment *detailAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0, /* initial value = 0 */
@@ -6687,15 +6688,15 @@ GtkWidget* createBlxWindow(CommandLineOptions *options,
                                                                       DEFAULT_SCROLL_STEP_INCREMENT, /* step increment used for mouse wheel scrolling */
                                                                       0,   /* page increment dynamically set based on display range */
                                                                       0)); /* page size dunamically set based on display range */
-  
-  BlxContext *blxContext = new BlxContext(options, 
-                                          &refSeqRange, 
-                                          &fullDisplayRange, 
-                                          paddingSeq, 
+
+  BlxContext *blxContext = new BlxContext(options,
+                                          &refSeqRange,
+                                          &fullDisplayRange,
+                                          paddingSeq,
                                           featureLists,
-                                          seqList, 
+                                          seqList,
                                           supportedTypes,
-                                          window, 
+                                          window,
                                           statusBar,
                                           External,
                                           styles);
@@ -6706,19 +6707,19 @@ GtkWidget* createBlxWindow(CommandLineOptions *options,
   GtkWidget *toolbar = NULL;
   GtkActionGroup *actionGroup = NULL;
   createMainMenu(window, blxContext, &mainmenu, &seqHeaderMenu, &toolbar, &actionGroup);
-  
+
   const gdouble lowestId = calculateMspData(options->mspList, blxContext);
-  
+
   GtkWidget *fwdStrandGrid = NULL, *revStrandGrid = NULL;
 
   /* Create the two main sections - the big picture and detail view - in a paned window */
   GtkWidget *panedWin = gtk_vpaned_new();
   gtk_box_pack_start(GTK_BOX(vbox), panedWin, TRUE, TRUE, 0);
-  
+
   GtkWidget *bigPicture = createBigPicture(window,
                                            blxContext,
                                            GTK_CONTAINER(panedWin),
-                                           &fwdStrandGrid, 
+                                           &fwdStrandGrid,
                                            &revStrandGrid,
                                            &options->bigPictRange,
                                            &refSeqRange,
@@ -6729,8 +6730,8 @@ GtkWidget* createBlxWindow(CommandLineOptions *options,
                                            blxContext,
                                            GTK_CONTAINER(panedWin),
                                            toolbar,
-					   detailAdjustment, 
-					   fwdStrandGrid, 
+					   detailAdjustment,
+					   fwdStrandGrid,
 					   revStrandGrid,
 					   options->mspList,
                                            options->columnList,
@@ -6744,35 +6745,35 @@ GtkWidget* createBlxWindow(CommandLineOptions *options,
                                            options->optionalColumns,
                                            options->windowColor);
 
-  
+
   /* Create a custom scrollbar for scrolling the sequence column and put it at the bottom of the window */
   GtkWidget *scrollBar = createDetailViewScrollBar(detailAdjustment, detailView);
   gtk_box_pack_start(GTK_BOX(vbox), scrollBar, FALSE, TRUE, 0);
 
-  
+
   /* Put the statusbar at the bottom */
   gtk_box_pack_start(GTK_BOX(vbox), statusBar, FALSE, TRUE, 0);
 
-  
+
   /* Set required data for the blixem window */
   blxWindowCreateProperties(options,
                             blxContext,
-                            window, 
-                            bigPicture, 
-                            detailView, 
+                            window,
+                            bigPicture,
+                            detailView,
                             mainmenu,
                             seqHeaderMenu,
                             actionGroup,
-                            &refSeqRange, 
+                            &refSeqRange,
                             &fullDisplayRange,
                             paddingSeq);
-  
+
   /* Connect signals */
   g_signal_connect(G_OBJECT(panedWin), "button-press-event", G_CALLBACK(onButtonPressPanedWin), window);
   g_signal_connect(G_OBJECT(window), "button-press-event", G_CALLBACK(onButtonPressBlxWindow), mainmenu);
   g_signal_connect(G_OBJECT(window), "key-press-event", G_CALLBACK(onKeyPressBlxWindow), NULL);
-  
-  
+
+
   const int numUnalignedBases = detailViewGetNumUnalignedBases(detailView);
   cacheMspDisplayRanges(blxContext, numUnalignedBases);
 
@@ -6786,7 +6787,7 @@ GtkWidget* createBlxWindow(CommandLineOptions *options,
     blxContext->calculateDepth(numUnalignedBases);
 
   updateCoverageDepth(window);
-  
+
   /* Set the detail view font (again, this accesses the widgets' properties). */
   updateDetailViewFontDesc(detailView);
 
@@ -6806,15 +6807,15 @@ GtkWidget* createBlxWindow(CommandLineOptions *options,
   /* Hide the coverage view by default (unless told to display it) */
   if (!options->coverageOn)
     coverageSetHidden(window, TRUE);
-  
-  /* The trees use the normal model by default, so if we're starting in 
+
+  /* The trees use the normal model by default, so if we're starting in
    * 'squash matches' mode we need to change the model */
   if (blxContext->modelId == BLXMODEL_SQUASHED)
     {
       callFuncOnAllDetailViewTrees(detailView, treeUpdateSquashMatches, NULL);
       detailViewRedrawAll(detailView);
     }
-  
+
   /* If the options say to hide the inactive strand, hide it now. (This must be done
    * after showing the widgets, or it will get shown again in show_all.). To do: we just
    * hide the grid at the moment; hide the detail-view pane as well?  */
@@ -6831,14 +6832,14 @@ GtkWidget* createBlxWindow(CommandLineOptions *options,
       blxContext->flags[BLXFLAG_INVERT_SORT] = TRUE;
       detailViewUpdateSortInverted(detailView, options->sortInverted);
     }
-  
-  /* Set the initial column widths. (This must be called after the widgets are 
+
+  /* Set the initial column widths. (This must be called after the widgets are
    * realised because it causes the scroll range to be updated, which in turn causes
    * the big picture range to be set. The widgets must be realised before this because
    * the initial big picture range depends on the detail view range, which is calculated
    * from its window's width, and this will be incorrect if it has not been realised.) */
   updateDynamicColumnWidths(detailView);
-  
+
   /* Just once, at the start, update the visibility of all tree rows. (After this,
    * filter updates will be done on affected rows only.) */
   /* gb10: already done by updatemsplengths but still required at this point or matches
@@ -6846,7 +6847,7 @@ GtkWidget* createBlxWindow(CommandLineOptions *options,
    * and resort are slow when there are many thousands of reads */
   callFuncOnAllDetailViewTrees(detailView, refilterTree, NULL);
   detailViewResortTrees(detailView);
-  
+
   /* Calculate initial size of the exon views (depends on big picture range) */
   calculateExonViewHeight(bigPictureGetFwdExonView(bigPicture));
   calculateExonViewHeight(bigPictureGetRevExonView(bigPicture));
@@ -6854,6 +6855,6 @@ GtkWidget* createBlxWindow(CommandLineOptions *options,
 
   /* If the primary clipboard contains features, select them on startup */
   requestPrimaryClipboardText(findSeqsFromClipboard, window);
-  
+
   return window;
 }
diff --git a/src/blixemApp/blxwindow.hpp b/src/blixemApp/blxwindow.hpp
index aa500785b6f81b6c7df4a547fc7830adf0b89152..92cfc7cfcf170be4c287dba8faf9198e300796c9 100644
--- a/src/blixemApp/blxwindow.hpp
+++ b/src/blixemApp/blxwindow.hpp
@@ -1,5 +1,6 @@
 /*  File: blxWindow.h
  *  Author: Gemma Barson, 2009-11-24
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -28,9 +29,9 @@
  *      Roy Storey        (Sanger Institute, UK)  <rds@sanger.ac.uk>
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
- * Description: Creates the main Blixem window. Also creates a "context", 
+ * Description: Creates the main Blixem window. Also creates a "context",
  *              which contains all of the variables associated with a Blixem
- *              session. 
+ *              session.
  *
  *              The context could live somewhere else, but was just included
  *              here because there is one context for each Blixem window.
@@ -105,11 +106,11 @@ void                      showAboutDialog(GtkWidget *blxWindow);
 void                      showInfoDialog(GtkWidget *blxWindow);
 
 void                      blxWindowRedrawAll(GtkWidget *blxWindow);
-  
-GtkWidget*                createBlxWindow(CommandLineOptions *options, 
-                                          const char *paddingSeq, 
-                                          GArray* featureLists[], 
-                                          GList *seqList, 
+
+GtkWidget*                createBlxWindow(CommandLineOptions *options,
+                                          const char *paddingSeq,
+                                          GArray* featureLists[],
+                                          GList *seqList,
                                           GSList *supportedTypes,
                                           const gboolean External,
                                           GSList *styles);
diff --git a/src/blixemApp/coverageview.cpp b/src/blixemApp/coverageview.cpp
index 952a33836d6b01d4f9a5844ab409c2c9a2c31022..3aa1352154bd5deafc39606ef262200361ff5d70 100644
--- a/src/blixemApp/coverageview.cpp
+++ b/src/blixemApp/coverageview.cpp
@@ -1,5 +1,6 @@
 /*  File: coverageview.c
  *  Author: Gemma Barson, 2011-03-21
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -57,7 +58,7 @@
  *                    Class member functions               *
  ***********************************************************/
 
-CoverageViewProperties::CoverageViewProperties(GtkWidget *widget_in, 
+CoverageViewProperties::CoverageViewProperties(GtkWidget *widget_in,
                                                GtkWidget *blxWindow_in,
                                                BlxContext *bc_in)
 {
@@ -70,7 +71,7 @@ CoverageViewProperties::CoverageViewProperties(GtkWidget *widget_in,
   m_viewYPadding = DEFAULT_COVERAGE_VIEW_Y_PADDING;
   m_numVCells = DEFAULT_NUM_V_CELLS;
   m_rangePerCell = 0;
-  
+
   if (bc_in)
     m_maxDepth = &bc_in->maxDepth;
 }
@@ -85,7 +86,7 @@ GtkWidget* CoverageViewProperties::widget()
 const IntRange* CoverageViewProperties::displayRange()
 {
   const IntRange *result = NULL;
-  
+
   // The range is the same as the parent panel
   if (m_panel)
     result = &m_panel->displayRange;
@@ -141,14 +142,14 @@ CoverageViewProperties* coverageViewGetProperties(GtkWidget *widget)
 
   if (widget)
     properties = (CoverageViewProperties*)(g_object_get_data(G_OBJECT(widget), "CoverageViewProperties"));
-  
+
   return properties;
 }
 
 static void onDestroyCoverageView(GtkWidget *widget)
 {
   CoverageViewProperties *properties = coverageViewGetProperties(widget);
-  
+
   if (properties)
     {
       delete properties;
@@ -157,18 +158,18 @@ static void onDestroyCoverageView(GtkWidget *widget)
     }
 }
 
-static CoverageViewProperties* coverageViewCreateProperties(GtkWidget *widget, 
+static CoverageViewProperties* coverageViewCreateProperties(GtkWidget *widget,
                                                             GtkWidget *blxWindow,
                                                             BlxContext *bc)
 {
   CoverageViewProperties *properties = NULL;
 
   if (widget)
-    { 
+    {
       properties = new CoverageViewProperties(widget, blxWindow, bc);
-      
+
       g_object_set_data(G_OBJECT(widget), "CoverageViewProperties", properties);
-      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyCoverageView), NULL); 
+      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyCoverageView), NULL);
     }
 
   return properties;
@@ -187,7 +188,7 @@ void CoverageViewProperties::updateDepth()
 {
   /* Set up a list of 'nice' values to round to for displaying labels */
   static GSList *roundValues = NULL;
-  
+
   if (!roundValues)
     {
       roundValues = g_slist_prepend(roundValues, GINT_TO_POINTER(1));
@@ -221,7 +222,7 @@ void CoverageViewProperties::updateDepth()
 
   if (!m_rangePerCell)
     {
-      /* First time round, calculate the range per cell, aiming for 
+      /* First time round, calculate the range per cell, aiming for
        * around 5 cells. (If we enter this function again, it's because the
        * user has manually entered the range per cell so we just need to calculate
        * the relevant number of cells) */
@@ -230,13 +231,13 @@ void CoverageViewProperties::updateDepth()
 
       /* Round the result and recalculate the number of cells */
       m_rangePerCell = roundUpToValueFromList(m_rangePerCell, roundValues, NULL);
-      
+
       if (m_rangePerCell < 1)
         m_rangePerCell = 1;
     }
-  
+
   m_numVCells = (gdouble)*m_maxDepth / m_rangePerCell;
-  
+
   recalculate();
 }
 
@@ -249,7 +250,7 @@ gboolean CoverageViewProperties::setDepthPerCell(const double depthPerCell_in)
 {
   if (depthPerCell_in <= 0.0)
     return FALSE;
-  
+
   m_rangePerCell = depthPerCell_in;
   updateDepth();
 
@@ -291,16 +292,16 @@ static void drawCoverageBar(const double x1,
       height = MIN_LINE_WIDTH;
       y1 = y2 - height;
     }
-  
+
   if (width <= 0)
     return;
-  
+
   cairo_rectangle(cr, x1 - MIN_LINE_WIDTH, y1, width + (2 * MIN_LINE_WIDTH), height);
   cairo_fill(cr);
 }
 
 
-/* Utility to get the max depth that the coverage view shows, based on 
+/* Utility to get the max depth that the coverage view shows, based on
  * the number of cells and the range per cell. Note that this returns the
  * max lable value, i.e. the value of the top gridline; the real max
  * depth may be slightly greater than this, and may extend above the top
@@ -337,17 +338,17 @@ void CoverageViewProperties::drawPlot(GdkDrawable *drawable)
 
   const GdkColor *color = getGdkColor(BLXCOLOR_COVERAGE_PLOT, m_bc->defaultColors, FALSE, m_bc->usePrintColors);
   gdk_cairo_set_source_color(cr, color);
-  
+
   const double pixelsPerVal = (double)m_viewRect.height / (double)*m_maxDepth;
   const int bottomBorder = m_viewRect.y + m_viewRect.height;
-  
+
   /* Loop through each coord in the display range */
-  
+
   double startX = -1.0;
   double prevX = -1.0;
   double prevY = -1.0;
   int coord = dispRange->min();
-  
+
   for ( ; coord <= dispRange->max(); ++coord)
     {
       /* Get the x position for this coord (always pass displayRev as false because
@@ -373,7 +374,7 @@ void CoverageViewProperties::drawPlot(GdkDrawable *drawable)
            * line at that y position. If there was only one position at the previous y value then
            * this will draw a single column in the bar chart (i.e. startX==prevX). */
           drawCoverageBar(startX, x, prevY, bottomBorder, cr);
-          
+
           /* If it's the last coord, also draw the current column, because there won't be another
            * loop to take care of this */
           if (coord == dispRange->max())
@@ -389,7 +390,7 @@ void CoverageViewProperties::drawPlot(GdkDrawable *drawable)
       prevX = x;
       prevY = y;
     }
-  
+
   cairo_destroy(cr);
 }
 
@@ -402,12 +403,12 @@ void CoverageViewProperties::draw(GdkDrawable *drawable)
   GtkWidget *bigPicture = blxWindowGetBigPicture(m_blxWindow);
   BigPictureProperties *bpProperties = bigPictureGetProperties(bigPicture);
 
-  drawVerticalGridLines(&m_viewRect, &m_highlightRect, 
+  drawVerticalGridLines(&m_viewRect, &m_highlightRect,
 			m_viewYPadding, m_bc, bpProperties, drawable);
-  
+
   drawHorizontalGridLines(m_widget, bigPicture, &m_viewRect, m_bc, bpProperties, drawable,
 			  (int)(m_numVCells), m_rangePerCell, (gdouble)*m_maxDepth, TRUE, "");
-  
+
   drawPlot(drawable);
 }
 
@@ -416,10 +417,10 @@ void CoverageViewProperties::draw(GdkDrawable *drawable)
  * selection range). (This is just a convenience way to call calculateHighlightBoxBorders
  * from an external function.) */
 void CoverageViewProperties::calculateHighlightBoxBorders()
-{  
+{
   if (m_bc)
     {
-      m_bc->highlightBoxCalcBorders(&m_displayRect, &m_highlightRect, 
+      m_bc->highlightBoxCalcBorders(&m_displayRect, &m_highlightRect,
                                     displayRange(), highlightRange(),
                                     0);
     }
@@ -431,14 +432,14 @@ void CoverageViewProperties::calculateBorders()
 {
   /* We should move cell height to BlxPanel so that we can get rid of references to big picture here */
   GtkWidget *bigPicture = blxWindowGetBigPicture(m_blxWindow);
-  
+
   /* Calculate the height based on the number of cells */
   const int height = ceil(m_numVCells * (double)bigPictureGetCellHeight(bigPicture));
   const int gridHeight = (int)m_numVCells * bigPictureGetCellHeight(bigPicture);
-  
+
   m_displayRect.x = roundNearest(contentXPos());
   m_displayRect.y = height - gridHeight;
-  
+
   m_viewRect.x = m_displayRect.x;
   m_viewRect.y = m_displayRect.y + HIGHLIGHT_BOX_Y_PAD + DEFAULT_COVERAGE_VIEW_Y_PADDING;
 
@@ -451,10 +452,10 @@ void CoverageViewProperties::calculateBorders()
 
   m_viewRect.width = m_displayRect.width;
   m_viewRect.height = gridHeight;
-  
+
   /* Get the boundaries of the highlight box */
   calculateHighlightBoxBorders();
-  
+
   /* Set the size request to our desired height. We want a fixed heigh but don't set the
    * width, because we want the user to be able to resize that. */
   gtk_widget_set_size_request(m_widget, 0, m_displayRect.height);
@@ -466,7 +467,7 @@ void CoverageViewProperties::calculateBorders()
 void CoverageViewProperties::prepareForPrinting()
 {
   GdkDrawable *drawable = widgetGetDrawable(m_widget);
-  
+
   if (drawable)
     {
       GdkColor *highlightBoxColor = getGdkColor(BLXCOLOR_HIGHLIGHT_BOX, m_bc->defaultColors, FALSE, m_bc->usePrintColors);
@@ -497,7 +498,7 @@ gboolean CoverageViewProperties::expose(GdkEventExpose *event, gpointer data)
   gboolean result = TRUE;
 
   GdkDrawable *window = GTK_LAYOUT(m_widget)->bin_window;
-  
+
   if (window)
     {
       GdkDrawable *bitmap = widgetGetDrawable(m_widget);
@@ -508,18 +509,18 @@ gboolean CoverageViewProperties::expose(GdkEventExpose *event, gpointer data)
 	  bitmap = createBlankPixmap(m_widget);
           draw(bitmap);
         }
-      
+
       if (bitmap)
         {
           /* Push the bitmap onto the window */
           GdkGC *gc = gdk_gc_new(window);
           gdk_draw_drawable(window, gc, bitmap, 0, 0, 0, 0, -1, -1);
           g_object_unref(gc);
-          
+
           /* Draw the highlight box on top of it */
           GdkColor *highlightBoxColor = getGdkColor(BLXCOLOR_HIGHLIGHT_BOX, m_bc->defaultColors, FALSE, m_bc->usePrintColors);
           drawHighlightBox(window, &m_highlightRect, HIGHLIGHT_BOX_MIN_WIDTH, highlightBoxColor);
-          
+
           /* Draw the preview box too, if set */
           if (m_panel)
             m_panel->drawPreviewBox(window, &m_viewRect, &m_highlightRect);
@@ -529,7 +530,7 @@ gboolean CoverageViewProperties::expose(GdkEventExpose *event, gpointer data)
 	  g_warning("Failed to draw coverageView [%p] - could not create bitmap.\n", m_widget);
 	}
     }
-  
+
   return result;
 }
 
@@ -555,28 +556,28 @@ static gboolean onButtonPressCoverageView(GtkWidget *coverageView, GdkEventButto
   return handled;
 }
 
-  
+
 gboolean CoverageViewProperties::buttonPress(GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->button == 2 ||
-      (event->button == 1 && !handled && 
-       (event->type == GDK_2BUTTON_PRESS || 
+      (event->button == 1 && !handled &&
+       (event->type == GDK_2BUTTON_PRESS ||
         clickedInRect(event, &m_highlightRect, HIGHLIGHT_BOX_MIN_WIDTH))))
     {
       /* Draw the preview box (draw it on the other big picture components as well) */
       int x = event->x;
-      
+
       if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
         x = m_highlightRect.x + m_highlightRect.width / 2;
-      
+
       if (m_panel)
         m_panel->startPreviewBox(event->x, TRUE, x - event->x);
 
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -599,10 +600,10 @@ gboolean CoverageViewProperties::buttonRelease(GdkEventButton *event, gpointer d
       if (m_panel)
         m_panel->finishPreviewBox(event->x, &m_viewRect, &m_highlightRect);
     }
-  
+
   return TRUE;
 }
-  
+
 
 
 /* Implement custom scrolling for horizontal mouse wheel movements over the coverageView.
@@ -621,7 +622,7 @@ static gboolean onScrollCoverageView(GtkWidget *coverageView, GdkEventScroll *ev
 
 
 gboolean CoverageViewProperties::scroll(GdkEventScroll *event, gpointer data)
-{  
+{
   gboolean handled = FALSE;
 
   /* We should make the scroll functions here virtual functions that can be called from the base
@@ -635,21 +636,21 @@ gboolean CoverageViewProperties::scroll(GdkEventScroll *event, gpointer data)
       handled = TRUE;
       break;
     }
-      
+
     case GDK_SCROLL_RIGHT:
     {
       scrollBigPictureRightStep(blxWindowGetBigPicture(m_blxWindow));
       handled = TRUE;
       break;
     }
-      
+
     default:
     {
       handled = FALSE;
       break;
     }
   };
-  
+
   return handled;
 }
 
@@ -663,7 +664,7 @@ gboolean CoverageViewProperties::mouseMove(GdkEventMotion *event, gpointer data)
       if (m_panel)
         m_panel->startPreviewBox(event->x, FALSE, 0);
     }
-  
+
   return TRUE;
 }
 
@@ -684,7 +685,7 @@ static gboolean onMouseMoveCoverageView(GtkWidget *coverageView, GdkEventMotion
  *                     Initialisation                      *
  ***********************************************************/
 
-CoverageViewProperties* createCoverageView(GtkWidget *blxWindow, 
+CoverageViewProperties* createCoverageView(GtkWidget *blxWindow,
                                            BlxContext *bc)
 {
   GtkWidget *coverageView = gtk_layout_new(NULL, NULL);
@@ -697,8 +698,8 @@ CoverageViewProperties* createCoverageView(GtkWidget *blxWindow,
   gtk_widget_add_events(coverageView, GDK_BUTTON_PRESS_MASK);
   gtk_widget_add_events(coverageView, GDK_BUTTON_RELEASE_MASK);
   gtk_widget_add_events(coverageView, GDK_POINTER_MOTION_MASK);
-  
-  g_signal_connect(G_OBJECT(coverageView), "expose-event",          G_CALLBACK(onExposeCoverageView),                 NULL);  
+
+  g_signal_connect(G_OBJECT(coverageView), "expose-event",          G_CALLBACK(onExposeCoverageView),                 NULL);
   g_signal_connect(G_OBJECT(coverageView), "size-allocate",	    G_CALLBACK(onSizeAllocateCoverageView),           NULL);
   g_signal_connect(G_OBJECT(coverageView), "button-press-event",    G_CALLBACK(onButtonPressCoverageView),	      NULL);
   g_signal_connect(G_OBJECT(coverageView), "button-release-event",  G_CALLBACK(onButtonReleaseCoverageView),	      NULL);
@@ -707,7 +708,6 @@ CoverageViewProperties* createCoverageView(GtkWidget *blxWindow,
 
   /* Set required data in the coverageView. */
   CoverageViewProperties *cvProperties = coverageViewCreateProperties(coverageView, blxWindow, bc);
-  
+
   return cvProperties;
 }
-
diff --git a/src/blixemApp/coverageview.hpp b/src/blixemApp/coverageview.hpp
index 3ae82ec314e03392b52173b83939ff79d13edfb8..eff450e8991afa941f8289ed8ccb45602072edf8 100644
--- a/src/blixemApp/coverageview.hpp
+++ b/src/blixemApp/coverageview.hpp
@@ -1,5 +1,6 @@
 /*  File: coverageview.h
  *  Author: Gemma Barson, 2011-03-21
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -32,7 +33,7 @@
  *              coordinate in the reference sequence.
  *----------------------------------------------------------------------------
  */
- 
+
 #ifndef _coverage_view_h_included_
 #define _coverage_view_h_included_
 
@@ -47,8 +48,8 @@ class BlxPanel;
 class CoverageViewProperties
 {
 public:
-  CoverageViewProperties(GtkWidget *widget_in, 
-                         GtkWidget *blxWindow_in, 
+  CoverageViewProperties(GtkWidget *widget_in,
+                         GtkWidget *blxWindow_in,
                          BlxContext *bc);
 
   /* Access */
@@ -95,7 +96,7 @@ private:
   int m_viewYPadding;	     /* The y padding around the view rect */
   double m_numVCells;	     /* The number of cells to show vertically */
   gdouble m_rangePerCell;    /* The range of depth values shown per grid cell on the plot */
-    
+
   GdkRectangle m_viewRect;   /* The rectangle we draw in */
   GdkRectangle m_displayRect; /* The total display area */
   GdkRectangle m_highlightRect; /* The area that is highlighted (which indicates the detail-view
diff --git a/src/blixemApp/detailview.cpp b/src/blixemApp/detailview.cpp
index b4befa2d6d7181104272fb0620e2f747afb73e5d..6c80fc01bc4bb47ba4f8a8b56431962d2e3cd963 100644
--- a/src/blixemApp/detailview.cpp
+++ b/src/blixemApp/detailview.cpp
@@ -1,5 +1,6 @@
 /*  File: detailview.c
  *  Author: Gemma Barson, 2009-11-23
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -84,7 +85,7 @@ using namespace std;
 #define SETTING_NAME_NUM_UNALIGNED_BASES "num-unaligned-bases"
 
 
-typedef struct 
+typedef struct
 {
   const int startDnaIdx;              /* the DNA coord to start searching from */
   const gboolean searchRight;         /* search towards the right or left */
@@ -146,23 +147,23 @@ static int                    getVariationRowNumber(const IntRange* const rangeI
 static void                   freeRowsList(GSList *rows);
 
 static gboolean               coordAffectedByVariation(const int dnaIdx,
-                                                       const BlxStrand strand, 
+                                                       const BlxStrand strand,
                                                        BlxContext *bc,
                                                        const MSP **msp,
-                                                       gboolean *drawStartBoundary, 
-                                                       gboolean *drawEndBoundary, 
-                                                       gboolean *drawJoiningLines, 
+                                                       gboolean *drawStartBoundary,
+                                                       gboolean *drawEndBoundary,
+                                                       gboolean *drawJoiningLines,
                                                        gboolean *drawBackground,
                                                        gboolean *multipleVariations);
 
 static gboolean               coordAffectedByPolyASignal(const int dnaIdx,
-                                                         const BlxStrand strand, 
+                                                         const BlxStrand strand,
                                                          BlxContext *bc,
                                                          const MSP **mspOut,
                                                          gboolean *multipleVariations);
 
 static gboolean                coordAffectedByPolyASite(const int dnaIdx,
-                                                        const BlxStrand strand, 
+                                                        const BlxStrand strand,
                                                         BlxContext *bc,
                                                         const MSP **mspOut,
                                                         gboolean *multipleVariations);
@@ -172,8 +173,8 @@ static gboolean                detailViewContainerIsParent(GtkContainer *contain
 
 static void                    detailViewRefreshSelection(GtkWidget *detailView);
 
-static void                    setDetailViewIndex(DetailViewIndex *index, 
-                                                  const gboolean isSet, 
+static void                    setDetailViewIndex(DetailViewIndex *index,
+                                                  const gboolean isSet,
                                                   const int dnaIdx,
                                                   const int displayIdx,
                                                   const int frame,
@@ -190,14 +191,14 @@ static void                    destroyBlxSpliceSite(gpointer listItemData, gpoin
 DetailViewProperties::DetailViewProperties(GtkWidget *detailView_in,
                                            GtkWidget *blxWindow_in,
                                            BlxContext *bc_in,
-                                           CoverageViewProperties *coverageViewP_in, 
+                                           CoverageViewProperties *coverageViewP_in,
                                            GtkCellRenderer *renderer_in,
                                            GList *fwdStrandTrees_in,
                                            GList *revStrandTrees_in,
                                            GtkWidget *feedbackBox_in,
                                            GtkWidget *statusBar_in,
                                            GList *columnList_in,
-                                           GtkAdjustment *adjustment_in, 
+                                           GtkAdjustment *adjustment_in,
                                            const int startCoord_in,
                                            const BlxColumnId sortColumn_in) :
   BlxPanel(detailView_in, blxWindow_in, bc_in, coverageViewP_in, 0)
@@ -221,14 +222,14 @@ DetailViewProperties::DetailViewProperties(GtkWidget *detailView_in,
   setDetailViewIndex(&selectedRangeInit, FALSE, UNSET_INT, UNSET_INT, UNSET_INT, UNSET_INT);
   setDetailViewIndex(&selectedRangeStart, FALSE, UNSET_INT, UNSET_INT, UNSET_INT, UNSET_INT);
   setDetailViewIndex(&selectedRangeEnd, FALSE, UNSET_INT, UNSET_INT, UNSET_INT, UNSET_INT);
-      
+
   /* The numunalignedbases may be set in the config file; if so, override the default */
   GKeyFile *key_file = blxGetConfig();
   if (key_file)
     {
       GError *error = NULL;
       int numUnaligned = g_key_file_get_integer(key_file, SETTINGS_GROUP, SETTING_NAME_NUM_UNALIGNED_BASES, &error);
-          
+
       if (!error) /* we don't care if it wasn't found */
         numUnalignedBases = numUnaligned;
     }
@@ -247,14 +248,14 @@ DetailViewProperties::DetailViewProperties(GtkWidget *detailView_in,
 
   /* Find the padding between the background area of the tree cells and the actual
    * drawing area. This is used to render the full height of the background area, so
-   * that we don't have gaps between rows. */ 
+   * that we don't have gaps between rows. */
   if (fwdStrandTrees)
     {
       //GtkWidget *widget = GTK_WIDGET(fwdStrandTrees->data);
 
       //GtkWidget *tree = widgetIsTree(widget) ? widget : treeContainerGetTree(GTK_CONTAINER(widget));
       //gtk_widget_realize(tree); /* must realize tree to pick up any overriden style properties */
-            
+
       /* I can't get this to work properly using gtk_tree_view_get_cell_area etc. The cell
        * area and background area come out wrong - perhaps because I'm not using a real
        * row path. After a bit of experimentation it seems that the y padding is always
@@ -262,18 +263,18 @@ DetailViewProperties::DetailViewProperties(GtkWidget *detailView_in,
       gint vertical_separator = 0, horizontal_separator = 0;
       //gtk_widget_style_get (tree, "vertical-separator", &vertical_separator, NULL);
       //gtk_widget_style_get (tree, "horizontal-separator", &horizontal_separator, NULL);
-          
+
       cellXPadding = (horizontal_separator / 2) + 1;
       cellYPadding = (vertical_separator / 2) + 1;
     }
   exonBoundaryLineWidth   = 1;
   exonBoundaryLineStyle = GDK_LINE_SOLID;
   exonBoundaryLineStylePartial = GDK_LINE_ON_OFF_DASH;
-      
+
   /* Allocate sortColumns array to be same length as columnList */
   const int numColumns = g_list_length(columnList_in);
   sortColumns = new BlxColumnId[numColumns];
-      
+
   int i = 0;
   for ( ; i < numColumns; ++i)
     sortColumns[i] = BLXCOL_NONE;
@@ -289,13 +290,13 @@ DetailViewProperties::~DetailViewProperties()
 {
   /* N.B. Don't free the cell renderer, or it causes memory corruption. I'm not
    * sure what owns it - the columns it is added to? */
-    
+
   if (fwdStrandTrees)
     {
       g_list_free(fwdStrandTrees);
       fwdStrandTrees = NULL;
     }
-  
+
   if (revStrandTrees)
     {
       g_list_free(revStrandTrees);
@@ -307,7 +308,7 @@ DetailViewProperties::~DetailViewProperties()
       pango_font_description_free(fontDesc);
       fontDesc = NULL;
     }
-  
+
   if (spliceSites)
     {
       g_slist_foreach(spliceSites, destroyBlxSpliceSite, NULL);
@@ -326,7 +327,7 @@ double DetailViewProperties::charHeight() const
   return m_charHeight;
 }
 
-/* Get the position of the left border of the main content, i.e. the 
+/* Get the position of the left border of the main content, i.e. the
  * sequence column */
 double DetailViewProperties::contentXPos() const
 {
@@ -340,7 +341,7 @@ double DetailViewProperties::contentXPos() const
   return result;
 }
 
-/* Get the position of the right border of the main content, i.e. the 
+/* Get the position of the right border of the main content, i.e. the
  * sequence column */
 double DetailViewProperties::contentWidth() const
 {
@@ -370,7 +371,7 @@ void callFuncOnChildren(GtkWidget *widget, gpointer data)
 
   if (stringsEqual(gtk_widget_get_name(widget), funcData->widgetName, TRUE))
     funcData->callbackFunc(widget, funcData->callbackData);
-  
+
   if (GTK_IS_CONTAINER(widget))
     gtk_container_foreach(GTK_CONTAINER(widget), callFuncOnChildren, data);
 }
@@ -383,7 +384,7 @@ void detailViewRefreshAllHeaders(GtkWidget *detailView)
 
   refreshDetailViewHeaders(detailView);
   callFuncOnAllDetailViewTrees(detailView, refreshTreeHeaders, NULL);
-  
+
   RecursiveFuncData data = {SNP_TRACK_HEADER_NAME, recalculateSnpTrackBorders, detailView};
   callFuncOnChildren(detailView, &data);
 
@@ -401,7 +402,7 @@ void detailViewRedrawAll(GtkWidget *detailView)
   callFuncOnAllDetailViewTrees(detailView, widgetClearCachedDrawable, NULL);
 
   /* Recalculate the size of the snp track headers */
-  RecursiveFuncData data = {SNP_TRACK_HEADER_NAME, recalculateSnpTrackBorders, detailView};  
+  RecursiveFuncData data = {SNP_TRACK_HEADER_NAME, recalculateSnpTrackBorders, detailView};
   callFuncOnChildren(detailView, &data);
 
   DetailViewProperties *properties = detailViewGetProperties(detailView);
@@ -420,7 +421,7 @@ void detailViewSaveProperties(GtkWidget *detailView, GKeyFile *key_file)
   DEBUG_ENTER("detailViewSaveProperties()");
 
   DetailViewProperties *properties = detailViewGetProperties(detailView);
-  
+
   g_key_file_set_integer(key_file, SETTINGS_GROUP, SETTING_NAME_NUM_UNALIGNED_BASES, properties->numUnalignedBases);
   saveColumnWidths(detailViewGetColumnList(detailView), key_file);
   saveSummaryColumns(detailViewGetColumnList(detailView), key_file);
@@ -462,24 +463,24 @@ void setDetailViewEndIdx(GtkWidget *detailView, int coord, const BlxSeqType coor
 
 /* Update the scroll position of the adjustment to the given value. Does bounds checking. */
 static void setDetailViewScrollPos(GtkAdjustment *adjustment, int value)
-{ 
+{
   DEBUG_ENTER("setDetailViewScrollPos()");
 
   /* bounds checking */
   int maxValue = adjustment->upper - adjustment->page_size + 1;
-  
+
   if (value > maxValue)
     {
       value = maxValue;
     }
-  
+
   if (value < adjustment->lower)
     {
       value = adjustment->lower;
     }
-  
+
   adjustment->value = value;
-  
+
   /* Emit notification that the scroll pos has changed */
    gtk_adjustment_value_changed(adjustment);
 
@@ -557,11 +558,11 @@ static int calcNumBasesInSequenceColumn(DetailViewProperties *properties)
   DEBUG_ENTER("calcNumBasesInSequenceColumn()");
 
   int numChars = 0;
-  
+
   /* Find the width of the sequence column */
   int colWidth = UNSET_INT;
   GList *listItem = blxWindowGetColumnList(properties->blxWindow());
-  
+
   for ( ; listItem; listItem = listItem->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)(listItem->data);
@@ -571,17 +572,17 @@ static int calcNumBasesInSequenceColumn(DetailViewProperties *properties)
           break;
         }
     }
-  
+
   if (colWidth >= 0)
     {
       /* Don't include the cell padding area */
       GtkCellRenderer *renderer = properties->renderer;
       colWidth -= (2 * renderer->xpad) + (2 * renderer->xalign);
-      
+
       /* Return the number of whole characters that fit in the column. */
       numChars = (int)((gdouble)colWidth / properties->charWidth());
     }
-  
+
   DEBUG_EXIT("calcNumBasesInSequenceColumn returning %d", numChars);
   return numChars;
 }
@@ -589,43 +590,43 @@ static int calcNumBasesInSequenceColumn(DetailViewProperties *properties)
 
 /* This should be called when the width of the sequence column has changed (or the
  * size of the font has changed). This function will adjust the scroll range of our
- * custom scroll adjustment so that it represents the range that can be displayed 
+ * custom scroll adjustment so that it represents the range that can be displayed
  * in the new column width. */
 void updateDetailViewRange(GtkWidget *detailView)
 {
   DEBUG_ENTER("updateDetailViewRange()");
 
   DetailViewProperties *properties = detailViewGetProperties(detailView);
-  
+
   if (properties->adjustment)
     {
       int newPageSize = calcNumBasesInSequenceColumn(properties);
-      
+
       /* Only trigger updates if things have actually changed */
       if (newPageSize != properties->adjustment->page_size)
         {
           properties->adjustment->page_size = newPageSize;
           properties->adjustment->page_increment = newPageSize;
-          
+
           ///* Reset the display range so that it is between the scrollbar min and max. Try to keep
-//         * it centred on the same base. The base index is in terms of the display range coords, 
+//         * it centred on the same base. The base index is in terms of the display range coords,
 //         * so the sequence type of the coord is whatever the display sequence type is. */
 //        const IntRange const *displayRange = &properties->displayRange;
 //
 //        /* First time through, both coords are set to the initial start coord. So, if
 //         * they are the same, just use that coord as the start coord */
 //        int newStart = displayRange->min;
-//        
+//
 //        if (displayRange->min != displayRange->max)
 //          {
 //            int centre = displayRange->centre();
 //            int offset = roundNearest((double)properties->adjustment->page_size / 2.0);
 //            newStart = centre - offset;
 //          }
-//            
+//
 //        const BlxSeqType seqType = blxWindowGetSeqType(properties->blxWindow());
 //        setDetailViewStartIdx(detailView, newStart, seqType);
-          
+
           gtk_adjustment_changed(properties->adjustment); /* signal that the scroll range has changed */
         }
     }
@@ -641,10 +642,10 @@ static GtkWidget *findNestedPanedWidget(GtkContainer *parentWidget)
   DEBUG_ENTER("findNestedPanedWidget()");
 
   GtkWidget *result = NULL;
-  
+
   GList *children = gtk_container_get_children(parentWidget);
   GList *child = children;
-  
+
   while (child)
     {
       GtkWidget *childWidget = GTK_WIDGET(child->data);
@@ -653,10 +654,10 @@ static GtkWidget *findNestedPanedWidget(GtkContainer *parentWidget)
           result = childWidget;
           break;
         }
-      
+
       child = child->next;
     }
-  
+
   g_list_free(children);
 
   DEBUG_EXIT("findNestedPanedWidget returning ");
@@ -669,19 +670,19 @@ static GtkWidget *findNestedPanedWidget(GtkContainer *parentWidget)
  * actual trees, it may contain their containers (e.g. if they live in scrolled windows). 'first'
  * indicates that this is the first (set of) tree(s) added. This information is used to determine
  * which pane to put the tree in and/or whether the first tree in the list should have headers. */
-static void addTreesToDetailViewPane(GtkPaned *panedWin, 
-                                     GList *treeList, 
+static void addTreesToDetailViewPane(GtkPaned *panedWin,
+                                     GList *treeList,
                                      const gboolean first)
 {
   DEBUG_ENTER("addTreesToDetailViewPane()");
 
   int numTrees = g_list_length(treeList);
-  
+
   if (numTrees == 1)
     {
       /* Two panes, one tree. Use 'first' flags to decide which pane to put it in */
       GtkWidget *tree1 = GTK_WIDGET(treeList->data);
-      
+
       if (first)
         {
           gtk_paned_pack1(panedWin, tree1, TRUE, TRUE);
@@ -696,7 +697,7 @@ static void addTreesToDetailViewPane(GtkPaned *panedWin,
       /* Two panes, two trees. Easy - put one in each. */
       GtkWidget *tree1 = GTK_WIDGET(treeList->data);
       GtkWidget *tree2 = GTK_WIDGET(treeList->next->data);
-      
+
       gtk_paned_pack1(panedWin, tree1, TRUE, TRUE);
       gtk_paned_pack2(panedWin, tree2, TRUE, TRUE);
     }
@@ -708,10 +709,10 @@ static void addTreesToDetailViewPane(GtkPaned *panedWin,
       gtk_paned_pack1(panedWin, tree1, TRUE, TRUE);
 
       GtkWidget *nestedPanedWidget = findNestedPanedWidget(GTK_CONTAINER(panedWin));
-      
+
       if (nestedPanedWidget)
         {
-          /* Create a new list containing the remaining trees and call this 
+          /* Create a new list containing the remaining trees and call this
            * function again on the nested paned widget. */
           GList *remainingTrees = NULL;
           GList *nextTree = treeList->next;
@@ -720,7 +721,7 @@ static void addTreesToDetailViewPane(GtkPaned *panedWin,
               remainingTrees = g_list_append(remainingTrees, nextTree->data);
               nextTree = nextTree->next;
             }
-          
+
           /* Pass 'first' as false to make sure we don't add any more headers */
           addTreesToDetailViewPane(GTK_PANED(nestedPanedWidget), remainingTrees, FALSE);
         }
@@ -742,7 +743,7 @@ static gboolean widgetIsTree(GtkWidget *widget)
 }
 
 
-/* Returns true if this widget is a detail-view-tree-container (that is, 
+/* Returns true if this widget is a detail-view-tree-container (that is,
  * a container that has only one child that is a detail-view-tree.) */
 static gboolean widgetIsTreeContainer(GtkWidget *widget)
 {
@@ -760,16 +761,16 @@ static gboolean widgetIsTreeContainer(GtkWidget *widget)
 static GtkWidget *treeContainerGetTree(GtkContainer *container)
 {
   GtkWidget *result = NULL;
-  
+
   GList *children = gtk_container_get_children(container);
   GList *child = children;
-  
+
   for ( ; child && !result; child = child->next)
     {
       if (GTK_IS_WIDGET(child->data))
         {
           GtkWidget *childWidget = GTK_WIDGET(child->data);
-          
+
           if (widgetIsTree(childWidget))
             {
               result = childWidget;
@@ -782,7 +783,7 @@ static GtkWidget *treeContainerGetTree(GtkContainer *container)
     }
 
   g_list_free(children);
-  
+
   return result;
 }
 
@@ -810,7 +811,7 @@ static gboolean detailViewContainerIsParent(GtkContainer *container, GtkWidget *
           result = detailViewContainerIsParent(GTK_CONTAINER(check_widget), search_child);
         }
     }
-  
+
   g_list_free(check_list);
 
   return result;
@@ -826,13 +827,13 @@ static GtkWidget *detailViewContainerGetParentWidget(GtkContainer *container, Gt
   /* Loop through all children in the container looking for a widget with parent_name */
   GList *container_children = gtk_container_get_children(container);
   GList *cur_item = container_children;
-  
+
   for ( ; cur_item && !result; cur_item = cur_item->next)
     {
       if (GTK_IS_WIDGET(cur_item->data))
         {
           GtkWidget *cur_widget = GTK_WIDGET(cur_item->data);
-          
+
           /* If the name matches, then check if this widget is a container with a child
            * (or child-of-a-child) that matches search_child. If not, keep on searching. */
           if (strcmp(gtk_widget_get_name(cur_widget), parent_name) == 0 && GTK_IS_CONTAINER(cur_widget))
@@ -843,7 +844,7 @@ static GtkWidget *detailViewContainerGetParentWidget(GtkContainer *container, Gt
                   break;
                 }
             }
-          
+
           if (GTK_IS_CONTAINER(cur_widget))
            {
              result = detailViewContainerGetParentWidget(GTK_CONTAINER(cur_widget), search_child, parent_name);
@@ -852,7 +853,7 @@ static GtkWidget *detailViewContainerGetParentWidget(GtkContainer *container, Gt
     }
 
   g_list_free(container_children);
-  
+
   return result;
 }
 
@@ -883,7 +884,7 @@ static void removeAllTreesFromContainer(GtkWidget *widget, gpointer data)
 
 /* This function removes the trees from the detail view and re-adds them in the
  * correct order according to the displayRev flag. It should be called every
- * time the strands are toggled. It assumes the trees are already in the 
+ * time the strands are toggled. It assumes the trees are already in the
  * detailView container, and that the properties have been set for all 3 widgets. */
 static void refreshTreeOrder(GtkWidget *detailView)
 {
@@ -898,7 +899,7 @@ static void refreshTreeOrder(GtkWidget *detailView)
 
   gtk_container_foreach(GTK_CONTAINER(detailView), removeAllTreesFromContainer, detailViewContainer);
 
-  /* Extract the named detail-view widget, which is the direct parent of the trees. This 
+  /* Extract the named detail-view widget, which is the direct parent of the trees. This
    * should be a paned window. */
   GtkWidget *panedWin = getNamedChildWidget(detailView, DETAIL_VIEW_WIDGET_NAME);
 
@@ -919,7 +920,7 @@ static void refreshTreeOrder(GtkWidget *detailView)
       GList *treeList = toggled ? properties->revStrandTrees : properties->fwdStrandTrees;
       addTreesToDetailViewPane(GTK_PANED(panedWin), treeList, TRUE);
     }
-  
+
   /* Must show all child widgets because some of them may not have been in this parent before.
    * (Just calling gtk_widget_show on the individual trees doesn't seem to work.)
    * However, we then need to re-hide any that may have been previously hidden by the user. */
@@ -932,17 +933,17 @@ static void refreshTreeOrder(GtkWidget *detailView)
 
 /* Refresh a header that contains fixed-width text that needs to be resized whenever a zoom
  * happens; updates the height of the widget and the font description, and clears its cached
- * drawable, if it has one. This just sets things up ready for the next expose event, where 
+ * drawable, if it has one. This just sets things up ready for the next expose event, where
  * the actual drawing will take place. */
 void refreshTextHeader(GtkWidget *header, gpointer data)
 {
   const char *widgetName = gtk_widget_get_name(header);
-  
+
   if (GTK_IS_LABEL(header))
     {
       /* For straightforward labels, just update the font size. */
       GtkWidget *detailView = GTK_WIDGET(data);
-      
+
       PangoFontDescription *dvFont = detailViewGetFontDesc(detailView);
       int newSize = pango_font_description_get_size(dvFont);
 
@@ -957,7 +958,7 @@ void refreshTextHeader(GtkWidget *header, gpointer data)
       /* Update the font and the widget height, in case the font-size has changed. */
       GtkWidget *detailView = GTK_WIDGET(data);
       gtk_widget_modify_font(header, detailViewGetFontDesc(detailView));
-     
+
       if (!strcmp(widgetName, SNP_TRACK_HEADER_NAME))
         {
           /* SNP track - must adjust its size based on the char height and number of rows visible */
@@ -973,7 +974,7 @@ void refreshTextHeader(GtkWidget *header, gpointer data)
 
       gtk_widget_queue_draw(header);
     }
-  
+
   /* If this is a container, recurse over each child */
   if (GTK_IS_CONTAINER(header))
     {
@@ -991,12 +992,12 @@ static void refreshDetailViewHeaders(GtkWidget *detailView)
   /* Loop through all widgets and call refreshTextHeader. This
    * updates the font etc. if it is a type of widget that requires that. */
   gtk_container_foreach(GTK_CONTAINER(detailView), refreshTextHeader, detailView);
-  
+
   /* Loop through all columns and call the individual refresh callbacks for
    * each of their headers. This updates the specific information within the header. */
   GList *columnList = detailViewGetColumnList(detailView);
   GList *column = columnList;
-  
+
   for ( ; column; column = column->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)column->data;
@@ -1023,7 +1024,7 @@ void resizeDetailViewHeaders(GtkWidget *detailView)
   DEBUG_ENTER("resizeDetailViewHeaders()");
 
   GList *listItem = detailViewGetColumnList(detailView);
-  
+
   for ( ; listItem; listItem = listItem->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)listItem->data;
@@ -1058,10 +1059,10 @@ void updateDetailViewFontDesc(GtkWidget *detailView)
   DEBUG_ENTER("updateDetailViewFontDesc()");
 
   PangoFontDescription *fontDesc = detailViewGetFontDesc(detailView);
-  
+
   gtk_widget_modify_font(detailView, fontDesc);
   callFuncOnAllDetailViewTrees(detailView, (GtkCallback)gtk_widget_modify_font, fontDesc);
-  
+
   updateCellRendererFont(detailView, fontDesc);
   refreshDetailViewHeaders(detailView);
   callFuncOnAllDetailViewTrees(detailView, refreshTreeHeaders, NULL);
@@ -1078,7 +1079,7 @@ static void incrementFontSize(GtkWidget *detailView)
 
   DetailViewProperties *properties = detailViewGetProperties(detailView);
   int newSize = (pango_font_description_get_size(properties->fontDesc) / PANGO_SCALE) + FONT_INCREMENT_SIZE;
-  
+
   if (newSize <= MAX_FONT_SIZE)
     {
       pango_font_description_set_size(properties->fontDesc, newSize * PANGO_SCALE);
@@ -1095,7 +1096,7 @@ static void decrementFontSize(GtkWidget *detailView)
 
   DetailViewProperties *properties = detailViewGetProperties(detailView);
   int newSize = (pango_font_description_get_size(properties->fontDesc) / PANGO_SCALE) - FONT_INCREMENT_SIZE;
-  
+
   /* Note that the font needs to be big enough to cover the vertical separators and padding around the
    * cell, otherwise we will end up with visible gaps between rows. */
   if (newSize >= MIN_FONT_SIZE && newSize >= (detailViewGetCellYPadding(detailView) * 2))
@@ -1121,13 +1122,13 @@ void zoomDetailView(GtkWidget *detailView, const gboolean zoomIn)
     {
       decrementFontSize(detailView);
     }
-  
+
   updateDetailViewRange(detailView);
 
   DEBUG_EXIT("zoomDetailView returning ");
 }
 
-  
+
 /* set the contents of a text entry box */
 static void entrySetContents(GtkWidget *widget, const char *value)
 {
@@ -1220,7 +1221,7 @@ static void feedbackBoxSetRefCoord(GtkWidget *feedbackBox,
                                    const BlxSequence *seq)
 {
   BlxContext *bc = detailViewGetContext(detailView);
-  
+
   if (detailViewGetSelectedIdxRangeSet(detailView))
     {
       /* A range of coordinates is selected */
@@ -1254,7 +1255,7 @@ static void feedbackBoxSetRefCoord(GtkWidget *feedbackBox,
     }
 }
 
-static bool getMatchCoordForRefCoord(GtkWidget *detailView, 
+static bool getMatchCoordForRefCoord(GtkWidget *detailView,
                                      const BlxSequence *seq,
                                      const int qIdx,
                                      int &sIdx)
@@ -1266,12 +1267,12 @@ static bool getMatchCoordForRefCoord(GtkWidget *detailView,
 
   GList *mspListItem = seq->mspList;
   const int numUnalignedBases = detailViewGetNumUnalignedBases(detailView);
-              
+
   for ( ; mspListItem; mspListItem = mspListItem->next)
     {
       MSP *msp = (MSP*)(mspListItem->data);
       BlxContext *bc = detailViewGetContext(detailView);
-                  
+
       if (mspGetMatchCoord(msp, qIdx, TRUE, numUnalignedBases, bc, &sIdx))
         {
           found = TRUE;
@@ -1292,7 +1293,7 @@ static void feedbackBoxSetMatchCoord(GtkWidget *feedbackBox,
       if (g_list_length(seq->mspList) > 0)
         {
           MSP *firstMsp = (MSP*)(seq->mspList->data);
-          
+
           if (mspGetMatchSeq(firstMsp))
             {
               const int sLen = strlen(mspGetMatchSeq(firstMsp));
@@ -1308,7 +1309,7 @@ static void feedbackBoxSetMatchCoord(GtkWidget *feedbackBox,
               int start = UNSET_INT;
               int end = UNSET_INT;
 
-              if (range && 
+              if (range &&
                   getMatchCoordForRefCoord(detailView, seq, range->start(bc->displayRev), start) &&
                   getMatchCoordForRefCoord(detailView, seq, range->end(bc->displayRev), end))
                 {
@@ -1326,7 +1327,7 @@ static void feedbackBoxSetMatchCoord(GtkWidget *feedbackBox,
             {
               int qIdx = detailViewGetSelectedDnaIdx(detailView);
               int sIdx = UNSET_INT;
-              
+
               if (getMatchCoordForRefCoord(detailView, seq, qIdx, sIdx))
                 {
                   feedbackBoxSetInt(feedbackBox, DETAIL_VIEW_FEEDBACK_MATCH_COORD, sIdx);
@@ -1338,11 +1339,11 @@ static void feedbackBoxSetMatchCoord(GtkWidget *feedbackBox,
 
 
 static void feedbackBoxSetMatchName(GtkWidget *feedbackBox,
-                                    const BlxSequence *seq, 
+                                    const BlxSequence *seq,
                                     const int numSeqsSelected)
 {
   string resultString("");
-  
+
   /* Find the sequence name text (or some default text to indicate that a sequence is not selected) */
   const char *noSeqText = numSeqsSelected > 0 ? MULTIPLE_SUBJECTS_SELECTED_TEXT : NO_SUBJECT_SELECTED_TEXT;
 
@@ -1353,7 +1354,7 @@ static void feedbackBoxSetMatchName(GtkWidget *feedbackBox,
 
       if (seqName)
         resultString += seqName;
-        
+
       /* For variations, also include the variation data in the name box */
       if (seq->type == BLXSEQUENCE_VARIATION && sequence)
         {
@@ -1376,7 +1377,7 @@ static void feedbackBoxSetDepth(GtkWidget *feedbackBox,
 {
   BlxContext *bc = detailViewGetContext(detailView);
   const BlxStrand strand = bc->activeStrand();
-  
+
   if (detailViewGetSelectedIdxRangeSet(detailView))
     {
       /* A range of coordinates is selected. Sum the read depth over the range. */
@@ -1417,7 +1418,7 @@ static void feedbackBoxSetDepth(GtkWidget *feedbackBox,
 
           /* Always show ACGT, even if 0, for consistency. We could change this however we like,
            * e.g. it might be good to show them in descending order */
-          tmp_ss << "\nA: " << depth_a << "\nC: " << depth_c 
+          tmp_ss << "\nA: " << depth_a << "\nC: " << depth_c
                  << "\nG: " << depth_g << "\nT: " << depth_t;
 
           /* Only show N, Gaps and Unknown if they are non-zero because most of the time they're
@@ -1444,9 +1445,9 @@ static void feedbackBoxSetDepth(GtkWidget *feedbackBox,
 
 /* Set the text displayed in the user feedback boxes based on the given MSPs sequence name
  * (if an MSP is given), and also the currently-selected base index (if there is one). */
-static void setFeedbackText(GtkWidget *detailView, 
-                            const BlxSequence *seq, 
-                            const int numSeqsSelected, 
+static void setFeedbackText(GtkWidget *detailView,
+                            const BlxSequence *seq,
+                            const int numSeqsSelected,
                             GtkWidget *feedbackBox)
 {
   DEBUG_ENTER("setFeedbackText()");
@@ -1458,13 +1459,13 @@ static void setFeedbackText(GtkWidget *detailView,
   feedbackBoxSetMatchName(feedbackBox, seq, numSeqsSelected) ;
   feedbackBoxSetMatchCoord(feedbackBox, detailView, seq) ; // also sets match length
   feedbackBoxSetDepth(feedbackBox, detailView, seq) ;
-  
+
   DEBUG_EXIT("setFeedbackText returning ");
 }
 
 
-/* Updates the feedback box with info about any currently-selected MSPs. This 
- * currently assumes single-MSP selections, but could be extended in the future 
+/* Updates the feedback box with info about any currently-selected MSPs. This
+ * currently assumes single-MSP selections, but could be extended in the future
  * to display, say, summary information about multiple MSPs. */
 void updateFeedbackBox(GtkWidget *detailView)
 {
@@ -1476,17 +1477,17 @@ void updateFeedbackBox(GtkWidget *detailView)
 
   /* currently we only properly handle single sequence selection so only pass the sequence if 1
    * and only 1 sequence is selected */
-  if (numSeqsSelected == 1) 
+  if (numSeqsSelected == 1)
     {
       seq = (const BlxSequence*)(bc->selectedSeqs->data);
     }
-  
+
   GtkWidget *feedbackBox = detailViewGetFeedbackBox(detailView);
 
   setFeedbackText(detailView, seq, numSeqsSelected, feedbackBox);
 
   gtk_widget_queue_draw(feedbackBox);
-  
+
   DEBUG_EXIT("updateFeedbackBox returning ");
 }
 
@@ -1501,7 +1502,7 @@ void clearFeedbackArea(GtkWidget *detailView)
   if (properties)
     {
       GtkStatusbar *statusBar = GTK_STATUSBAR(properties->statusBar);
-      
+
       if (statusBar)
         {
           guint contextId = gtk_statusbar_get_context_id(GTK_STATUSBAR(statusBar), DETAIL_VIEW_STATUSBAR_CONTEXT);
@@ -1521,28 +1522,28 @@ void updateFeedbackAreaNucleotide(GtkWidget *detailView, const int dnaIdx, const
 
   /* First clear the existing message if there is one */
   GtkStatusbar *statusBar = GTK_STATUSBAR(properties->statusBar);
-  
+
   if (statusBar)
     {
       guint contextId = gtk_statusbar_get_context_id(GTK_STATUSBAR(statusBar), DETAIL_VIEW_STATUSBAR_CONTEXT);
       gtk_statusbar_pop(GTK_STATUSBAR(statusBar), contextId);
-      
+
       /* See if there's a variation at the given coord */
       const MSP *msp = NULL;
-      
+
       gboolean multiple = FALSE;
-      
+
       if (coordAffectedByVariation(dnaIdx, strand, bc, &msp, NULL, NULL, NULL, NULL, &multiple))
         {
           if (msp && mspGetSName(msp))
             {
               char *displayText = NULL;
-              
+
               /* If we're displaying coords negated, negate it now */
               int coord = (negateCoords(bc) ? -1 * dnaIdx : dnaIdx);
 
               /* If there are multiple variations on this coord, display some summary text.
-               * Otherwise, check we've got the sequence info to display. We should have, but 
+               * Otherwise, check we've got the sequence info to display. We should have, but
                * if not just display the name. */
               if (multiple)
                 displayText = g_strdup_printf("%d  %s", coord, MULTIPLE_VARIATIONS_TEXT);
@@ -1550,7 +1551,7 @@ void updateFeedbackAreaNucleotide(GtkWidget *detailView, const int dnaIdx, const
                 displayText = g_strdup_printf("%d  %s : %s", coord, mspGetSName(msp), mspGetMatchSeq(msp));
               else
                 displayText = g_strdup_printf("%d  %s", coord, mspGetSName(msp));
-              
+
               /* Send the message to the status bar */
               gtk_statusbar_push(GTK_STATUSBAR(statusBar), contextId, displayText);
               g_free(displayText);
@@ -1577,7 +1578,7 @@ void updateFeedbackAreaNucleotide(GtkWidget *detailView, const int dnaIdx, const
               else
                 displayText = g_strdup_printf("%d %s: %d,%d", coord, "polyA signal", msp->qRange.min(), msp->qRange.max());
             }
-              
+
           /* Send the message to the status bar */
           gtk_statusbar_push(GTK_STATUSBAR(statusBar), contextId, displayText);
           g_free(displayText);
@@ -1603,7 +1604,7 @@ void updateFeedbackAreaNucleotide(GtkWidget *detailView, const int dnaIdx, const
               else
                 displayText = g_strdup_printf("%d %s: %d,%d", coord, "polyA site", msp->qRange.min(), msp->qRange.max());
             }
-              
+
           /* Send the message to the status bar */
           gtk_statusbar_push(GTK_STATUSBAR(statusBar), contextId, displayText);
           g_free(displayText);
@@ -1619,7 +1620,7 @@ void detailViewScrollToKeepInRange(GtkWidget *detailView, const IntRange* const
 
   IntRange *displayRange = detailViewGetDisplayRange(detailView);
   const BlxSeqType seqType = detailViewGetSeqType(detailView);
-      
+
   if (displayRange->min() < range->min())
     {
       setDetailViewStartIdx(detailView, range->min(), seqType);
@@ -1634,7 +1635,7 @@ void detailViewScrollToKeepInRange(GtkWidget *detailView, const IntRange* const
 
 
 /* If the selected base index is outside the current display range, scroll to
- * keep it in range. We scroll by the minimum number of bases possible if 
+ * keep it in range. We scroll by the minimum number of bases possible if
  * scrollMinimum is true; otherwise we re-centre on the selection. */
 static void scrollToKeepSelectionInRange(GtkWidget *detailView, const gboolean scrollMinimum)
 {
@@ -1647,7 +1648,7 @@ static void scrollToKeepSelectionInRange(GtkWidget *detailView, const gboolean s
   if (selectedBaseSet && !valueWithinRange(selectedBaseIdx, displayRange))
     {
       const BlxSeqType seqType = detailViewGetSeqType(detailView);
-      
+
       if (scrollMinimum)
         {
           if (selectedBaseIdx < displayRange->min())
@@ -1670,7 +1671,7 @@ static void scrollToKeepSelectionInRange(GtkWidget *detailView, const gboolean s
 }
 
 
-/* This is called when the Squash matches option has been toggled. It switches to the condensed 
+/* This is called when the Squash matches option has been toggled. It switches to the condensed
  * view of the trees (where multiple MSPs in the same sequence appear on the same row) if squash
  * is true, or reverts to the expanded version (where each MSP has its own row) if squash is false. */
 void detailViewUpdateSquashMatches(GtkWidget *detailView, const gboolean squash)
@@ -1678,7 +1679,7 @@ void detailViewUpdateSquashMatches(GtkWidget *detailView, const gboolean squash)
   DEBUG_ENTER("detailViewUpdateSquashMatches()");
 
   BlxContext *bc = detailViewGetContext(detailView);
-  
+
   if (squash && bc->modelId != BLXMODEL_SQUASHED)
     {
       /* Set the "squashed" model to be active */
@@ -1703,13 +1704,13 @@ void detailViewUpdateSquashMatches(GtkWidget *detailView, const gboolean squash)
 static gint sortByGroupCompareFunc(const MSP *msp1, const MSP *msp2, GtkWidget *blxWindow)
 {
   gint result = 0;
-  
+
   /* Get the order number out of the group and sort on that. If the sequence
    * is not in a group, its order number is UNSET_INT, and it gets sorted after
    * any sequences that are in groups. */
   const int msp1Order = sequenceGetGroupOrder(blxWindow, msp1->sSequence);
   const int msp2Order = sequenceGetGroupOrder(blxWindow, msp2->sSequence);
-  
+
   if (msp1Order == UNSET_INT && msp2Order != UNSET_INT)
     {
       result = 1;
@@ -1726,7 +1727,7 @@ static gint sortByGroupCompareFunc(const MSP *msp1, const MSP *msp2, GtkWidget *
   return result;
 }
 
-/* Sort comparison function for sorting by the start position on the 
+/* Sort comparison function for sorting by the start position on the
  * reference sequence. (Does a secondary sort by the alignment length) */
 static gint sortByStartCompareFunc(const MSP *msp1, const MSP *msp2, const gboolean displayRev)
 {
@@ -1738,14 +1739,14 @@ static gint sortByStartCompareFunc(const MSP *msp1, const MSP *msp2, const gbool
        * and look for the max */
       result = msp2->qRange.max() - msp1->qRange.max();
     }
-  else 
+  else
     {
       result = msp1->qRange.min() - msp2->qRange.min();
     }
-  
+
   if (result == 0)
     {
-      /* If the MSPs have the same start coord, do a secondary sort 
+      /* If the MSPs have the same start coord, do a secondary sort
        * by alignment length */
       result = msp1->qRange.length() - msp2->qRange.length();
     }
@@ -1757,16 +1758,16 @@ static gint sortByStartCompareFunc(const MSP *msp1, const MSP *msp2, const gbool
 static gint sortByDoubleCompareFunc(const MSP *msp1, const MSP *msp2)
 {
   gint result = 0;
-  
+
   gdouble dResult = msp1->id - msp2->id;
-  
+
   if (dResult == 0)
     result = 0;
   else if (dResult > 0)
     result = 1;
-  else 
+  else
     result = -1;
-  
+
   return result;
 }
 
@@ -1813,7 +1814,7 @@ static int sortByStringCompareFunc(const char *str1, const char *str2)
       const int len = min(strlen(str1), strlen(str2));
       result = g_ascii_strncasecmp(str1, str2, len);
     }
-  
+
   return result;
 }
 
@@ -1832,7 +1833,7 @@ static GtkSortType getColumnSortOrder(BlxContext *bc, const BlxColumnId columnId
       case BLXCOL_ID:
         result = GTK_SORT_DESCENDING;
         break;
-        
+
       default: /* all others ascending */
         break;
     };
@@ -1856,11 +1857,11 @@ static gboolean mspIsSortable(const MSP* const msp)
 /* Sort comparison function for sorting by a particular column of the tree view. */
 gint sortByColumnCompareFunc(GList *mspGList1,
                              GList *mspGList2,
-                             GtkWidget *detailView, 
+                             GtkWidget *detailView,
                              const BlxColumnId sortColumn)
 {
   gint result = 0;
-  
+
   /* Get the first MSP in each list. */
   MSP *msp1 = mspGList1 ? (MSP*)(mspGList1->data) : NULL;
   MSP *msp2 = mspGList2 ? (MSP*)(mspGList2->data) : NULL;
@@ -1876,9 +1877,9 @@ gint sortByColumnCompareFunc(GList *mspGList1,
   /* Check whether either row has more than one MSP. If so, it means some options
    * aren't applicable (\to do: unless they're short reads, which should be identical if
    * they're in the same row, so we can treat those as singular). */
-  const gboolean multipleMsps = 
+  const gboolean multipleMsps =
     (g_list_length(mspGList1) > 1 || g_list_length(mspGList2) > 1);
-  
+
   BlxContext *bc = detailViewGetContext(detailView);
   gboolean displayRev = bc->displayRev;
 
@@ -1887,26 +1888,26 @@ gint sortByColumnCompareFunc(GList *mspGList1,
     case BLXCOL_NONE:
       result = 0;
       break;
-      
+
     case BLXCOL_SCORE:
       result = multipleMsps ? 0 : (int)(msp1->score - msp2->score);
       break;
-      
+
     case BLXCOL_ID:
       result = multipleMsps ? 0 : sortByDoubleCompareFunc(msp1, msp2);
       break;
-      
+
     case BLXCOL_START:
       if (multipleMsps)
         result = sortByStartCompareFuncMultiple(mspGList1, mspGList2, msp1->qStrand == BLXSTRAND_FORWARD, msp2->qStrand == BLXSTRAND_FORWARD, displayRev);
       else
         result = sortByStartCompareFunc(msp1, msp2, displayRev);
       break;
-      
+
     case BLXCOL_GROUP:
       result = sortByGroupCompareFunc(msp1, msp2, detailViewGetBlxWindow(detailView));
       break;
-      
+
     default:
       /* Generic string column */
       result = sortByStringCompareFunc(mspGetColumn(msp1, sortColumn), mspGetColumn(msp2, sortColumn));
@@ -1918,7 +1919,7 @@ gint sortByColumnCompareFunc(GList *mspGList1,
     {
       result *= -1;
     }
-  
+
   return result;
 }
 
@@ -1926,9 +1927,9 @@ gint sortByColumnCompareFunc(GList *mspGList1,
 /* This is the main sort comparison function for comparing two BlxSequences.
  * The sort criteria are specified in the detailView properties;
  * we may sort by multiple columns.
- * 
+ *
  * Returns a negative value if the first row appears before the second,
- * positive if the second appears before the first, or 0 if they are 
+ * positive if the second appears before the first, or 0 if they are
  * equivalent. */
 static gint detailViewSortByColumns(gconstpointer a, gconstpointer b)
 {
@@ -1944,7 +1945,7 @@ static gint detailViewSortByColumns(gconstpointer a, gconstpointer b)
 
   /* Sort by each requested column in order of priority */
   BlxColumnId *sortColumns = detailViewGetSortColumns(detailView);
-  
+
   if (sortColumns)
     {
       int priority = 0;
@@ -1952,7 +1953,7 @@ static gint detailViewSortByColumns(gconstpointer a, gconstpointer b)
       for ( ; priority < numColumns; ++priority)
         {
           BlxColumnId sortColumn = sortColumns[priority];
-        
+
           /* NONE indicates an unused entry in the priority array; if we reach
            * an unset value, there should be no more values after it */
           if (sortColumn == BLXCOL_NONE)
@@ -1961,16 +1962,16 @@ static gint detailViewSortByColumns(gconstpointer a, gconstpointer b)
           /* Extract the MSPs for the two rows that we're comparing */
           GList *mspGList1 = seq1->mspList;
           GList *mspGList2 = seq2->mspList;
-  
+
           /* Do the comparison on this column */
           result = sortByColumnCompareFunc(mspGList1, mspGList2, detailView, sortColumn);
-          
+
           /* If rows are equal, continue to sort; otherwise we're done */
           if (result != 0)
             break;
         }
     }
-  
+
   return result;
 }
 
@@ -2013,7 +2014,7 @@ void detailViewUpdateShowSnpTrack(GtkWidget *detailView, const gboolean showSnpT
   refreshDetailViewHeaders(detailView);
   callFuncOnAllDetailViewTrees(detailView, refreshTreeHeaders, NULL);
   detailViewRedrawAll(detailView);
-  
+
   refreshDialog(BLXDIALOG_SETTINGS, detailViewGetBlxWindow(detailView));
 
   DEBUG_EXIT("detailViewUpdateShowSnpTrack returning ");
@@ -2029,15 +2030,15 @@ void detailViewUpdateMspLengths(GtkWidget *detailView, const int numUnalignedBas
 
   /* Re-calculate the full extent of all MSPs, and the max msp length */
   setMaxMspLen(0);
-  
+
   BlxContext *bc = detailViewGetContext(detailView);
   MSP *msp = bc->mspList;
-  
+
   for ( ; msp; msp = msp->next)
     {
       mspCalculateFullExtents(msp, bc, numUnalignedBases);
     }
-  
+
   /* Do a full re-sort and re-filter because the lengths of the displayed match
    * sequences may have changed (and we need to make sure they're sorted by start pos) */
   detailViewResortTrees(detailView);
@@ -2064,16 +2065,16 @@ void detailViewSetNumUnalignedBases(GtkWidget *detailView, const int numBases)
 int getBaseIndexAtColCoords(const int x, const int y, const gdouble charWidth, const IntRange* const displayRange)
 {
   int result = UNSET_INT;
-  
+
   const int leftEdge = 0; /* to do: allow for padding? check upper bound? */
-  
+
   if (x > leftEdge)
     {
       result = (int)(((gdouble)x - leftEdge) / charWidth);
     }
-  
+
   result += displayRange->min();
-  
+
   return result;
 }
 
@@ -2083,27 +2084,27 @@ int getBaseIndexAtColCoords(const int x, const int y, const gdouble charWidth, c
 static void getSeqColHeaderClickedNucleotide(GtkWidget *header, GtkWidget *detailView, const int x, const int y, int *coordOut, int *frameOut, int *baseOut)
 {
   int coord = getBaseIndexAtColCoords(x, y, detailViewGetCharWidth(detailView), detailViewGetDisplayRange(detailView));
-  
+
   if (coord != UNSET_INT)
-    {   
+    {
       /* Get the base number of the clicked base within the active frame. The
-       * base number is determined by which row in the header the mouse pointer 
+       * base number is determined by which row in the header the mouse pointer
        * is over: for frame 1, row 1 will give base 1; for frame 2, row 2 will
        * give base 1, etc. Start by getting the frame number for the clicked row: */
       int frame = detailViewGetActiveFrame(detailView);
       int row = seqColHeaderGetRow(header);
       const int numFrames = detailViewGetNumFrames(detailView);
-      
+
       /* The header widget passed to this function is the originally-clicked widget.
        * If the pointer has dragged onto another row in the header, we can work out
-       * which one based on the y coord. If it is outside altogether, take the 
-       * topmost/bottommost row. (NB this assumes all rows in the header have the 
+       * which one based on the y coord. If it is outside altogether, take the
+       * topmost/bottommost row. (NB this assumes all rows in the header have the
        * same height as this one - should be true because they're just simple labels). */
       if (y < 0 || y > header->allocation.height)
         {
           const int offsetRows = floor((double)y / (double)header->allocation.height); /* can be negative */
           row += offsetRows;
-          
+
           if (row < 1)
             {
               row = 1;
@@ -2113,23 +2114,23 @@ static void getSeqColHeaderClickedNucleotide(GtkWidget *header, GtkWidget *detai
               row = numFrames;
             }
         }
-      
+
       /* Calculate the base number based on the row and the currently-active frame */
       int baseNum = row - frame + 1;
-      
+
       if (baseNum < 1)
         {
           /* Cycle round if gone below the min base number */
           baseNum += numFrames;
           --coord;
         }
-      
+
       if (coordOut)
         *coordOut = coord;
-      
+
       if (frameOut)
         *frameOut = frame;
-      
+
       if (baseOut)
         *baseOut = baseNum;
     }
@@ -2143,15 +2144,15 @@ static void selectClickedNucleotide(GtkWidget *header, GtkWidget *detailView, co
 
   int coord, frame, baseNum;
   getSeqColHeaderClickedNucleotide(header, detailView, x, y, &coord, &frame, &baseNum);
-  
+
   detailViewSetSelectedDisplayIdx(detailView, coord, frame, baseNum, FALSE, TRUE, extend);
 
   DEBUG_EXIT("selectClickedNucleotide returning ");
 }
 
 
-/* If the user clicked on a SNP in the SNP header, select it. This updates the 
- * feedback box with the SNP name and coord, selects the SNP coord and recentres 
+/* If the user clicked on a SNP in the SNP header, select it. This updates the
+ * feedback box with the SNP name and coord, selects the SNP coord and recentres
  * on it (if allowScroll is true), clearing any previous selections. If expandSnps
  * is true it means that the SNPs are drawn full-width (i.e. showing all the sequence
  * in the MSP) and we should take into account when clicking; otherwise, the SNP
@@ -2162,9 +2163,9 @@ static void selectClickedNucleotide(GtkWidget *header, GtkWidget *detailView, co
  * widget is not the same width of the sequence column, the coords will need converting). */
 void selectClickedSnp(GtkWidget *snpTrack,
                       GtkWidget *colHeader,
-                      GtkWidget *detailView, 
-                      const int xIn, 
-                      const int yIn, 
+                      GtkWidget *detailView,
+                      const int xIn,
+                      const int yIn,
                       const gboolean expandSnps,
                       const int clickedBase)
 {
@@ -2174,10 +2175,10 @@ void selectClickedSnp(GtkWidget *snpTrack,
   GtkWidget *blxWindow = detailViewGetBlxWindow(detailView);
   BlxContext *bc = blxWindowGetContext(blxWindow);
   const int activeFrame = detailViewGetActiveFrame(detailView);
-  
+
   /* Convert x coord to sequence-column coords */
   int x = xIn, y = yIn;
-  
+
   if (colHeader)
     {
       gtk_widget_translate_coordinates(snpTrack, colHeader, xIn, 0, &x, NULL);
@@ -2197,18 +2198,18 @@ void selectClickedSnp(GtkWidget *snpTrack,
       GSList *rows = NULL;
       int i = 0;
       const MSP *msp = mspArrayIdx(bc->featureLists[BLXMSP_VARIATION], i);
-      
+
       for ( ; msp; msp = mspArrayIdx(bc->featureLists[BLXMSP_VARIATION], ++i))
         {
           /* Get the variation coords in terms of display coords, and also the 'expanded' range
            * of coords where the variation is displayed */
           IntRange mspExpandedRange;
           getVariationDisplayRange(msp, expandSnps, bc->seqType, bc->numFrames, bc->displayRev, activeFrame, &bc->refSeqRange, NULL, &mspExpandedRange);
-          
+
           const int clickedDnaIdx = convertDisplayIdxToDnaIdx(clickedDisplayIdx, bc->seqType, 1, clickedBase, bc->numFrames, bc->displayRev, &bc->refSeqRange);
           gboolean found = FALSE;
           int dnaIdxToSelect = UNSET_INT;
-          
+
           /* Get the row this variation is in */
           int mspRow = 1;
           if (expandSnps)
@@ -2228,14 +2229,14 @@ void selectClickedSnp(GtkWidget *snpTrack,
               found = TRUE;
               dnaIdxToSelect = clickedDnaIdx;
             }
-          
+
           if (found)
             {
               snpList = g_list_prepend(snpList, msp->sSequence);
               detailViewSetSelectedDnaBaseIdx(detailView, dnaIdxToSelect, activeFrame, TRUE, FALSE, FALSE);
             }
         }
-      
+
       freeRowsList(rows);
 
       /* Clear any existing selections and select the new SNP(s) */
@@ -2251,33 +2252,33 @@ void selectClickedSnp(GtkWidget *snpTrack,
  ***********************************************************/
 
 /* Draw a vertical separator line at the edges of the given widget */
-void drawColumnSeparatorLine(GtkWidget *widget, 
-                             GdkDrawable *drawable, 
-                             GdkGC *gc, 
+void drawColumnSeparatorLine(GtkWidget *widget,
+                             GdkDrawable *drawable,
+                             GdkGC *gc,
                              const BlxContext *bc)
 {
   const int lineWidth = 1; /* width of the separator lines */
-  
+
   if (GTK_WIDGET_VISIBLE(widget) && widget->allocation.width > lineWidth)
     {
       GdkColor *color = getGdkColor(BLXCOLOR_TREE_GRID_LINES, bc->defaultColors, FALSE, bc->usePrintColors);
       gdk_gc_set_foreground(gc, color);
-      
+
       /* We want dashed lines */
       gdk_gc_set_line_attributes(gc, lineWidth, GDK_LINE_ON_OFF_DASH, GDK_CAP_BUTT, GDK_JOIN_MITER);
-      
+
       /* Make the dashes very short and closely packed (i.e. dash length of 1 pixel and gaps of 1 pixel) */
       int listLen = 1;
       gint8 dashList[listLen];
       dashList[0] = 1;
       gdk_gc_set_dashes(gc, 0, dashList, listLen);
-      
+
       /* Draw vertical lines. Draw the rightmost edge of each widget (because we don't really want a
        * line at the leftmost edge of the first cell of the tree view.) */
       const int x = widget->allocation.x + widget->allocation.width - lineWidth;
       const int y1 = widget->allocation.y;
       const int y2 = y1 + widget->allocation.height;
-      
+
       gdk_draw_line(drawable, gc, x, y1, x, y2);
     }
 }
@@ -2293,7 +2294,7 @@ static void mspGetAdjacentBases(const MSP* const msp, char *bases, const gboolea
       bases[0] = getSequenceIndex(bc->refSeq, msp->qRange.min() - 2, revStrand, &bc->refSeqRange, BLXSEQ_DNA);
       bases[1] = getSequenceIndex(bc->refSeq, msp->qRange.min() - 1, revStrand, &bc->refSeqRange, BLXSEQ_DNA);
       bases[2] = '\0';
-    }  
+    }
   else
     {
       bases[0] = getSequenceIndex(bc->refSeq, msp->qRange.max() + 1, revStrand, &bc->refSeqRange, BLXSEQ_DNA);
@@ -2304,13 +2305,13 @@ static void mspGetAdjacentBases(const MSP* const msp, char *bases, const gboolea
 
 
 /* This function returns the prev/next MSP in the given sequence in order of start position on
- * the ref seq. Returns the next MSP (with the next-highest start coord) if 'getNext' is true; 
+ * the ref seq. Returns the next MSP (with the next-highest start coord) if 'getNext' is true;
  * otherwise returns the previous one. The return value will be NULL if there is no next/prev MSP.
  * The error will be set if there was any problem (e.g. if the given MSP does not exist the the sequence).
  * Only considers exons and matches. */
-static const MSP* sequenceGetNextMsp(const MSP* const msp, 
-                                     const BlxSequence *blxSeq, 
-                                     const gboolean getNext, 
+static const MSP* sequenceGetNextMsp(const MSP* const msp,
+                                     const BlxSequence *blxSeq,
+                                     const gboolean getNext,
                                      GError **error)
 {
   const MSP *result = NULL;
@@ -2318,16 +2319,16 @@ static const MSP* sequenceGetNextMsp(const MSP* const msp,
   GList *mspItem = blxSeq->mspList;
   const MSP *prevMsp = NULL;
   gboolean found = FALSE;
-  
+
   /* Loop through all MSPs and look for the given one. */
   for ( ; mspItem; mspItem = mspItem->next)
     {
       const MSP* const curMsp = (const MSP*)(mspItem->data);
-      
+
       if (curMsp == msp)
         {
           found = TRUE;
-          
+
           /* If looking for the previous MSP, we already know it. */
           if (!getNext)
             {
@@ -2340,7 +2341,7 @@ static const MSP* sequenceGetNextMsp(const MSP* const msp,
               continue;
             }
         }
-      
+
       if (found && getNext)
         {
           /* We've found the input MSP and we're on the next one. See if it is an exon/match,
@@ -2351,29 +2352,29 @@ static const MSP* sequenceGetNextMsp(const MSP* const msp,
               break;
             }
         }
-      
+
       /* Set the previous MSP (but only if it's an exon/match) */
       if (mspIsBoxFeature(curMsp) || mspIsBlastMatch(curMsp))
         {
           prevMsp = curMsp;
         }
     }
-  
+
   if (!found && error)
     {
       g_set_error(error, BLX_ERROR, 1, "The given MSP '%s' was not found in the given sequence '%s'.\n", mspGetSName(msp), blxSequenceGetName(blxSeq));
     }
-  
+
   return result;
 }
 
 
-/* Determine whether the bases at the other end of the intron for the start/end of 
+/* Determine whether the bases at the other end of the intron for the start/end of
  * the given MSP are canonical. 'canonicalStart' and 'canonicalEnd' contain the two bases to look
  * for at the start/end of the next/previous MSP to determine if the result is canonical. */
 static gboolean mspIsSpliceSiteCanonicalOtherEnd(const MSP* const msp,
                                                  const BlxSequence *blxSeq,
-                                                 const gboolean isMinCoord, 
+                                                 const gboolean isMinCoord,
                                                  const gboolean revStrand,
                                                  const gboolean donor,
                                                  const gboolean revcomp,
@@ -2381,17 +2382,17 @@ static gboolean mspIsSpliceSiteCanonicalOtherEnd(const MSP* const msp,
                                                  const BlxSpliceSite *spliceSite)
 {
   gboolean result = FALSE;
- 
-  /* Get the previous MSP if we're looking at the min coord of the current MSP, or 
+
+  /* Get the previous MSP if we're looking at the min coord of the current MSP, or
    * the next MSP if we're at the end */
   const MSP *nextMsp = sequenceGetNextMsp(msp, blxSeq, !isMinCoord, NULL);
-  
+
   if (nextMsp)
     {
       /* Get the two bases at the end of the previous MSP / start of the next MSP */
       char bases[3];
       mspGetAdjacentBases(nextMsp, bases, !isMinCoord, revStrand, bc);
-      
+
       /* If the original site was a donor site, look for an acceptor site (or vice versa) */
       const char *canonicalBases = spliceSiteGetBases(spliceSite, !donor, revStrand, revcomp);
 
@@ -2400,7 +2401,7 @@ static gboolean mspIsSpliceSiteCanonicalOtherEnd(const MSP* const msp,
           result = TRUE;
         }
     }
-  
+
   return result;
 }
 
@@ -2415,7 +2416,7 @@ static void addBlxSpliceSite(GSList **spliceSites, const char *donorSite, const
       g_critical("Error adding splice site info ['%s', '%s'].\n", donorSite, acceptorSite);
       return;
     }
-  
+
   spliceSite->donorSite[0] = donorSite[0];
   spliceSite->donorSite[1] = donorSite[1];
   spliceSite->donorSite[2] = '\0';
@@ -2436,21 +2437,21 @@ static void addBlxSpliceSite(GSList **spliceSites, const char *donorSite, const
   spliceSite->acceptorSite[0] = acceptorSite[0];
   spliceSite->acceptorSite[1] = acceptorSite[1];
   spliceSite->acceptorSite[2] = '\0';
-  
+
   spliceSite->acceptorSiteComp[0] = complementChar(acceptorSite[0], NULL);
   spliceSite->acceptorSiteComp[1] = complementChar(acceptorSite[1], NULL);
   spliceSite->acceptorSiteComp[2] = '\0';
-  
+
   spliceSite->acceptorSiteRev[0] = acceptorSite[1];
   spliceSite->acceptorSiteRev[1] = acceptorSite[0];
   spliceSite->acceptorSiteRev[2] = '\0';
-  
+
   spliceSite->acceptorSiteRevComp[0] = complementChar(acceptorSite[1], NULL);
   spliceSite->acceptorSiteRevComp[1] = complementChar(acceptorSite[0], NULL);
   spliceSite->acceptorSiteRevComp[2] = '\0';
-  
+
   spliceSite->bothReqd = bothReqd;
-  
+
   /* Add it to the list */
   *spliceSites = g_slist_append(*spliceSites, spliceSite);
 }
@@ -2460,7 +2461,7 @@ static void addBlxSpliceSite(GSList **spliceSites, const char *donorSite, const
 static void destroyBlxSpliceSite(gpointer listItemData, gpointer data)
 {
   BlxSpliceSite *spliceSite = (BlxSpliceSite*)listItemData;
-  
+
   delete spliceSite;
 }
 
@@ -2468,9 +2469,9 @@ static void destroyBlxSpliceSite(gpointer listItemData, gpointer data)
 /* Return the canonical bases at the donor/acceptor end of the given BlxSpliceSite. Returns them in
  * reverse order if 'reverse' is true, e.g. for a GC-AG intron, the dono is GC and acceptor is AG.
  * If reverse is true the donor returns CG and acceptor returns GA. The result is a pointer to the
- * string in the splice site, which is owned by the Detail View properties. 
+ * string in the splice site, which is owned by the Detail View properties.
  * If revcomp is true, then revcomp the result and swap whether it's a donor or acceptor. */
-static const char* spliceSiteGetBases(const BlxSpliceSite *spliceSite, 
+static const char* spliceSiteGetBases(const BlxSpliceSite *spliceSite,
                                       const gboolean donor,
                                       const gboolean reverse,
                                       const gboolean revcomp)
@@ -2505,9 +2506,9 @@ static const char* spliceSiteGetBases(const BlxSpliceSite *spliceSite,
  * it were on the other strand (i.e its revcomp is canonical). This is useful for identifying
  * errors in input data (common in BAM, which doesn't have comprehensive representation of all
  * strand combinations). */
-static BlxColorId getMspSpliceSiteColor(const MSP* const msp, 
-                                        const BlxSequence *blxSeq, 
-                                        const gboolean isMinCoord, 
+static BlxColorId getMspSpliceSiteColor(const MSP* const msp,
+                                        const BlxSequence *blxSeq,
+                                        const gboolean isMinCoord,
                                         const gboolean revStrand,
                                         const BlxContext *bc,
                                         GSList *spliceSites)
@@ -2524,8 +2525,8 @@ static BlxColorId getMspSpliceSiteColor(const MSP* const msp,
       /* Get the two adjacent bases at the start/end of the given MSP */
       char bases[3];
       mspGetAdjacentBases(msp, bases, isMinCoord, revStrand, bc);
-      
-      /* The min coord end of the MSP is the acceptor site of the intron and the max coord the 
+
+      /* The min coord end of the MSP is the acceptor site of the intron and the max coord the
        * donor site (or vice versa if the strand is reversed). */
       const gboolean donor = (isMinCoord == revStrand);
       gboolean revcomp = FALSE;
@@ -2591,19 +2592,19 @@ static BlxColorId getMspSpliceSiteColor(const MSP* const msp,
  * splice sites of the adjacent introns. Inserts the results into the given hash table with
  * an enum indicating whether the nucleotides are canonical/non-canonical. Only considers
  * MSPs that are within the given ref seq range. */
-static void mspGetSpliceSiteCoords(const MSP* const msp, 
-                                   const BlxSequence *blxSeq, 
-                                   const IntRange* const qRange, 
-                                   const BlxContext *bc, 
+static void mspGetSpliceSiteCoords(const MSP* const msp,
+                                   const BlxSequence *blxSeq,
+                                   const IntRange* const qRange,
+                                   const BlxContext *bc,
                                    GSList *spliceSites,
                                    GHashTable *result)
 {
   const gboolean revStrand = (mspGetRefStrand(msp) != BLXSTRAND_FORWARD);
-  
+
   /* Ignore the termini (i.e. 5' end of first exon and 3' end of last exon) */
   const gboolean getMin = (msp->sSequence && msp->qRange.min() != blxSequenceGetStart(msp->sSequence, msp->qStrand));
   const gboolean getMax = (msp->sSequence && msp->qRange.max() != blxSequenceGetEnd(msp->sSequence, msp->qStrand));
-  
+
   /* See if the min coord is within the given range */
   if (getMin && valueWithinRange(msp->qRange.min(), qRange) && msp->qRange.min() >= bc->refSeqRange.min() + 2)
     {
@@ -2614,13 +2615,13 @@ static void mspGetSpliceSiteCoords(const MSP* const msp,
       g_hash_table_insert(result, GINT_TO_POINTER(msp->qRange.min() - 2), GINT_TO_POINTER(colorId));
       g_hash_table_insert(result, GINT_TO_POINTER(msp->qRange.min() - 1), GINT_TO_POINTER(colorId));
     }
-  
+
   /* See if the max coord is within the given range */
   if (getMax && valueWithinRange(msp->qRange.max(), qRange) && msp->qRange.max() <= bc->refSeqRange.max() - 2)
     {
       /* Find out if they are canonical/non-canonical */
       BlxColorId colorId = getMspSpliceSiteColor(msp, blxSeq, FALSE, revStrand, bc, spliceSites);
-      
+
       /* Insert the two coords into the hash table */
       g_hash_table_insert(result, GINT_TO_POINTER(msp->qRange.max() + 1), GINT_TO_POINTER(colorId));
       g_hash_table_insert(result, GINT_TO_POINTER(msp->qRange.max() + 2), GINT_TO_POINTER(colorId));
@@ -2648,27 +2649,27 @@ static void getAnnotatedPolyASignalBasesToHighlight(const BlxContext *bc,
       /* Loop through all polyA signals */
       int i = 0;
       const MSP *sigMsp = mspArrayIdx(bc->featureLists[BLXMSP_POLYA_SIGNAL], i);
-      
+
       for ( ; sigMsp; sigMsp = mspArrayIdx(bc->featureLists[BLXMSP_POLYA_SIGNAL], ++i))
         {
           /* Only interested the polyA signal has the correct strand and is within the display range. */
           if (sigMsp->qStrand == qStrand && rangesOverlap(&sigMsp->qRange, qRange))
             {
               gboolean addSignal = FALSE;
-              
+
               if (bc->flags[BLXFLAG_SHOW_POLYA_SIG_SELECTED])
                 {
                   /* We're only interested in polyA signals that are 50 bases upstream of one of our polyA-tail MSPs */
                   GSList *item = polyATailMsps;
-                  
+
                   for ( ; item && !addSignal; item = item->next)
                     {
                       const MSP* const tailMsp = (const MSP*)(item->data);
                       const int qEnd = tailMsp->qRange.max();
                       const int qStart = qEnd - POLYA_SIG_BASES_UPSTREAM;
-                      
+
                       IntRange upstreamRange(qStart, qEnd); /* sorts out which is min and which is max */
-                                        
+
                       addSignal = rangesOverlap(&sigMsp->qRange, &upstreamRange);
                     }
                 }
@@ -2677,7 +2678,7 @@ static void getAnnotatedPolyASignalBasesToHighlight(const BlxContext *bc,
                   /* Add all signals that are in the display range */
                   addSignal = TRUE;
                 }
-            
+
               if (addSignal)
                 {
                   /* Add each base in the polyA signal range to the hash table. This may overwrite
@@ -2761,7 +2762,7 @@ static void getAnnotatedPolyASiteBasesToHighlight(const BlxContext *bc,
       /* Loop through all polyA signals */
       int i = 0;
       const MSP *siteMsp = mspArrayIdx(bc->featureLists[BLXMSP_POLYA_SITE], i);
-      
+
       for ( ; siteMsp; siteMsp = mspArrayIdx(bc->featureLists[BLXMSP_POLYA_SITE], ++i))
         {
           /* Only interested the polyA site has the correct strand and is within the display range. */
@@ -2779,8 +2780,8 @@ static void getAnnotatedPolyASiteBasesToHighlight(const BlxContext *bc,
 /* This function looks for special bases in the reference sequence header to highlight and stores their
  * coords in the returned hash table with the BlxColorId (converted to a gpointer with GINT_TO_POINTER)
  * of the fill color they should be drawn with. These special coords include splice sites and polyA signals. */
-GHashTable* getRefSeqBasesToHighlight(GtkWidget *detailView, 
-                                      const IntRange* const qRange, 
+GHashTable* getRefSeqBasesToHighlight(GtkWidget *detailView,
+                                      const IntRange* const qRange,
                                       const BlxSeqType seqType,
                                       const BlxStrand qStrand)
 {
@@ -2788,44 +2789,44 @@ GHashTable* getRefSeqBasesToHighlight(GtkWidget *detailView,
 
   GtkWidget *blxWindow = detailViewGetBlxWindow(detailView);
   const BlxContext *bc = blxWindowGetContext(blxWindow);
-  
+
   /* We only highlight nucleotides, so there is nothing to do if we're showing a peptide sequence,
    * or if the show-splice-sites or show-polyA-signals options are disabled. */
-  if (seqType == BLXSEQ_PEPTIDE || 
+  if (seqType == BLXSEQ_PEPTIDE ||
       (!bc->flags[BLXFLAG_SHOW_SPLICE_SITES] && !bc->flags[BLXFLAG_SHOW_POLYA_SIG]))
     {
       return result;
     }
-  
-  /* Loop through the selected sequences. If showing polyA signals for selected sequences, we'll 
+
+  /* Loop through the selected sequences. If showing polyA signals for selected sequences, we'll
    * compile a list of MSPs we're interested in seeing polyA signals for (i.e. those with polyA tails) */
   DetailViewProperties *properties = detailViewGetProperties(detailView);
   GList *seqItem = blxWindowGetSelectedSeqs(blxWindow);
   GSList *polyATailMsps = NULL;
-  
+
   for ( ; seqItem; seqItem = seqItem->next)
     {
       const BlxSequence *blxSeq = (const BlxSequence*)(seqItem->data);
       GList *mspItem = blxSeq->mspList;
-     
-      /* Loop through all MSPs for this sequence */ 
+
+      /* Loop through all MSPs for this sequence */
       for ( ; mspItem; mspItem = mspItem->next)
         {
           MSP *msp = (MSP*)(mspItem->data);
-          
+
           /* Only look at matches/exons on the correct strand */
-          if ((mspIsBlastMatch(msp) || msp->type == BLXMSP_EXON || msp->type == BLXMSP_BASIC) && 
+          if ((mspIsBlastMatch(msp) || msp->type == BLXMSP_EXON || msp->type == BLXMSP_BASIC) &&
               mspGetRefStrand(msp) == qStrand)
             {
               if (bc->flags[BLXFLAG_SHOW_SPLICE_SITES])
                 mspGetSpliceSiteCoords(msp, blxSeq, qRange, bc, properties->spliceSites, result);
-              
+
               if (bc->flags[BLXFLAG_SHOW_POLYA_SIG] && mspHasPolyATail(msp))
                 polyATailMsps = g_slist_append(polyATailMsps, msp);
             }
         }
     }
-  
+
   /* Now check the polyA signals and sites and see if any of them are in range. */
   getPolyASignalBasesToHighlight(detailView, bc, polyATailMsps, qRange, result);
   getAnnotatedPolyASignalBasesToHighlight(bc, polyATailMsps, qStrand, qRange, result);
@@ -2838,27 +2839,27 @@ GHashTable* getRefSeqBasesToHighlight(GtkWidget *detailView,
 static void drawDnaTrack(GtkWidget *dnaTrack, GtkWidget *detailView, const BlxStrand strand, const int frame)
 {
   GdkDrawable *drawable = createBlankPixmap(dnaTrack);
-  
+
   GtkWidget *blxWindow = detailViewGetBlxWindow(detailView);
   BlxContext *bc = blxWindowGetContext(blxWindow);
-  
+
   /* Find the segment of the ref sequence to display (complemented if this tree is
    * displaying the reverse strand, and reversed if the display is toggled). Ref seq
    * coords are in nucleotides, so convert display range to nucleotide coords. */
   IntRange *displayRange = detailViewGetDisplayRange(detailView);
-  
+
   const int qIdx1 = convertDisplayIdxToDnaIdx(displayRange->min(), bc->seqType, frame, 1, bc->numFrames, bc->displayRev, &bc->refSeqRange);         /* 1st base in frame */
   const int qIdx2 = convertDisplayIdxToDnaIdx(displayRange->max(), bc->seqType, frame, bc->numFrames, bc->numFrames, bc->displayRev, &bc->refSeqRange); /* last base in frame */
   IntRange qRange = {min(qIdx1, qIdx2), max(qIdx1, qIdx2)};
-  
+
   GError *error = NULL;
-  
+
   gchar *segmentToDisplay = getSequenceSegment(bc->refSeq,
                                                &qRange,
-                                               strand, 
+                                               strand,
                                                BLXSEQ_DNA,      /* ref seq is always in nucleotide coords */
                                                BLXSEQ_DNA,      /* required segment is in nucleotide coords */
-                                               frame, 
+                                               frame,
                                                bc->numFrames,
                                                &bc->refSeqRange,
                                                bc->blastMode,
@@ -2867,7 +2868,7 @@ static void drawDnaTrack(GtkWidget *dnaTrack, GtkWidget *detailView, const BlxSt
                                                bc->displayRev,
                                                bc->displayRev,
                                                &error);
-  
+
   if (!segmentToDisplay)
     {
       g_assert(error);
@@ -2880,26 +2881,26 @@ static void drawDnaTrack(GtkWidget *dnaTrack, GtkWidget *detailView, const BlxSt
       /* If there's an error but the sequence was still returned it's a non-critical warning */
       reportAndClearIfError(&error, G_LOG_LEVEL_WARNING);
     }
-    
-    
+
+
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   DetailViewProperties *properties = detailViewGetProperties(detailView);
   const int activeFrame = detailViewGetActiveFrame(detailView);
   const BlxStrand activeStrand = blxWindowGetActiveStrand(blxWindow);
   const gboolean highlightSnps = bc->flags[BLXFLAG_HIGHLIGHT_VARIATIONS];
 
   gtk_layout_set_size(GTK_LAYOUT(dnaTrack), dnaTrack->allocation.width, roundNearest(properties->charHeight()));
-  
+
   /* Find out if there are any bases in the introns that need highlighting. */
   GHashTable *basesToHighlight = getRefSeqBasesToHighlight(detailView, &qRange, BLXSEQ_DNA, activeStrand);
-  
+
   /* We'll loop forward/backward through the display range depending on which strand we're viewing */
   int incrementValue = bc->displayRev ? -bc->numFrames : bc->numFrames;
   int displayLen = qRange.length();
   char displayText[displayLen + 1];
   int displayTextPos = 0;
-  
+
   int qIdx = bc->displayRev ? qRange.max() : qRange.min();
   int displayIdx = convertDnaIdxToDisplayIdx(qIdx, bc->seqType, activeFrame, bc->numFrames, bc->displayRev, &bc->refSeqRange, NULL);
   const int y = 0;
@@ -2922,13 +2923,13 @@ static void drawDnaTrack(GtkWidget *dnaTrack, GtkWidget *detailView, const BlxSt
                            FALSE,
                            FALSE,
                            detailViewGetSelectedDnaIdxRange(detailView)};
-  
+
   while (qIdx >= qRange.min() && qIdx <= qRange.max())
     {
       /* Get the character to display at this index, and its position */
       displayText[displayTextPos] = getSequenceIndex(bc->refSeq, qIdx, bc->displayRev, &bc->refSeqRange, BLXSEQ_DNA);
       const int x = (int)((gdouble)displayTextPos * properties->charWidth());
-      
+
       baseData.dnaIdx = qIdx;
       baseData.baseChar = displayText[displayTextPos];
       baseData.displayIdxSelected = detailViewIsDisplayIdxSelected(detailView, displayIdx);
@@ -2936,44 +2937,44 @@ static void drawDnaTrack(GtkWidget *dnaTrack, GtkWidget *detailView, const BlxSt
 
       /* Color the base depending on whether it is selected or affected by a SNP */
       drawHeaderChar(bc, properties, drawable, gc, x, y, basesToHighlight, &baseData);
-      
+
       /* Increment indices */
       ++displayTextPos;
       ++displayIdx;
       qIdx += incrementValue;
     }
-  
+
   /* Make sure the string is terminated properly */
   displayText[displayTextPos] = '\0';
-  
+
   /* Draw the text */
   PangoLayout *layout = gtk_widget_create_pango_layout(detailView, displayText);
   pango_layout_set_font_description(layout, detailViewGetFontDesc(detailView));
-  
+
   if (layout)
     {
       gtk_paint_layout(dnaTrack->style, drawable, GTK_STATE_NORMAL, TRUE, NULL, detailView, NULL, 0, 0, layout);
       g_object_unref(layout);
     }
-  
+
   drawColumnSeparatorLine(dnaTrack, drawable, gc, bc);
-  
+
   g_hash_table_unref(basesToHighlight);
   g_free(segmentToDisplay);
   g_object_unref(gc);
 }
 
 
-/* Utility to find the display coord(s) that a variation lies on. If expand is true, 
- * it means that if the variation contains more than one alternative, and these will be 
- * displayed horizontally across the display, taking up more width than where 
- * the actual variation coords lie. expandedRange will take this into account. displayRange 
+/* Utility to find the display coord(s) that a variation lies on. If expand is true,
+ * it means that if the variation contains more than one alternative, and these will be
+ * displayed horizontally across the display, taking up more width than where
+ * the actual variation coords lie. expandedRange will take this into account. displayRange
  * always returns the actual msp start/end in display coords. */
-static void getVariationDisplayRange(const MSP *msp, 
+static void getVariationDisplayRange(const MSP *msp,
                                      const gboolean expand,
-                                     const BlxSeqType seqType, 
+                                     const BlxSeqType seqType,
                                      const int numFrames,
-                                     const gboolean displayRev, 
+                                     const gboolean displayRev,
                                      const int activeFrame,
                                      const IntRange* const refSeqRange,
                                      IntRange *displayRange,
@@ -2985,35 +2986,35 @@ static void getVariationDisplayRange(const MSP *msp,
 
   if (displayRange)
     displayRange->set(mspRange);
-  
+
   if (!expandedRange)
     return;
 
   /* Work out the expanded range (it will be the same as the MSP range if unexpanded) */
   expandedRange->set(mspRange);
-  
+
   if (expand && mspGetMatchSeq(msp))
     {
-      /* Expand the variation range so that we display its entire sequence. We'll 
+      /* Expand the variation range so that we display its entire sequence. We'll
        * position the variation so that the middle of its sequence lies at the centre
        * coord of its ref seq range */
       const int numChars = strlen(mspGetMatchSeq(msp));
 
       int offset = (int)((double)numChars / 2.0);
-  
+
       if (numChars % 2 == 0)
         {
           /* Shift to the right by one if we've got an even number of chars */
           --offset;
         }
-  
+
       expandedRange->setMin(expandedRange->centre() - offset);
       expandedRange->setMax(expandedRange->min() + numChars - 1); // uses updated min
     }
 }
 
 
-/* Utility that returns true if the given bool is either true or not 
+/* Utility that returns true if the given bool is either true or not
  * requested (i.e. the pointer is null) */
 static gboolean trueOrNotRequested(const gboolean* const ptr)
 {
@@ -3028,21 +3029,21 @@ static gboolean trueOrNotRequested(const gboolean* const ptr)
  * is part of a selected variation). Sets multipleVariations to true if there is more than
  * one variation at this coord */
 static gboolean coordAffectedByVariation(const int dnaIdx,
-                                         const BlxStrand strand, 
+                                         const BlxStrand strand,
                                          BlxContext *bc,
                                          const MSP **mspOut, /* the variation we found */
-                                         gboolean *drawStartBoundary, 
-                                         gboolean *drawEndBoundary, 
-                                         gboolean *drawJoiningLines, 
+                                         gboolean *drawStartBoundary,
+                                         gboolean *drawEndBoundary,
+                                         gboolean *drawJoiningLines,
                                          gboolean *drawBackground,
                                          gboolean *multipleVariations)
 {
   gboolean result = FALSE;
-  
+
   /* Loop through all variations */
   int i = 0;
   const MSP *msp = mspArrayIdx(bc->featureLists[BLXMSP_VARIATION], i);
-  
+
   for ( ; msp; msp = mspArrayIdx(bc->featureLists[BLXMSP_VARIATION], ++i))
     {
       if (mspGetRefStrand(msp) == strand && valueWithinRange(dnaIdx, &msp->qRange))
@@ -3052,11 +3053,11 @@ static gboolean coordAffectedByVariation(const int dnaIdx,
             *multipleVariations = TRUE;
 
           result = TRUE;
-          
+
           if (mspOut)
             *mspOut = msp;
-          
-          /* We draw the start boundary of this base if it's the first base in the variation's range 
+
+          /* We draw the start boundary of this base if it's the first base in the variation's range
            * and the end boundary if it's the last, unless it's a zero-length feature, i.e. an insertion
            * site; in this case we draw a line to the right of the coord in the direction of the
            * reference sequence (i.e. to give just a vertical line at the site, not an outline around the bases) */
@@ -3068,35 +3069,35 @@ static gboolean coordAffectedByVariation(const int dnaIdx,
            * found in this loop) then we keep the current value */
           if (drawStartBoundary)
             *drawStartBoundary |= (isZeroLen != bc->displayRev ? isLast : isFirst);
-            
+
           if (drawEndBoundary)
             *drawEndBoundary |= (isZeroLen != bc->displayRev ? isFirst : isLast);
 
           /* Don't draw joining lines between the start and end boundaries if it's zero-length */
           if (drawJoiningLines)
             *drawJoiningLines |= !isZeroLen;
-            
+
           /* Highlight the background if the variation is selected (unless it's a zero-length variation) */
           if (drawBackground)
             *drawBackground |= !isZeroLen && bc->isSeqSelected(msp->sSequence);
-          
+
           /* If we only want to know if this coord is affected by a snp, we can return now.
            *
-           * If we also need the boundary-lines info for this coord, then we need to check 
+           * If we also need the boundary-lines info for this coord, then we need to check
            * all snps that are at this coord, because some may have different boundaries to
            * others. We can break if all boundar-lines have already been set to true, though.
            *
            * If we need to return whether there are multiple snps at this coord, we can return
            * after we've found the second on (i.e. after multipleVariations is set to TRUE). */
           if (trueOrNotRequested(drawStartBoundary) &&
-              trueOrNotRequested(drawEndBoundary) && 
-              trueOrNotRequested(drawJoiningLines) && 
+              trueOrNotRequested(drawEndBoundary) &&
+              trueOrNotRequested(drawJoiningLines) &&
               trueOrNotRequested(drawBackground) &&
               trueOrNotRequested(multipleVariations))
             break;
         }
     }
-  
+
   return result;
 }
 
@@ -3104,17 +3105,17 @@ static gboolean coordAffectedByVariation(const int dnaIdx,
 /* Determine whether the given coord in the given frame/strand is affected by
  * a polyA signal */
 static gboolean coordAffectedByPolyASignal(const int dnaIdx,
-                                           const BlxStrand strand, 
+                                           const BlxStrand strand,
                                            BlxContext *bc,
                                            const MSP **mspOut, /* the variation we found */
                                            gboolean *multiple)
 {
   gboolean result = FALSE;
-  
+
   /* Loop through all variations */
   int i = 0;
   const MSP *msp = mspArrayIdx(bc->featureLists[BLXMSP_POLYA_SIGNAL], i);
-  
+
   for ( ; msp; msp = mspArrayIdx(bc->featureLists[BLXMSP_POLYA_SIGNAL], ++i))
     {
       if (mspGetRefStrand(msp) == strand && valueWithinRange(dnaIdx, &msp->qRange))
@@ -3124,10 +3125,10 @@ static gboolean coordAffectedByPolyASignal(const int dnaIdx,
             *multiple = TRUE;
 
           result = TRUE;
-          
+
           if (mspOut)
             *mspOut = msp;
-          
+
           /* If we only want to know if this coord is affected by a polyA signal, we can return now.
            *
            * If we need to return whether there are multiple sites at this coord, we can return
@@ -3136,7 +3137,7 @@ static gboolean coordAffectedByPolyASignal(const int dnaIdx,
             break;
         }
     }
-  
+
   return result;
 }
 
@@ -3144,17 +3145,17 @@ static gboolean coordAffectedByPolyASignal(const int dnaIdx,
 /* Determine whether the given coord in the given frame/strand is affected by
  * a polyA site */
 static gboolean coordAffectedByPolyASite(const int dnaIdx,
-                                         const BlxStrand strand, 
+                                         const BlxStrand strand,
                                          BlxContext *bc,
                                          const MSP **mspOut, /* the variation we found */
                                          gboolean *multiple)
 {
   gboolean result = FALSE;
-  
+
   /* Loop through all variations */
   int i = 0;
   const MSP *msp = mspArrayIdx(bc->featureLists[BLXMSP_POLYA_SITE], i);
-  
+
   for ( ; msp; msp = mspArrayIdx(bc->featureLists[BLXMSP_POLYA_SITE], ++i))
     {
       if (mspGetRefStrand(msp) == strand && valueWithinRange(dnaIdx, &msp->qRange))
@@ -3164,10 +3165,10 @@ static gboolean coordAffectedByPolyASite(const int dnaIdx,
             *multiple = TRUE;
 
           result = TRUE;
-          
+
           if (mspOut)
             *mspOut = msp;
-          
+
           /* If we only want to know if this coord is affected by a polyA signal, we can return now.
            *
            * If we need to return whether there are multiple sites at this coord, we can return
@@ -3176,19 +3177,19 @@ static gboolean coordAffectedByPolyASite(const int dnaIdx,
             break;
         }
     }
-  
+
   return result;
 }
 
 
 /* Draw a rectangle with an outline and a fill color */
-static void drawRectangle(GdkDrawable *drawable, 
-                          GdkGC *gc, 
+static void drawRectangle(GdkDrawable *drawable,
+                          GdkGC *gc,
                           GdkColor *fillColor,
                           GdkColor *outlineColor,
-                          const int x, 
+                          const int x,
                           const int y,
-                          const int width, 
+                          const int width,
                           const int height,
                           const gboolean drawLeft,
                           const gboolean drawRight,
@@ -3196,7 +3197,7 @@ static void drawRectangle(GdkDrawable *drawable,
                           const gboolean drawBottom)
 {
   const int lineWidth = 1;
-  
+
   if (fillColor)
     {
       gdk_gc_set_foreground(gc, fillColor);
@@ -3207,13 +3208,13 @@ static void drawRectangle(GdkDrawable *drawable,
     {
       gdk_gc_set_foreground(gc, outlineColor);
       gdk_gc_set_line_attributes(gc, lineWidth, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
-      
+
       int w = width - lineWidth;
       int h = height - lineWidth;
-      
+
       if (drawLeft)
         gdk_draw_line(drawable, gc, x, y, x, y + h);
-        
+
       if (drawRight)
         gdk_draw_line(drawable, gc, x + w, y, x + w, y + h);
 
@@ -3232,36 +3233,36 @@ static void drawRectangle(GdkDrawable *drawable,
  * range of any MSP that is selected. Only considers MSPs that are on the given ref seq
  * frame and strand (if given; otherwise considers all MSPs). */
 static gboolean isCoordInSelectedMspRange(const BlxContext *bc,
-                                          const int dnaIdx, 
-                                          const BlxStrand refSeqStrand, 
+                                          const int dnaIdx,
+                                          const BlxStrand refSeqStrand,
                                           const int refSeqFrame,
                                           const BlxSeqType seqType)
 {
   gboolean inSelectedMspRange = FALSE;
-  
+
   /* Loop through all the selected sequences */
   GList *seqItem = bc->selectedSeqs;
-  
+
   for ( ; seqItem && !inSelectedMspRange; seqItem = seqItem->next)
     {
       /* Loop through all the MSPs in this sequence */
       const BlxSequence* const blxSeq = (const BlxSequence*)(seqItem->data);
       GList *mspItem = blxSeq->mspList;
-      
+
       for ( ; mspItem && !inSelectedMspRange; mspItem = mspItem->next)
         {
           const MSP* const msp = (const MSP*)(mspItem->data);
           const int mspFrame = mspGetRefFrame(msp, seqType);
-          
-          if ((mspIsBlastMatch(msp) || mspIsBoxFeature(msp)) && 
+
+          if ((mspIsBlastMatch(msp) || mspIsBoxFeature(msp)) &&
               (refSeqStrand == BLXSTRAND_NONE || mspGetRefStrand(msp) == refSeqStrand) &&
               (refSeqFrame == UNSET_INT || mspFrame == refSeqFrame))
             {
               /* Passed-in coord is the nucleotide for base 1 in frame 1 of the current display index.
-               * We need to compare against base1 for the frame for the individual MSP, though, so 
+               * We need to compare against base1 for the frame for the individual MSP, though, so
                * we need to convert it: just add 1 base if we're in frame 2 or 2 bases if we're in frame3. */
               int idx = dnaIdx;
-              
+
               if (bc->displayRev)
                 {
                   idx -= (mspFrame - 1);
@@ -3270,7 +3271,7 @@ static gboolean isCoordInSelectedMspRange(const BlxContext *bc,
                 {
                   idx += (mspFrame - 1);
                 }
-              
+
               inSelectedMspRange = valueWithinRange(idx, &msp->qRange);
             }
         }
@@ -3283,16 +3284,16 @@ static gboolean isCoordInSelectedMspRange(const BlxContext *bc,
 /* Determine whether any highlighting needs to be done for snps in the ref seq */
 static void getSnpHighlighting(DrawBaseData *data,
                                BlxContext *bc)
-{     
+{
   gboolean drawBackground = FALSE;
-  
+
   if (coordAffectedByVariation(data->dnaIdx, data->strand, bc, NULL,
                                &data->drawStart, &data->drawEnd, &data->drawJoiningLines, &drawBackground, NULL))
     {
       /* The coord is affected by a SNP. Outline it in the "selected" SNP color
        * (which is darker than the normal color) */
       data->outlineColor = getGdkColor(BLXCOLOR_SNP, bc->defaultColors, TRUE, bc->usePrintColors);
-      
+
       /* If the SNP is selected, also fill it with the SNP color (using the
        * "unselected" SNP color, which is lighter than the outline). */
       if (drawBackground)
@@ -3316,7 +3317,7 @@ void drawHeaderChar(BlxContext *bc,
 {
   if (!data->selectionRange || (data->selectionRange && data->selectionRange->length() == 1))
     {
-      /* Shade the background if the base is selected XOR if the base is within the range of a 
+      /* Shade the background if the base is selected XOR if the base is within the range of a
        * selected sequence. (If both conditions are true we don't shade, to give the effect of an
        * inverted selection color.) */
       gboolean inSelectedMspRange = isCoordInSelectedMspRange(bc, data->dnaIdx, data->strand, data->frame, data->seqType);
@@ -3334,7 +3335,7 @@ void drawHeaderChar(BlxContext *bc,
   data->drawStart = FALSE;
   data->drawEnd = FALSE;
   data->drawJoiningLines = FALSE;
- 
+
   /* Check if this coord already has a special color stored for it */
   gpointer hashValue = g_hash_table_lookup(basesToHighlight, GINT_TO_POINTER(data->dnaIdx));
 
@@ -3346,10 +3347,10 @@ void drawHeaderChar(BlxContext *bc,
       if (colorId == BLXCOLOR_POLYA_SITE_ANN)
         {
           /* For polyA sites we don't shade the background; instead we want to draw a bar after the
-           * coord (or before if the display is reversed), so set the outline. 
-           * (NB Bit of a hack to use the colorId to identify polyA sites here but it works fine.) */ 
+           * coord (or before if the display is reversed), so set the outline.
+           * (NB Bit of a hack to use the colorId to identify polyA sites here but it works fine.) */
           data->outlineColor = color;
-          
+
           if (bc->displayRev)
             data->drawStart = TRUE;
           else
@@ -3368,14 +3369,14 @@ void drawHeaderChar(BlxContext *bc,
       if (data->dnaIdxSelected || data->displayIdxSelected)
         {
           /* The coord is a nucleotide in the currently-selected codon. The color depends
-           * on whether the actual nucleotide itself is selected, or just the codon that it 
+           * on whether the actual nucleotide itself is selected, or just the codon that it
            * belongs to. */
           data->fillColor = getGdkColor(BLXCOLOR_CODON, bc->defaultColors, data->dnaIdxSelected, bc->usePrintColors);
-          
+
         }
       else if (!data->fillColor)
         {
-          /* The coord is not selected but this coord is within the range of a selected MSP, so 
+          /* The coord is not selected but this coord is within the range of a selected MSP, so
            * shade the background. */
           data->fillColor = getGdkColor(data->defaultBgColor, bc->defaultColors, data->shadeBackground, bc->usePrintColors);
         }
@@ -3386,7 +3387,7 @@ void drawHeaderChar(BlxContext *bc,
     {
       getSnpHighlighting(data, bc);
     }
-  
+
   /* If the base is not already assigned some special highlighting, then
    * check whether it should be highlighted as a stop or MET. Otherwise,
    * give it the default background colour. */
@@ -3408,7 +3409,7 @@ void drawHeaderChar(BlxContext *bc,
           data->fillColor = getGdkColor(data->defaultBgColor, bc->defaultColors, data->shadeBackground, bc->usePrintColors);
         }
     }
-  
+
   /* Ok, now we know all the colours and outlines, draw the background for the base */
   if (data->topToBottom)
     {
@@ -3443,9 +3444,9 @@ static int getVariationRowNumber(const IntRange* const rangeIn, const int numRow
       /* See if it overlaps an existing range */
       GSList *ranges = (GSList*)(row->data);
       GSList *rangeItem = ranges;
-      
+
       gboolean overlaps = FALSE;
-  
+
       for ( ; rangeItem && !overlaps; rangeItem = rangeItem->next)
         {
           IntRange *range = (IntRange*)(rangeItem->data);
@@ -3458,12 +3459,12 @@ static int getVariationRowNumber(const IntRange* const rangeIn, const int numRow
           IntRange *range = new IntRange;
           range->set(rangeIn);
           ranges = g_slist_append(ranges, range);
-          
+
           row->data = ranges;
 
           if (numRows != UNSET_INT)
             rowNum = numRows - rowNum + 1; /* invert row order */
-          
+
           return rowNum;
         }
     }
@@ -3491,7 +3492,7 @@ static void freeRowsList(GSList *rows)
     {
       GSList *ranges = (GSList*)(rowItem->data);
       GSList *rangeItem = ranges;
-      
+
       for ( ; rangeItem; rangeItem = rangeItem->next)
         {
           IntRange *range = (IntRange*)(rangeItem->data);
@@ -3505,11 +3506,11 @@ static void freeRowsList(GSList *rows)
 }
 
 
-/* Utility to calculate the number of rows we need in the SNP track to avoid 
+/* Utility to calculate the number of rows we need in the SNP track to avoid
  * any overlapping variations. */
-static int getNumSnpTrackRows(const BlxContext *bc, 
-                              DetailViewProperties *properties, 
-                              const BlxStrand strand, 
+static int getNumSnpTrackRows(const BlxContext *bc,
+                              DetailViewProperties *properties,
+                              const BlxStrand strand,
                               const int frame)
 {
   DEBUG_ENTER("getNumSnpTrackRows()");
@@ -3533,7 +3534,7 @@ static int getNumSnpTrackRows(const BlxContext *bc,
             {
               /* Get the row number (1-based) to draw this variation in. */
               int row = getVariationRowNumber(&mspExpandedRange, UNSET_INT, &rows);
-              
+
               /* Keep track of how many rows we've seen so we can size the widget accordingly */
               if (row > numRows)
                 numRows = row;
@@ -3542,7 +3543,7 @@ static int getNumSnpTrackRows(const BlxContext *bc,
     }
 
   freeRowsList(rows);
-  
+
   DEBUG_EXIT("getNumSnpTrackRows returning %d", numRows);
   return numRows;
 }
@@ -3574,25 +3575,25 @@ static void drawVariationsTrack(GtkWidget *snpTrack, GtkWidget *detailView)
 
   GtkWidget *blxWindow = detailViewGetBlxWindow(detailView);
   BlxContext *bc = blxWindowGetContext(blxWindow);
-  
+
   if (!bc->flags[BLXFLAG_SHOW_VARIATION_TRACK] || !bc->flags[BLXFLAG_HIGHLIGHT_VARIATIONS])
     {
       DEBUG_EXIT("drawVariationsTrack returning");
       return;
     }
-  
+
   const int activeFrame = detailViewGetActiveFrame(detailView);
-  
+
   BlxStrand strand = snpTrackGetStrand(snpTrack, detailView);
-  
+
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   /* Find the left margin. It will be at the same x coord as the left edge of
    * the sequence column header. */
   int leftMargin = UNSET_INT;
   BlxColumnInfo *seqColInfo = getColumnInfo(detailViewGetColumnList(detailView), BLXCOL_SEQUENCE);
   gtk_widget_translate_coordinates(seqColInfo->headerWidget, snpTrack, 0, 0, &leftMargin, NULL);
-  
+
   /* Maintain lists for each row where the variations are drawn; remember their display
    * ranges and don't allow any to overlap. */
   const int numRows = getNumSnpTrackRows(bc, properties, strand, activeFrame);
@@ -3618,20 +3619,20 @@ static void drawVariationsTrack(GtkWidget *snpTrack, GtkWidget *detailView)
               /* Get the row number to draw this variation in. */
               const int rowNum = getVariationRowNumber(&mspExpandedRange, numRows, &rows);
               const int rowIdx = rowNum - 1;
-              
+
               int x = leftMargin + (int)((gdouble)(mspExpandedRange.min() - properties->displayRange.min()) * properties->charWidth());
               const int width = ceil((gdouble)strlen(mspGetMatchSeq(msp)) * properties->charWidth());
               const gboolean isSelected = blxWindowIsSeqSelected(blxWindow, msp->sSequence);
-              
+
               /* Draw the outline in the default SNP color. If the SNP is selected, also
                * fill in the rectangle in the SNP color (use the selected color for the
                * outline and the unselected color for the fill, so that the outline is darker). */
               GdkColor *outlineColor = getGdkColor(BLXCOLOR_SNP, bc->defaultColors, TRUE, bc->usePrintColors);
               GdkColor *fillColor = isSelected ? getGdkColor(BLXCOLOR_SNP, bc->defaultColors, FALSE, bc->usePrintColors) : NULL;
-              
+
               /* Draw the background rectangle for the char */
               drawRectangle(drawable, gc, fillColor, outlineColor, x, y + (rowHeight * rowIdx), width, rowHeight, TRUE, TRUE, TRUE, TRUE);
-              
+
               /* Draw the text */
               PangoLayout *layout = gtk_widget_create_pango_layout(detailView, mspGetMatchSeq(msp));
               pango_layout_set_font_description(layout, properties->fontDesc);
@@ -3640,22 +3641,22 @@ static void drawVariationsTrack(GtkWidget *snpTrack, GtkWidget *detailView)
                 {
                   gtk_paint_layout(snpTrack->style, drawable, GTK_STATE_NORMAL, TRUE, NULL, detailView, NULL, x, y + (rowHeight * rowIdx), layout);
                   g_object_unref(layout);
-                }             
+                }
             }
         }
     }
 
   freeRowsList(rows);
-  
+
   drawColumnSeparatorLine(snpTrack, drawable, gc, bc);
-  
+
   g_object_unref(gc);
 
   DEBUG_EXIT("drawVariationsTrack returning ");
 }
 
 
-/* This function centres the detail view display on the currently-selected base index. Does 
+/* This function centres the detail view display on the currently-selected base index. Does
  * nothing if there isn't a selected base. */
 static void detailViewCentreOnSelection(GtkWidget *detailView)
 {
@@ -3663,13 +3664,13 @@ static void detailViewCentreOnSelection(GtkWidget *detailView)
 
   const gboolean selectedBaseSet = detailViewGetSelectedIdxSet(detailView);
   const int selectedBaseIdx = detailViewGetSelectedDisplayIdx(detailView);
-  
+
   if (selectedBaseSet)
     {
       /* The coord is in terms of the display coords, i.e. whatever the displayed seq type is. */
       const BlxSeqType seqType = detailViewGetSeqType(detailView);
       const IntRange* const displayRange = detailViewGetDisplayRange(detailView);
-      
+
       int newStart = selectedBaseIdx - (displayRange->length() / 2);
       setDetailViewStartIdx(detailView, newStart, seqType);
     }
@@ -3689,7 +3690,7 @@ static int getBaseIndexAtDetailViewCoords(GtkWidget *detailView, const int x, co
   /* Get the x coords at the start/end of the sequence column */
   IntRange xRange;
   getColumnXCoords(columnList, BLXCOL_SEQUENCE, &xRange);
-  
+
   /* See if our x coord lies inside the sequence column */
   if (x >= xRange.min() && x <= xRange.max())
     {
@@ -3701,7 +3702,7 @@ static int getBaseIndexAtDetailViewCoords(GtkWidget *detailView, const int x, co
       GtkAdjustment *adjustment = properties->adjustment;
       baseIdx = charIdx + adjustment->value;
     }
-  
+
   return baseIdx;
 }
 
@@ -3717,7 +3718,7 @@ static void onScrollRangeChangedDetailView(GtkObject *object, gpointer data)
 
   GtkAdjustment *adjustment = GTK_ADJUSTMENT(object);
   GtkWidget *detailView = GTK_WIDGET(data);
-  
+
   IntRange *displayRange = detailViewGetDisplayRange(detailView);
 
   /* First time round, set the adjusment range to be centred on the centre of
@@ -3734,18 +3735,18 @@ static void onScrollRangeChangedDetailView(GtkObject *object, gpointer data)
 
   int newStart = adjustment->value;
   int newEnd = newStart + adjustment->page_size - 1;
-  
+
   /* Only update if something has changed */
   if (displayRange->min() != newStart || displayRange->max() != newEnd)
     {
       IntRange oldRange = {displayRange->min(), displayRange->max()};
 
       displayRange->set(newStart, newEnd);
-      
+
       /* Refilter the data for all trees in the detail view because rows may have scrolled in/out of view */
       refilterDetailView(detailView, &oldRange);
 
-      /* Refresh the detail view header (which may contain the DNA sequence), and 
+      /* Refresh the detail view header (which may contain the DNA sequence), and
        * the headers for all the trees (which contains the reference sequence) */
       refreshDetailViewHeaders(detailView);
       callFuncOnAllDetailViewTrees(detailView, refreshTreeHeaders, NULL);
@@ -3756,7 +3757,7 @@ static void onScrollRangeChangedDetailView(GtkObject *object, gpointer data)
       refreshBigPictureDisplayRange(bigPicture, FALSE);
       calculateBigPictureCellSize(bigPicture, bigPictureGetProperties(bigPicture));
     }
-  
+
   DEBUG_EXIT("onScrollRangeChangedDetailView returning");
 }
 
@@ -3768,7 +3769,7 @@ static void onScrollPosChangedDetailView(GtkObject *object, gpointer data)
 
   GtkAdjustment *adjustment = GTK_ADJUSTMENT(object);
   GtkWidget *detailView = GTK_WIDGET(data);
-  
+
   /* Set the display range so that it starts at the new scroll pos */
   int newStart = adjustment->value;
   int newEnd = adjustment->value + adjustment->page_size - 1;
@@ -3776,7 +3777,7 @@ static void onScrollPosChangedDetailView(GtkObject *object, gpointer data)
   /* Only update if something has changed */
   DetailViewProperties *properties = detailViewGetProperties(detailView);
   IntRange *displayRange = &properties->displayRange;
-  
+
   if (displayRange->min() != newStart || displayRange->max() != newEnd)
     {
       IntRange oldRange(displayRange->min(), displayRange->max());
@@ -3786,7 +3787,7 @@ static void onScrollPosChangedDetailView(GtkObject *object, gpointer data)
       /* Refilter the data for all trees in the detail view because rows may have scrolled in/out of view */
       refilterDetailView(detailView, &oldRange);
 
-      /* Refresh the detail view header (which may contain the DNA sequence), and 
+      /* Refresh the detail view header (which may contain the DNA sequence), and
        * the headers for all the trees (which contains the reference sequence) */
       refreshDetailViewHeaders(detailView);
       callFuncOnAllDetailViewTrees(detailView, refreshTreeHeaders, NULL);
@@ -3796,7 +3797,7 @@ static void onScrollPosChangedDetailView(GtkObject *object, gpointer data)
       GtkWidget *bigPicture = blxWindowGetBigPicture(properties->blxWindow());
       refreshBigPictureDisplayRange(bigPicture, FALSE);
     }
-  
+
   DEBUG_EXIT("onScrollPosChangedDetailView returning");
 }
 
@@ -3812,11 +3813,11 @@ static void updateCellRendererFont(GtkWidget *detailView, PangoFontDescription *
   /* Calculate the row height from the font size */
   gdouble charWidth, charHeight;
   getFontCharSize(detailView, fontDesc, &charWidth, &charHeight);
-  
+
   /* Cache these results, because we use them often for calculations */
   DetailViewProperties *properties = detailViewGetProperties(detailView);
   properties->setFontSize(charWidth, charHeight);
-  
+
   /* Set the row height. Subtract the padding between the cell's actual area and
    * its background area. We will render at the background area's height, so that
    * we draw over the "gaps" between the cells, giving the impression of no gaps. */
@@ -3835,17 +3836,17 @@ static void refilterMspRow(MSP *msp, GtkWidget *detailView, BlxContext *bc)
   /* Find the tree row that this MSP is in and force that row to update
    * its visibility status. */
   gchar *pathStr = mspGetTreePath(msp, bc->modelId);
-  
+
   if (pathStr)
     {
       GtkTreePath *path = gtk_tree_path_new_from_string(pathStr);
-      
+
       if (path)
         {
           GtkWidget *tree = detailViewGetTree(detailView, mspGetRefStrand(msp), mspGetRefFrame(msp, bc->seqType));
           GtkTreeModel *model = treeGetBaseDataModel(GTK_TREE_VIEW(tree));
           GtkTreeIter iter;
-          
+
           if (gtk_tree_model_get_iter(model, &iter, path))
             {
               gtk_tree_model_row_changed(model, path, &iter);
@@ -3854,7 +3855,7 @@ static void refilterMspRow(MSP *msp, GtkWidget *detailView, BlxContext *bc)
 
       gtk_tree_path_free(path);
     }
-  
+
   //DEBUG_EXIT("refilterMspRow returning ");
 }
 
@@ -3867,49 +3868,49 @@ static gboolean startValueWithinRange(const IntRange* const range1,
                                       const gboolean rev)
 {
   gboolean result = FALSE;
-  
+
   if (rev)
     result = valueWithinRange(range1->max(), range2);
-  else 
+  else
     result = valueWithinRange(range1->min(), range2);
-  
+
   return result;
 }
 
 
 /* Quick search to find any MSP in the given array that whose start coord
- * lies within the given range. Sets the found array index in 'idx' or returns 
+ * lies within the given range. Sets the found array index in 'idx' or returns
  * FALSE if no MSP was found in this range. */
-static gboolean getAnyMspInRange(GArray *mspArray, 
-                                 const IntRange* const range, 
-                                 const gboolean displayRev, 
+static gboolean getAnyMspInRange(GArray *mspArray,
+                                 const IntRange* const range,
+                                 const gboolean displayRev,
                                  int *idx)
 {
   gboolean result = FALSE;
-  
-  /* Do a binary search based on start coord until we find a start coord 
+
+  /* Do a binary search based on start coord until we find a start coord
    * that lies within the given range. */
   int iMax = mspArray->len - 1;
   int iMin = 0;
 
   while (1)
     {
-      const int i = iMin + (iMax - iMin) / 2;  
+      const int i = iMin + (iMax - iMin) / 2;
       const MSP *msp = mspArrayIdx(mspArray, i);
-      
+
       if (!msp)
         break;
-    
+
       if (startValueWithinRange(&msp->displayRange, range, displayRev))
         {
           result = TRUE;
           *idx = i;
           break;
         }
-    
+
       if (iMax - iMin < 1)
         break;
-    
+
       if ((msp->displayRange.min() < range->min()) != displayRev)
         {
           iMin = i + 1;
@@ -3919,21 +3920,21 @@ static gboolean getAnyMspInRange(GArray *mspArray,
           iMax = i - 1;
         }
     }
-  
+
   return result;
 }
 
 
 /* Refilter the tree rows for all MSPs in the given array whose start coords
  * lie within the given range. 'startIdx' should be an index in the array that
- * gives the position of an MSP that is known to lie within this range (i.e. 
+ * gives the position of an MSP that is known to lie within this range (i.e.
  * it gives us a rough starting point so that we don't have to search through
  * the entire array; it does not necessarily have to be the FIRST MSP that lies
  * within range). */
-static void refilterMspList(const int startIdx, 
+static void refilterMspList(const int startIdx,
                             GArray *array,
-                            const IntRange* const range, 
-                            GtkWidget *detailView, 
+                            const IntRange* const range,
+                            GtkWidget *detailView,
                             BlxContext *bc)
 {
   DEBUG_ENTER("refilterMspList(startIdx=%d, range=[%d,%d])", startIdx, range->min(), range->max());
@@ -3942,66 +3943,66 @@ static void refilterMspList(const int startIdx,
    * for each MSP until we find an MSP that is out of range. */
   int i = startIdx;
   MSP *msp = mspArrayIdx(array, i);
-  
+
   for ( ; msp; msp = mspArrayIdx(array, ++i))
     {
       if (!startValueWithinRange(&msp->displayRange, range, bc->displayRev))
         break;
-      
+
       refilterMspRow(msp, detailView, bc);
     }
-  
-  /* Also loop backwards from the start index, because startIdx may not have 
+
+  /* Also loop backwards from the start index, because startIdx may not have
    * been the very first MSP in the array that was in range. */
   i = startIdx - 1;
   msp = mspArrayIdx(array, i);
-  
+
   for ( ; msp; msp = mspArrayIdx(array, --i))
     {
       if (!startValueWithinRange(&msp->displayRange, range, bc->displayRev))
         break;
-      
+
       refilterMspRow(msp, detailView, bc);
     }
-  
+
   DEBUG_EXIT("refilterMspList returning ");
 }
 
 
 /* Refilter rows in the detail-view trees for MSPs of the given type. Only filter
  * the rows of MSPs that lie within the given display range. */
-static void refilterMspArrayByRange(BlxMspType mspType, 
-                                   BlxContext *bc, 
-                                   const IntRange* const displayRange, 
+static void refilterMspArrayByRange(BlxMspType mspType,
+                                   BlxContext *bc,
+                                   const IntRange* const displayRange,
                                    GtkWidget *detailView)
 {
   //DEBUG_ENTER("refilterMspArrayByRange(mspType=%d)", mspType);
 
   if (!displayRange)
     return;
-  
+
   /* We only want to update MSPs that are within the given display range.
-   * 
-   * We want to avoid searching through the entire MSP array, because it may 
+   *
+   * We want to avoid searching through the entire MSP array, because it may
    * contain many thousands of MSPs. However, it is difficult to do a quick
    * search to find an item from the list based on two values (i.e. the start and
-   * end of its range). 
+   * end of its range).
    * What we do is extend the start of the display range by the maximum MSP
-   * length so that we can do a binary search just on the start coord of the MSP 
+   * length so that we can do a binary search just on the start coord of the MSP
    * to check that it lies within the extended range. For any MSP that lies within
-   * the display range, it must be true that its start coord lies within this 
+   * the display range, it must be true that its start coord lies within this
    * extended range.
    * Because the extended range is based on the maximum MSP length, it is likely
    * to include some MSPs that do not actually lie within the display range.
-   * However, there is no harm in filtering a few extra rows, and this should 
+   * However, there is no harm in filtering a few extra rows, and this should
    * still be more efficient that searching through the entire array of MSPs. */
 
   const int maxLen = getMaxMspLen();
 
-  /* If the display is reversed, the 'start' is the maximum coord end 
+  /* If the display is reversed, the 'start' is the maximum coord end
    * rather than the minimum coord */
   IntRange extendedRange;
-  
+
   if (bc->displayRev)
     {
       extendedRange.set(displayRange->min(), displayRange->max() + maxLen);
@@ -4010,14 +4011,14 @@ static void refilterMspArrayByRange(BlxMspType mspType,
     {
       extendedRange.set(displayRange->min() - maxLen, displayRange->max());
     }
-  
+
   int startIdx = 0;
-  
+
   if (getAnyMspInRange(bc->featureLists[mspType], &extendedRange, bc->displayRev, &startIdx))
     {
       refilterMspList(startIdx, bc->featureLists[mspType], &extendedRange, detailView, bc);
     }
-  
+
   //DEBUG_EXIT("refilterMspArrayByRange returning ");
 }
 
@@ -4027,12 +4028,12 @@ static void refilterMspArrayByRange(BlxMspType mspType,
 void refilterDetailView(GtkWidget *detailView, const IntRange* const oldRange)
 {
   DEBUG_ENTER("refilterDetailView(oldRange=[%d,%d])", oldRange ? oldRange->min() : 0, oldRange ? oldRange->max() : 0);
-  
+
   BlxContext *bc = detailViewGetContext(detailView);
-  
+
   if (bc->flags[BLXFLAG_SHOW_POLYA_SITE] || bc->flags[BLXFLAG_SHOW_UNALIGNED])
     {
-      /* If these options are enabled, then determining which rows need to be 
+      /* If these options are enabled, then determining which rows need to be
        * refiltered becomes much more complex because visible alignments lengths
        * may differ from the actual alignment coords, and may differ depending
        * on whether the sequence is selected or not. For now, play safe and
@@ -4056,7 +4057,7 @@ void refilterDetailView(GtkWidget *detailView, const IntRange* const oldRange)
               refilterMspArrayByRange((BlxMspType)mspType, bc, newRange, detailView);
             }
         }
-      
+
       detailViewRedrawAll(detailView);
     }
 
@@ -4073,13 +4074,13 @@ static void assertDetailView(GtkWidget *detailView)
   /* Check it's a valid detail-view tree type */
   if (!detailView)
     g_error("Detail-view widget is null\n");
-  
+
   if (!GTK_IS_WIDGET(detailView))
     g_error("Detail-view is not a valid widget [%p]\n", detailView);
-  
+
   if (!GTK_IS_CONTAINER(detailView))
     g_error("Detail-view is not a valid container [%p]\n", detailView);
-  
+
   if (!detailViewGetProperties(detailView))
     g_error("Tree properties not set [widget=%p]\n", detailView);
 }
@@ -4124,14 +4125,14 @@ GType* columnListGetTypes(GList *columnList)
 
       GList *item = columnList;
       int i = 0;
-      
+
       for ( ; item; item = item->next, ++i)
         {
           BlxColumnInfo* columnInfo = (BlxColumnInfo*)(item->data);
           result[i] = columnInfo->type;
         }
     }
-  
+
   return result;
 }
 
@@ -4177,7 +4178,7 @@ GtkWidget* detailViewGetTreeContainer(GtkWidget *detailView, const BlxStrand act
 {
   DetailViewProperties *properties = detailViewGetProperties(detailView);
   GtkWidget *result = NULL;
-  
+
   /* Get the list of trees for the relevant strand */
   GList *list = (activeStrand == BLXSTRAND_FORWARD) ? properties->fwdStrandTrees : properties->revStrandTrees;
 
@@ -4187,20 +4188,20 @@ GtkWidget* detailViewGetTreeContainer(GtkWidget *detailView, const BlxStrand act
     {
       GList *listItem = list;
       int count = 1;
-      
+
       for ( ; listItem && count < frame; ++count)
         {
           listItem = listItem->next;
         }
 
-      if (count == frame && 
-          GTK_IS_WIDGET(listItem->data) && 
+      if (count == frame &&
+          GTK_IS_WIDGET(listItem->data) &&
           (widgetIsTree(GTK_WIDGET(listItem->data)) || widgetIsTreeContainer(GTK_WIDGET(listItem->data))))
         {
           result = GTK_WIDGET(listItem->data);
         }
     }
-  
+
   return result;
 }
 
@@ -4210,7 +4211,7 @@ GtkWidget* detailViewGetTree(GtkWidget *detailView, const BlxStrand activeStrand
 {
   GtkWidget *result = NULL;
   GtkWidget *treeContainer = detailViewGetTreeContainer(detailView, activeStrand, frame);
-  
+
   if (treeContainer && widgetIsTree(treeContainer))
     {
       result = treeContainer;
@@ -4219,12 +4220,12 @@ GtkWidget* detailViewGetTree(GtkWidget *detailView, const BlxStrand activeStrand
     {
       result = treeContainerGetTree(GTK_CONTAINER(treeContainer));
     }
-  
+
   if (!result)
     {
       g_warning("Tree not found for '%s' strand, frame '%d'. Returning NULL.\n", ((activeStrand == BLXSTRAND_FORWARD) ? "forward" : "reverse"), frame);
     }
-  
+
   return result;
 }
 
@@ -4319,8 +4320,8 @@ gboolean detailViewGetSelectedIdxRangeSet(GtkWidget *detailView)
   gboolean result = FALSE;
   DetailViewProperties *properties = detailViewGetProperties(detailView);
 
-  if (properties && 
-      properties->selectedRangeStart.isSet && 
+  if (properties &&
+      properties->selectedRangeStart.isSet &&
       properties->selectedRangeEnd.isSet &&
       properties->selectedRangeStart.dnaIdx != properties->selectedRangeEnd.dnaIdx)
     {
@@ -4367,7 +4368,7 @@ int detailViewGetActiveFrame(GtkWidget *detailView)
 {
   DetailViewProperties *properties = detailViewGetProperties(detailView);
   int result = 1;
-  
+
   if (detailViewGetSelectedIdxSet(detailView))
     {
       result = properties->selectedIndex->frame;
@@ -4421,10 +4422,10 @@ static void updateFollowingBaseSelection(GtkWidget *detailView,
     {
       scrollToKeepSelectionInRange(detailView, scrollMinimum);
     }
-  
+
   /* Update the feedback box */
   updateFeedbackBox(detailView);
-  
+
   /* Update the headers so that the newly-selected index is highlighted */
   detailViewRefreshAllHeaders(detailView);
 }
@@ -4485,8 +4486,8 @@ gboolean detailViewIsDnaIdxSelected(GtkWidget *detailView, const int dnaIdx)
 
 
 /* Utility to set the info in a DetailViewIndex struct */
-static void setDetailViewIndex(DetailViewIndex *index, 
-                               const gboolean isSet, 
+static void setDetailViewIndex(DetailViewIndex *index,
+                               const gboolean isSet,
                                const int dnaIdx,
                                const int displayIdx,
                                const int frame,
@@ -4517,9 +4518,9 @@ void detailViewUnsetSelectedBaseIdx(GtkWidget *detailView)
   setDetailViewIndex(&properties->selectedRangeInit, FALSE, UNSET_INT, UNSET_INT, UNSET_INT, UNSET_INT);
   setDetailViewIndex(&properties->selectedRangeStart, FALSE, UNSET_INT, UNSET_INT, UNSET_INT, UNSET_INT);
   setDetailViewIndex(&properties->selectedRangeEnd, FALSE, UNSET_INT, UNSET_INT, UNSET_INT, UNSET_INT);
-  
+
   properties->selectedIndex = NULL;
-  
+
   updateFollowingBaseSelection(detailView, FALSE, FALSE);
 
   DEBUG_EXIT("detailViewUnsetSelectedBaseIdx returning ");
@@ -4528,18 +4529,18 @@ void detailViewUnsetSelectedBaseIdx(GtkWidget *detailView)
 
 /* This function does the work to update the selected index (called by the display/dna specific
  * functions). It makes sure the selection range is updated correctly when extending the
- * range. 
- * Performs any required refreshes. Scrolls the view to keep the selected base 
+ * range.
+ * Performs any required refreshes. Scrolls the view to keep the selected base
  * in view if allowScroll is true. (Such scrolling is by the minimum
- * number of bases necessary if scrollMinimum is true.) 
- * if extend is true, then extend the current range rather than starting a new 
+ * number of bases necessary if scrollMinimum is true.)
+ * if extend is true, then extend the current range rather than starting a new
  * selection. */
-static void detailViewSetSelectedIndex(GtkWidget *detailView, 
+static void detailViewSetSelectedIndex(GtkWidget *detailView,
                                        const int dnaIdx_in,
                                        const int displayIdx_in,
                                        const int frame,
                                        const int baseNum,
-                                       const gboolean allowScroll, 
+                                       const gboolean allowScroll,
                                        const gboolean scrollMinimum,
                                        const gboolean extend)
 {
@@ -4558,8 +4559,8 @@ static void detailViewSetSelectedIndex(GtkWidget *detailView,
       IntRange* dnaRange = blxWindowGetRefSeqRange(blxWindow);
       boundsLimitValue(&displayIdx, displayRange);
       boundsLimitValue(&dnaIdx, dnaRange);
-    }  
-  
+    }
+
   if (!extend || !properties->selectedIndex ||
       !properties->selectedRangeStart.isSet || !properties->selectedRangeEnd.isSet)
     {
@@ -4575,7 +4576,7 @@ static void detailViewSetSelectedIndex(GtkWidget *detailView,
     }
   else
     {
-      DEBUG_OUT("Extending existing range (%d, %d) to %d\n", 
+      DEBUG_OUT("Extending existing range (%d, %d) to %d\n",
                 properties->selectedRangeStart.dnaIdx, properties->selectedRangeEnd.dnaIdx, dnaIdx);
 
       /* Extend or trim the existing range by setting the start or end of the range to the new
@@ -4634,7 +4635,7 @@ void detailViewSetSelectedDnaBaseIdx(GtkWidget *detailView,
 void detailViewSetActiveFrame(GtkWidget *detailView, const int frame)
 {
   DEBUG_ENTER("detailViewSetActiveFrame()");
-  
+
   if (detailViewGetSelectedIdxSet(detailView))
     {
       /* Keep the selected DNA coord(s) the same but update the frame */
@@ -4652,10 +4653,10 @@ void detailViewSetActiveFrame(GtkWidget *detailView, const int frame)
 
 
 /* Set the selected base index to the given display index and base/frame number. */
-void detailViewSetSelectedDisplayIdx(GtkWidget *detailView, 
-                                     const int displayIdx, 
-                                     const int frame, 
-                                     const int baseNum, 
+void detailViewSetSelectedDisplayIdx(GtkWidget *detailView,
+                                     const int displayIdx,
+                                     const int frame,
+                                     const int baseNum,
                                      const gboolean allowScroll,
                                      const gboolean scrollMinimum,
                                      const gboolean extend)
@@ -4663,14 +4664,14 @@ void detailViewSetSelectedDisplayIdx(GtkWidget *detailView,
   DEBUG_ENTER("detailViewSetSelectedDisplayIdx(%d, %d, %d)", displayIdx, frame, baseNum);
 
   BlxContext *bc = detailViewGetContext(detailView);
-  
+
   /* For protein matches, calculate the base index in terms of the DNA sequence */
-  const int dnaIdx = convertDisplayIdxToDnaIdx(displayIdx, 
-                                               bc->seqType, 
-                                               frame, 
-                                               baseNum, 
-                                               bc->numFrames, 
-                                               bc->displayRev, 
+  const int dnaIdx = convertDisplayIdxToDnaIdx(displayIdx,
+                                               bc->seqType,
+                                               frame,
+                                               baseNum,
+                                               bc->numFrames,
+                                               bc->displayRev,
                                                &bc->refSeqRange);
 
   detailViewSetSelectedIndex(detailView, dnaIdx, displayIdx, frame, baseNum, allowScroll, scrollMinimum, extend);
@@ -4716,13 +4717,13 @@ int detailViewGetClickedBaseIdx(GtkWidget *detailView)
 
 
 /* Set the selected base index to the given display index and base/frame number.
- *  Performs any required refreshes. Scrolls the view to keep the selected base 
+ *  Performs any required refreshes. Scrolls the view to keep the selected base
  * in view if allowScroll is true. (Such scrolling is by the minimum
  * number of bases necessary if scrollMinimum is true.) */
-void detailViewSetClickedBaseIdx(GtkWidget *detailView, 
-                                  const int clickedBaseIdx, 
-                                  const int frame, 
-                                  const int baseNum, 
+void detailViewSetClickedBaseIdx(GtkWidget *detailView,
+                                  const int clickedBaseIdx,
+                                  const int frame,
+                                  const int baseNum,
                                   const gboolean allowScroll,
                                   const gboolean scrollMinimum)
 {
@@ -4748,7 +4749,7 @@ DetailViewProperties* detailViewGetProperties(GtkWidget *widget)
 
   if (!properties && widget)
     properties = (DetailViewProperties*)(g_object_get_data(G_OBJECT(widget), "DetailViewProperties"));
-  
+
   return properties;
 }
 
@@ -4779,14 +4780,14 @@ static DetailViewProperties* detailViewCreateProperties(GtkWidget *detailView,
                                                         GtkWidget *feedbackBox,
                                                         GtkWidget *statusBar,
                                                         GList *columnList,
-                                                        GtkAdjustment *adjustment, 
+                                                        GtkAdjustment *adjustment,
                                                         const int startCoord,
                                                         const BlxColumnId sortColumn)
 {
   DetailViewProperties *properties = NULL;
 
   if (detailView)
-    { 
+    {
       properties = new DetailViewProperties(detailView,
                                             blxWindow,
                                             bc,
@@ -4797,12 +4798,12 @@ static DetailViewProperties* detailViewCreateProperties(GtkWidget *detailView,
                                             feedbackBox,
                                             statusBar,
                                             columnList,
-                                            adjustment, 
+                                            adjustment,
                                             startCoord,
                                             sortColumn);
- 
+
       g_object_set_data(G_OBJECT(detailView), "DetailViewProperties", properties);
-      g_signal_connect(G_OBJECT(detailView), "destroy", G_CALLBACK(onDestroyDetailView), NULL); 
+      g_signal_connect(G_OBJECT(detailView), "destroy", G_CALLBACK(onDestroyDetailView), NULL);
     }
 
   return properties;
@@ -4825,9 +4826,9 @@ int seqColHeaderGetRow(GtkWidget *header)
 int seqColHeaderGetBase(GtkWidget *header, const int frame, const int numFrames)
 {
   const int row = seqColHeaderGetRow(header);
-  
+
   int baseNum = UNSET_INT;
-  
+
   if (row != UNSET_INT)
     {
       baseNum = row - (frame - 1);
@@ -4838,7 +4839,7 @@ int seqColHeaderGetBase(GtkWidget *header, const int frame, const int numFrames)
           baseNum += numFrames;
         }
     }
-  
+
   return baseNum;
 }
 
@@ -4846,7 +4847,7 @@ int seqColHeaderGetBase(GtkWidget *header, const int frame, const int numFrames)
 static int seqColHeaderGetCoordAtPos(GtkWidget *header, GtkWidget *detailView, const int x, const int y)
 {
   int baseIdx = UNSET_INT;
-  
+
   GtkAdjustment *adjustment = detailViewGetAdjustment(detailView);
 
   if (x >= 0 && x <= header->allocation.width)
@@ -4854,7 +4855,7 @@ static int seqColHeaderGetCoordAtPos(GtkWidget *header, GtkWidget *detailView, c
       /* Get the 0-based char index at x */
       gdouble charWidth = detailViewGetCharWidth(detailView);
       int charIdx = (int)((gdouble)x / charWidth);
-      
+
       /* Add the start of the scroll range to convert this to the display index */
       baseIdx = charIdx + adjustment->value;
     }
@@ -4866,7 +4867,7 @@ static int seqColHeaderGetCoordAtPos(GtkWidget *header, GtkWidget *detailView, c
     {
       baseIdx = adjustment->value = adjustment->page_size;
     }
-  
+
   return baseIdx;
 }
 
@@ -4881,14 +4882,14 @@ static int seqColHeaderGetCoordAtPos(GtkWidget *header, GtkWidget *detailView, c
 static void panedWindowCreateProperties(GtkWidget *widget, const int splitterPos)
 {
   if (widget)
-    { 
+    {
       PanedWindowProperties *properties = new PanedWindowProperties;
 
       properties->widget = widget;
       properties->splitterPos = splitterPos;
-      
+
       g_object_set_data(G_OBJECT(widget), "PanedWindowProperties", properties);
-      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyPanedWindow), NULL); 
+      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyPanedWindow), NULL);
     }
 }
 
@@ -4899,7 +4900,7 @@ static PanedWindowProperties* panedWindowGetProperties(GtkWidget *widget)
 
   if (!properties && widget)
     properties = (PanedWindowProperties*)(g_object_get_data(G_OBJECT(widget), "PanedWindowProperties"));
-  
+
   return properties;
 }
 
@@ -4927,18 +4928,18 @@ static void snpTrackSetStrand(GtkWidget *snpTrack, const BlxStrand strand)
 static BlxStrand snpTrackGetStrand(GtkWidget *snpTrack, GtkWidget *detailView)
 {
   BlxStrand strand = BLXSTRAND_NONE;
-  
+
   if (snpTrack)
     {
       strand = (BlxStrand)GPOINTER_TO_INT(g_object_get_data(G_OBJECT(snpTrack), "snpTrackStrand"));
     }
-  
+
   if (strand == BLXSTRAND_NONE)
     {
       /* use the active strand instead */
       strand = blxWindowGetActiveStrand(detailViewGetBlxWindow(detailView));
     }
-  
+
   return strand;
 }
 
@@ -5035,14 +5036,14 @@ static void snpTrackSetHeight(GtkWidget *detailView, GtkWidget *snpTrack)
 gboolean onExposeGenericHeader(GtkWidget *headerWidget, GdkEventExpose *event, gpointer data)
 {
   GdkGC *gc = gdk_gc_new(headerWidget->window);
-  
+
   GtkWidget *detailView = GTK_WIDGET(data);
   const BlxContext *bc = detailViewGetContext(detailView);
-  
+
   drawColumnSeparatorLine(headerWidget, headerWidget->window, gc, bc);
-  
+
   g_object_unref(gc);
-  
+
   return FALSE;
 }
 
@@ -5051,7 +5052,7 @@ gboolean onExposeGenericHeader(GtkWidget *headerWidget, GdkEventExpose *event, g
 gboolean onExposeDnaTrack(GtkWidget *headerWidget, GdkEventExpose *event, gpointer data)
 {
   GdkWindow *window = GTK_IS_LAYOUT(headerWidget) ? GTK_LAYOUT(headerWidget)->bin_window : headerWidget->window;
-  
+
   if (window)
     {
       /* See if there's a cached drawable and, if not, create it */
@@ -5062,11 +5063,11 @@ gboolean onExposeDnaTrack(GtkWidget *headerWidget, GdkEventExpose *event, gpoint
           /* There isn't a bitmap yet. Create it now. */
           GtkWidget *detailView = GTK_WIDGET(data);
           const BlxStrand activeStrand = detailViewGetDisplayRev(detailView) ? BLXSTRAND_REVERSE : BLXSTRAND_FORWARD;
-          
+
           drawDnaTrack(headerWidget, detailView, activeStrand, seqColHeaderGetRow(headerWidget));
           bitmap = widgetGetDrawable(headerWidget);
         }
-      
+
       if (bitmap)
         {
           /* Push the bitmap onto the window */
@@ -5075,7 +5076,7 @@ gboolean onExposeDnaTrack(GtkWidget *headerWidget, GdkEventExpose *event, gpoint
           g_object_unref(gc);
         }
     }
-  
+
   return FALSE;
 }
 
@@ -5084,7 +5085,7 @@ gboolean onExposeDnaTrack(GtkWidget *headerWidget, GdkEventExpose *event, gpoint
 static gboolean onExposeVariationsTrack(GtkWidget *snpTrack, GdkEventExpose *event, gpointer data)
 {
   GdkDrawable *window = GTK_LAYOUT(snpTrack)->bin_window;
-  
+
   if (window)
     {
       GdkDrawable *bitmap = widgetGetDrawable(snpTrack);
@@ -5093,10 +5094,10 @@ static gboolean onExposeVariationsTrack(GtkWidget *snpTrack, GdkEventExpose *eve
           /* There isn't a bitmap yet. Create it now. */
           GtkWidget *detailView = GTK_WIDGET(data);
           drawVariationsTrack(snpTrack, detailView);
-          
+
           bitmap = widgetGetDrawable(snpTrack);
         }
-      
+
       if (bitmap)
         {
           /* Push the bitmap onto the window */
@@ -5109,7 +5110,7 @@ static gboolean onExposeVariationsTrack(GtkWidget *snpTrack, GdkEventExpose *eve
           g_critical("Failed to draw SNP track [%p] - could not create bitmap.\n", snpTrack);
         }
     }
-  
+
   return TRUE;
 }
 
@@ -5127,7 +5128,7 @@ static gboolean onButtonPressSnpTrack(GtkWidget *snpTrack, GdkEventButton *event
         GtkWidget *blxWindow = detailViewGetBlxWindow(detailView);
         BlxContext *bc = blxWindowGetContext(blxWindow);
         GList *columnList = detailViewGetColumnList(detailView);
-        
+
         if (event->type == GDK_BUTTON_PRESS) /* first click */
           {
             /* Select the variation that was clicked on.  */
@@ -5138,15 +5139,15 @@ static gboolean onButtonPressSnpTrack(GtkWidget *snpTrack, GdkEventButton *event
             BlxColumnInfo *seqColInfo = getColumnInfo(columnList, BLXCOL_SEQUENCE);
 
             selectClickedSnp(snpTrack, seqColInfo->headerWidget, detailView, event->x, event->y, TRUE, UNSET_INT); /* SNPs are always expanded in the SNP track */
-            
+
             detailViewRefreshAllHeaders(detailView);
-          }      
+          }
         else if (event->type == GDK_2BUTTON_PRESS) /* double-click */
           {
-            /* If a variation was double-clicked, open its URL in a browser. 
+            /* If a variation was double-clicked, open its URL in a browser.
              * If multiple are selected, use the last-selected one. */
             GList *seqItem = g_list_last(blxWindowGetSelectedSeqs(blxWindow));
-            
+
             if (seqItem)
               {
                 BlxSequence *seq = (BlxSequence*)(seqItem->data);
@@ -5166,10 +5167,10 @@ static gboolean onButtonPressSnpTrack(GtkWidget *snpTrack, GdkEventButton *event
   }
 
   if (!handled)
-    { 
+    {
       propagateEventButton(snpTrack, detailView, event);
     }
-  
+
   return handled;
 }
 
@@ -5178,7 +5179,7 @@ static gboolean onButtonPressSnpTrack(GtkWidget *snpTrack, GdkEventButton *event
 static gboolean onButtonPressDetailView(GtkWidget *detailView, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   const gboolean shiftModifier = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
 
   switch (event->button)
@@ -5186,16 +5187,16 @@ static gboolean onButtonPressDetailView(GtkWidget *detailView, GdkEventButton *e
     case 2:
     {
       /* Middle button: select the base index at the clicked coords */
-      
+
       /* First make sure the detail view trees are fully drawn (so that the
        * cached drawable is up to date - see notes in onExposeDetailViewTree)
        * and then set the mouse-drag flag. */
       detailViewRedrawAll(detailView);
       gdk_window_process_all_updates();
       setMouseDragMode(TRUE);
-      
+
       int baseIdx = getBaseIndexAtDetailViewCoords(detailView, event->x, event->y);
-      
+
       if (baseIdx != UNSET_INT)
         {
           /* For protein matches, select the first base in the triplet */
@@ -5203,11 +5204,11 @@ static gboolean onButtonPressDetailView(GtkWidget *detailView, GdkEventButton *e
           const int frame = detailViewGetActiveFrame(detailView);
           detailViewSetSelectedDisplayIdx(detailView, baseIdx, frame, baseNum, FALSE, TRUE, shiftModifier);
         }
-      
+
       handled = TRUE;
       break;
     }
-      
+
     case 3:
     {
       /* Right button: store the clicked coord (required for copying ref seq),
@@ -5219,17 +5220,17 @@ static gboolean onButtonPressDetailView(GtkWidget *detailView, GdkEventButton *e
           const int frame = detailViewGetActiveFrame(detailView);
           detailViewSetClickedBaseIdx(detailView, baseIdx, frame, baseNum, FALSE, TRUE);
         }
-      
+
       GtkWidget *mainmenu = blxWindowGetMainMenu(detailViewGetBlxWindow(detailView));
       gtk_menu_popup (GTK_MENU(mainmenu), NULL, NULL, NULL, NULL, event->button, event->time);
       handled = TRUE;
       break;
     }
-      
+
     default:
       break;
   };
-  
+
   return handled;
 }
 
@@ -5239,13 +5240,13 @@ static gboolean onMouseMoveDetailView(GtkWidget *detailView, GdkEventMotion *eve
   gboolean handled = FALSE;
 
   const gboolean shiftModifier = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
-  
+
   if (event->state & GDK_BUTTON2_MASK)
     {
       /* Moving mouse with middle mouse button down. Update the currently-selected base
        * (but don't re-centre on the selected base until the mouse button is released). */
       const int baseIdx = getBaseIndexAtDetailViewCoords(detailView, event->x, event->y);
-      
+
       if (baseIdx != UNSET_INT)
         {
           /* For protein matches, get the 1st base in the peptide */
@@ -5255,10 +5256,10 @@ static gboolean onMouseMoveDetailView(GtkWidget *detailView, GdkEventMotion *eve
           /* If shift is pressed, extend the current selection range */
           detailViewSetSelectedDisplayIdx(detailView, baseIdx, frame, baseNum, FALSE, TRUE, shiftModifier);
         }
-      
+
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -5269,7 +5270,7 @@ static gboolean onMouseMoveDetailView(GtkWidget *detailView, GdkEventMotion *eve
 static gboolean onScrollDetailView(GtkWidget *detailView, GdkEventScroll *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   switch (event->direction)
     {
       case GDK_SCROLL_LEFT:
@@ -5293,7 +5294,7 @@ static gboolean onScrollDetailView(GtkWidget *detailView, GdkEventScroll *event,
           break;
         }
     };
-  
+
   return handled;
 }
 
@@ -5301,13 +5302,13 @@ static gboolean onScrollDetailView(GtkWidget *detailView, GdkEventScroll *event,
 static gboolean onButtonReleaseDetailView(GtkWidget *detailView, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   /* Right button: show context menu (handled in button-press event) */
   if (event->button == 3)
     {
       handled = TRUE;
     }
-  
+
   /* Middle button: scroll the selected base index to the centre (unless CTRL is pressed) */
   if (event->button == 2)
     {
@@ -5315,29 +5316,29 @@ static gboolean onButtonReleaseDetailView(GtkWidget *detailView, GdkEventButton
       setMouseDragMode(FALSE);
 
       const gboolean ctrlModifier = (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
-      
+
       if (!ctrlModifier)
         {
           /* Move the scrollbar so that the currently-selected base index is at the centre */
           const gboolean selectedBaseSet = detailViewGetSelectedIdxSet(detailView);
           const int selectedBaseIdx = detailViewGetSelectedDisplayIdx(detailView);
-          
+
           if (selectedBaseSet)
             {
               /* The coord is in terms of the display coords, i.e. whatever the displayed seq type is. */
               const BlxSeqType seqType = detailViewGetSeqType(detailView);
               const IntRange* const displayRange = detailViewGetDisplayRange(detailView);
-              
+
               int newStart = selectedBaseIdx - (displayRange->length() / 2);
               setDetailViewStartIdx(detailView, newStart, seqType);
             }
         }
 
       detailViewRedrawAll(detailView);
-      
+
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -5377,7 +5378,7 @@ static gboolean onButtonPressSeqColHeader(GtkWidget *header, GdkEventButton *eve
 
   const gboolean shiftModifier = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
   GtkWidget *detailView = GTK_WIDGET(data);
-  
+
   switch (event->button)
   {
     case 1:
@@ -5389,7 +5390,7 @@ static gboolean onButtonPressSeqColHeader(GtkWidget *header, GdkEventButton *eve
             const int clickedBase = seqColHeaderGetBase(header, 1, detailViewGetNumFrames(detailView));
 
             selectClickedSnp(header, NULL, detailView, event->x, event->y, FALSE, clickedBase); /* SNPs are always un-expanded in the DNA track */
-            
+
             detailViewRefreshAllHeaders(detailView);
           }
         else if (event->type == GDK_2BUTTON_PRESS)
@@ -5397,11 +5398,11 @@ static gboolean onButtonPressSeqColHeader(GtkWidget *header, GdkEventButton *eve
             /* Double-click: toggle variations-track visibility */
             BlxContext *bc = detailViewGetContext(detailView);
             const gboolean showTrack = !bc->flags[BLXFLAG_SHOW_VARIATION_TRACK];
-            
+
             /* If we're enabling the variations track, also make sure that variations are highlighted in the header */
             if (showTrack)
               bc->flags[BLXFLAG_HIGHLIGHT_VARIATIONS] = TRUE;
-            
+
             bc->flags[BLXFLAG_SHOW_VARIATION_TRACK] = showTrack;
             detailViewUpdateShowSnpTrack(detailView, showTrack);
           }
@@ -5409,7 +5410,7 @@ static gboolean onButtonPressSeqColHeader(GtkWidget *header, GdkEventButton *eve
         handled = TRUE;
         break;
       }
-      
+
     case 2:
       {
         /* Middle button: select the nucleotide that was clicked on. */
@@ -5417,7 +5418,7 @@ static gboolean onButtonPressSeqColHeader(GtkWidget *header, GdkEventButton *eve
         handled = TRUE;
         break;
       }
-      
+
     case 3: /* right button */
       {
         handled = detailViewHeaderShowContextMenu(header, detailView, event);
@@ -5429,10 +5430,10 @@ static gboolean onButtonPressSeqColHeader(GtkWidget *header, GdkEventButton *eve
   }
 
   if (!handled)
-    { 
+    {
       propagateEventButton(header, detailView, event);
     }
-  
+
   return handled;
 }
 
@@ -5440,19 +5441,19 @@ static gboolean onButtonPressSeqColHeader(GtkWidget *header, GdkEventButton *eve
 static gboolean onButtonReleaseSeqColHeader(GtkWidget *header, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   /* Middle button: scroll the selected base index to the centre (unless CTRL is pressed) */
   if (event->button == 2)
     {
       const gboolean ctrlModifier = (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
-      
+
       if (!ctrlModifier)
         {
           /* Move the scrollbar so that the currently-selected base index is at the centre */
           GtkWidget *detailView = GTK_WIDGET(data);
           detailViewCentreOnSelection(detailView);
         }
-      
+
       handled = TRUE;
     }
 
@@ -5476,17 +5477,17 @@ static gboolean onMouseMoveSeqColHeader(GtkWidget *header, GdkEventMotion *event
        * feedback area */
       int baseIdx, frame, baseNum;
       getSeqColHeaderClickedNucleotide(header, detailView, event->x, event->y, &baseIdx, &frame, &baseNum);
-      
+
       if (baseIdx != UNSET_INT && frame != UNSET_INT && baseNum != UNSET_INT)
         {
           BlxContext *bc = detailViewGetContext(detailView);
           const int dnaIdx = convertDisplayIdxToDnaIdx(baseIdx, bc->seqType, frame, baseNum, bc->numFrames, bc->displayRev, &bc->refSeqRange);
           const BlxStrand strand = blxWindowGetActiveStrand(detailViewGetBlxWindow(detailView));
-          
+
           updateFeedbackAreaNucleotide(detailView, dnaIdx, strand);
         }
     }
-  
+
   return TRUE;
 }
 
@@ -5499,22 +5500,22 @@ void updateDynamicColumnWidths(GtkWidget *detailView)
    * other (visible) column widths and subtract from the allocation width. */
   int width = detailView->allocation.width;
   BlxColumnInfo *seqColInfo = NULL;
-  
+
   GList *listItem = detailViewGetColumnList(detailView);
   for ( ; listItem; listItem = listItem->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)(listItem->data);
-      
+
       if (columnInfo->columnId == BLXCOL_SEQUENCE)
         seqColInfo = columnInfo;
       else if (columnInfo->showColumn && columnInfo->dataLoaded)
         width -= columnInfo->width;
     }
-      
+
   if (seqColInfo && seqColInfo->width != width)
     {
       seqColInfo->width = width;
-  
+
       callFuncOnAllDetailViewTrees(detailView, resizeTreeColumns, NULL);
       resizeDetailViewHeaders(detailView);
 
@@ -5535,7 +5536,7 @@ static void swapTreeVisibility(GtkWidget *detailView)
     {
       GtkWidget *tree1 = detailViewGetTreeContainer(detailView, BLXSTRAND_FORWARD, 1);
       GtkWidget *tree2 = detailViewGetTreeContainer(detailView, BLXSTRAND_REVERSE, 1);
-      
+
       if (widgetGetHidden(tree1) != widgetGetHidden(tree2))
         {
           widgetSetHidden(tree1, !widgetGetHidden(tree1));
@@ -5550,7 +5551,7 @@ static void swapGridVisibility(GtkWidget *bigPicture)
 {
   GtkWidget *grid1 = bigPictureGetFwdGrid(bigPicture);
   GtkWidget *grid2 = bigPictureGetRevGrid(bigPicture);
-  
+
   if (widgetGetHidden(grid1) != widgetGetHidden(grid2))
     {
       widgetSetHidden(grid1, !widgetGetHidden(grid1));
@@ -5564,7 +5565,7 @@ static void swapExonViewVisibility(GtkWidget *bigPicture)
 {
   GtkWidget *exonView1 = bigPictureGetFwdExonView(bigPicture);
   GtkWidget *exonView2 = bigPictureGetRevExonView(bigPicture);
-  
+
   if (widgetGetHidden(exonView1) != widgetGetHidden(exonView2))
     {
       widgetSetHidden(exonView1, !widgetGetHidden(exonView1));
@@ -5582,7 +5583,7 @@ void toggleStrand(GtkWidget *detailView)
 
   /* Update the flag */
   blxContext->displayRev = !blxContext->displayRev;
-  
+
   /* Invert the display range for both detail view and big picture */
   IntRange *bpRange = bigPictureGetDisplayRange(bigPicture);
   const IntRange* const fullRange = &blxContext->fullDisplayRange;
@@ -5598,18 +5599,18 @@ void toggleStrand(GtkWidget *detailView)
    * have changed and need updating in the index structs. */
   DetailViewProperties *properties = detailViewGetProperties(detailView);
   detailViewRefreshSelection(detailView);
- 
+
   /* Re-calculate the cached display ranges for the MSPs */
   cacheMspDisplayRanges(blxContext, properties->numUnalignedBases);
-  
+
   /* Update the feedback box */
   updateFeedbackBox(detailView);
-  
+
   /* If one grid/tree is hidden and the other visible, toggle which is hidden */
   swapTreeVisibility(detailView);
   swapGridVisibility(bigPicture);
   swapExonViewVisibility(bigPicture);
-  
+
   /* Toggle the order of the trees and grids. */
   refreshTreeOrder(detailView);
   refreshGridOrder(bigPicture);
@@ -5621,10 +5622,10 @@ void toggleStrand(GtkWidget *detailView)
   callFuncOnAllDetailViewTrees(detailView, refreshTreeHeaders, NULL);
   callFuncOnAllDetailViewTrees(detailView, refilterTree, NULL);
   detailViewRedrawAll(detailView);
-  
+
   /* Redraw the grids and grid headers */
   refreshBigPictureDisplayRange(bigPicture, FALSE);
-  
+
   DEBUG_EXIT("toggleStrand returning");
 }
 
@@ -5638,19 +5639,19 @@ void goToDetailViewCoord(GtkWidget *detailView, const BlxSeqType coordSeqType)
   static gboolean toplevelCoords = FALSE;
 
   BlxContext *bc = detailViewGetContext(detailView);
-  
+
   /* Pop up a dialog to request a coord from the user */
   char *title = g_strdup_printf("%sGo to position", blxGetTitlePrefix(bc));
 
   GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
-                                                  NULL, 
+                                                  NULL,
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR),
                                                   GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                                   GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                                   NULL);
 
   g_free(title);
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
   GtkWidget *contentArea = GTK_DIALOG(dialog)->vbox;
   const int padding = 4;
@@ -5682,18 +5683,18 @@ void goToDetailViewCoord(GtkWidget *detailView, const BlxSeqType coordSeqType)
 
       /* Convert the input string to an int */
       int requestedCoord = atoi(inputText);
-      
+
       if (requestedCoord)
         {
           /* Remember this input for next time */
           sprintf(defaultInput, "%d", requestedCoord);
-          
+
           int coord = requestedCoord;
-          
-          /* If display coords are negated, assume the user has entered a 
+
+          /* If display coords are negated, assume the user has entered a
            * negative coord too, and un-negate it. */
           const gboolean negate = negateCoords(bc);
-          
+
           if (negate)
             {
               coord *= -1;
@@ -5712,7 +5713,7 @@ void goToDetailViewCoord(GtkWidget *detailView, const BlxSeqType coordSeqType)
               g_debug("Coord '%d' does not lie within the reference sequence range [%d %d]; trying '%d'\n", requestedCoord, negate ? bc->refSeqRange.max() * -1 : bc->refSeqRange.min(), negate ? bc->refSeqRange.min() * -1 : bc->refSeqRange.max(), requestedCoord * -1);
               coord *= -1;
             }
-          
+
           if (valueWithinRange(coord, &bc->refSeqRange))
             {
               const int activeFrame = detailViewGetActiveFrame(detailView);
@@ -5740,7 +5741,7 @@ void detailViewSetSortColumn(GtkWidget *detailView, const BlxColumnId sortColumn
   const int numColumns = g_list_length(columnList);
 
   if (numColumns > 0)
-    {      
+    {
       if (properties->sortColumns[0] != sortColumn)
         {
           properties->sortColumns[0] = sortColumn;
@@ -5759,7 +5760,7 @@ static gboolean findNextMatchInTree(GtkTreeModel *model, GtkTreePath *path, GtkT
 
   /* Loop through all MSPs in this tree row. */
   GList* mspListItem = treeGetMsps(model, iter);
-  
+
   for ( ; mspListItem; mspListItem = mspListItem->next)
     {
       MSP *msp = (MSP*)(mspListItem->data);
@@ -5773,10 +5774,10 @@ static gboolean findNextMatchInTree(GtkTreeModel *model, GtkTreePath *path, GtkT
            * ignorning zero and negative offsets (negative means its the wrong direction) */
           const int offset1 = (msp->qRange.min() - searchData->startDnaIdx) * searchData->searchDirection;
           const int offset2 = (msp->qRange.max() - searchData->startDnaIdx) * searchData->searchDirection;
-          
+
           int currentFrame = mspGetRefFrame(msp, searchData->seqType);
           int currentBest = UNSET_INT;
-          
+
           if (offset1 > 0 && (offset2 <= 0 || offset2 >= offset1))
             {
               currentBest = offset1;
@@ -5791,15 +5792,15 @@ static gboolean findNextMatchInTree(GtkTreeModel *model, GtkTreePath *path, GtkT
 
               /* Check if this is the first one we've looked at */
               useNew |= (searchData->offset == UNSET_INT);
-              
+
               /* Check if this offset is smaller than the previous best */
               useNew |= (currentBest < searchData->offset);
-              
-              /* If it's the same as the previous best, use the one with the smallest 
+
+              /* If it's the same as the previous best, use the one with the smallest
                * frame number, i.e. give preference to the topmost frame (in the hope
                * that this will be the least confusing!) */
               useNew |= (currentBest == searchData->offset && currentFrame < searchData->foundFrame);
-              
+
               if (useNew)
                 {
                   searchData->offset = currentBest;
@@ -5809,7 +5810,7 @@ static gboolean findNextMatchInTree(GtkTreeModel *model, GtkTreePath *path, GtkT
             }
         }
     }
-  
+
   return FALSE;
 }
 
@@ -5822,17 +5823,17 @@ static gboolean findNextMatchInTree(GtkTreeModel *model, GtkTreePath *path, GtkT
 static MSP* goToNextMatch(GtkWidget *detailView,
                           const int startDnaIdx,
                           const gboolean searchRight,
-                          GList *seqList, 
+                          GList *seqList,
                           const gboolean extend)
 {
   BlxContext *bc = detailViewGetContext(detailView);
-  
+
   const int searchDirection = (searchRight != bc->displayRev) ? 1 : -1;
 
-  MatchSearchData searchData = {startDnaIdx, 
-                                searchRight, 
-                                searchDirection, 
-                                bc->displayRev, 
+  MatchSearchData searchData = {startDnaIdx,
+                                searchRight,
+                                searchDirection,
+                                bc->displayRev,
                                 bc->seqType,
                                 bc->numFrames,
                                 &bc->refSeqRange,
@@ -5848,7 +5849,7 @@ static MSP* goToNextMatch(GtkWidget *detailView,
     {
       GtkWidget *treeContainer = detailViewGetTreeContainer(detailView, BLXSTRAND_FORWARD, frame);
       GtkWidget *tree = treeContainerGetTree(GTK_CONTAINER(treeContainer));
-      
+
       if (GTK_WIDGET_VISIBLE(tree) && gtk_widget_get_parent(treeContainer)) /* ignore if not currently included in view */
         {
           GtkTreeModel *model = treeGetBaseDataModel(GTK_TREE_VIEW(tree));
@@ -5857,14 +5858,14 @@ static MSP* goToNextMatch(GtkWidget *detailView,
 
       treeContainer = detailViewGetTreeContainer(detailView, BLXSTRAND_REVERSE, frame);
       tree = treeContainerGetTree(GTK_CONTAINER(treeContainer));
-      
+
       if (GTK_WIDGET_VISIBLE(tree) && gtk_widget_get_parent(treeContainer)) /* ignore if not currently included in view */
         {
           GtkTreeModel *model = treeGetBaseDataModel(GTK_TREE_VIEW(tree));
           gtk_tree_model_foreach(model, findNextMatchInTree, &searchData);
         }
     }
-  
+
   if (searchData.offset != UNSET_INT)
     {
       /* Offset the start coord by the found amount. */
@@ -5873,7 +5874,7 @@ static MSP* goToNextMatch(GtkWidget *detailView,
       callFuncOnAllDetailViewTrees(detailView, treeScrollSelectionIntoView, NULL);
       detailViewRedrawAll(detailView);
     }
-  
+
   return searchData.foundMsp;
 }
 
@@ -5886,17 +5887,17 @@ MSP* prevMatch(GtkWidget *detailView, GList *seqList, const gboolean extend)
   int startDnaIdx = detailViewGetSelectedDnaIdx(detailView);
   int startCoord = detailViewGetSelectedDisplayIdx(detailView);
   const IntRange* const displayRange = detailViewGetDisplayRange(detailView);
-  
+
   if (!valueWithinRange(startCoord, displayRange))
     {
       startCoord = displayRange->centre();
-      
+
       /* Use base 1 within the currently selected frame for this display coord */
       int frame = detailViewGetActiveFrame(detailView);
       BlxContext *bc = detailViewGetContext(detailView);
       startDnaIdx = convertDisplayIdxToDnaIdx(startCoord, bc->seqType, frame, 1, bc->numFrames, bc->displayRev, &bc->refSeqRange);
     }
-  
+
   return goToNextMatch(detailView, startDnaIdx, FALSE, seqList, extend);
 }
 
@@ -5909,17 +5910,17 @@ MSP* nextMatch(GtkWidget *detailView, GList *seqList, const gboolean extend)
   int startDnaIdx = detailViewGetSelectedDnaIdx(detailView);
   int startCoord = detailViewGetSelectedDisplayIdx(detailView);
   const IntRange* const displayRange = detailViewGetDisplayRange(detailView);
-  
+
   if (!valueWithinRange(startCoord, displayRange))
     {
       startCoord = displayRange->centre();
-      
+
       /* Use base 1 within the currently selected frame for this display coord */
       int frame = detailViewGetActiveFrame(detailView);
       BlxContext *bc = detailViewGetContext(detailView);
       startDnaIdx = convertDisplayIdxToDnaIdx(startCoord, bc->seqType, frame, 1, bc->numFrames, bc->displayRev, &bc->refSeqRange);
     }
-  
+
   return goToNextMatch(detailView, startDnaIdx, TRUE, seqList, extend);
 }
 
@@ -5930,7 +5931,7 @@ MSP* firstMatch(GtkWidget *detailView, GList *seqList, const gboolean extend)
   /* Jump to the nearest match to the start of the ref seq */
   const IntRange* const refSeqRange = detailViewGetRefSeqRange(detailView);
   const int startIdx = detailViewGetDisplayRev(detailView) ? refSeqRange->max() : refSeqRange->min();
-  
+
   return goToNextMatch(detailView, startIdx, TRUE, seqList, extend);
 }
 
@@ -5955,7 +5956,7 @@ static void addColumnsToHeaderBar(GtkBox *headerBar, GList *columnList)
 {
   /* Loop through each column and add its header widget to the header bar */
   GList *columnItem = columnList;
-  
+
   for ( ; columnItem; columnItem = columnItem->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)(columnItem->data);
@@ -5969,21 +5970,21 @@ static void addColumnsToHeaderBar(GtkBox *headerBar, GList *columnList)
 
 
 /* Create the header bar for the detail view. This contains the labels for the
- * detail-view trees (since we only want one label at the top, rather than 
+ * detail-view trees (since we only want one label at the top, rather than
  * individual labels for each tree). For protein sequence matches, the header
  * for the sequence column will also show the DNA sequence (separated into reading
- * frames). 
- * Column data is compiled into the detailViewColumns return argument. 
+ * frames).
+ * Column data is compiled into the detailViewColumns return argument.
  * If includeSnpTrack is true then the snp track widget will also be created. */
-static GtkWidget* createDetailViewHeader(GtkWidget *detailView, 
-                                         const BlxSeqType seqType, 
+static GtkWidget* createDetailViewHeader(GtkWidget *detailView,
+                                         const BlxSeqType seqType,
                                          const int numFrames,
                                          GList *columnList,
                                          const gboolean includeSnpTrack,
                                          GtkWidget **snpTrack)
 {
   GtkBox *headerBar = GTK_BOX(gtk_hbox_new(FALSE, 0)); /* hbox for the column headers */
-  
+
   /* Create a SNP track, if requested */
   if (includeSnpTrack && snpTrack)
     {
@@ -6003,13 +6004,13 @@ GtkWidget* createSnpTrackHeader(GtkWidget *detailView, const BlxStrand strand)
 {
   GtkWidget *snpTrack = gtk_layout_new(NULL, NULL);
 
-  gtk_widget_set_name(snpTrack, SNP_TRACK_HEADER_NAME);  
+  gtk_widget_set_name(snpTrack, SNP_TRACK_HEADER_NAME);
   snpTrackSetStrand(snpTrack, strand);
 
   gtk_widget_add_events(snpTrack, GDK_BUTTON_PRESS_MASK);
   g_signal_connect(G_OBJECT(snpTrack), "expose-event", G_CALLBACK(onExposeVariationsTrack), detailView);
   g_signal_connect(G_OBJECT(snpTrack), "button-press-event", G_CALLBACK(onButtonPressSnpTrack), detailView);
-  
+
   return snpTrack;
 }
 
@@ -6024,7 +6025,7 @@ static void createSeqColHeader(GtkWidget *detailView,
   if (seqType == BLXSEQ_PEPTIDE)
     {
       GtkWidget *header = gtk_vbox_new(FALSE, 0);
-      
+
       int frame = 0;
       for ( ; frame < numFrames; ++frame)
         {
@@ -6059,11 +6060,11 @@ static void createSeqColHeader(GtkWidget *detailView,
  GtkWidget* createDetailViewScrollBar(GtkAdjustment *adjustment, GtkWidget *detailView)
 {
   GtkWidget *scrollBar = gtk_hscrollbar_new(adjustment);
-  
+
   /* Connect signals */
   g_signal_connect(G_OBJECT(adjustment), "changed", G_CALLBACK(onScrollRangeChangedDetailView), detailView);
   g_signal_connect(G_OBJECT(adjustment), "value-changed", G_CALLBACK(onScrollPosChangedDetailView), detailView);
-  
+
   return scrollBar;
 }
 
@@ -6085,7 +6086,7 @@ static void createFeedbackBoxEntry(GtkBox *parent,
 
   gtk_box_pack_start(GTK_BOX(parent), entry, FALSE, FALSE, 0);
 
-  /* We want the box to be printed, so connect the expose function that will 
+  /* We want the box to be printed, so connect the expose function that will
    * draw to a pixmap for printing */
   g_signal_connect(G_OBJECT(entry), "expose-event", cb_func, cb_data);
 }
@@ -6108,30 +6109,30 @@ static GtkWidget* createFeedbackBox(GtkToolbar *toolbar, char *windowColor)
   /* Match sequence "name:coord/len" */
   gtk_box_pack_start(box, gtk_label_new("  "), FALSE, FALSE, 0);
 
-  createFeedbackBoxEntry(box, DETAIL_VIEW_FEEDBACK_MATCH_NAME, DETAIL_VIEW_FEEDBACK_MATCH_NAME_TOOLTIP, 
+  createFeedbackBoxEntry(box, DETAIL_VIEW_FEEDBACK_MATCH_NAME, DETAIL_VIEW_FEEDBACK_MATCH_NAME_TOOLTIP,
                          G_CALLBACK(onExposePrintable), NULL);
 
   gtk_box_pack_start(box, gtk_label_new(":"), FALSE, FALSE, 0);
 
-  createFeedbackBoxEntry(box, DETAIL_VIEW_FEEDBACK_MATCH_COORD, "Match sequence coord(s)", 
+  createFeedbackBoxEntry(box, DETAIL_VIEW_FEEDBACK_MATCH_COORD, "Match sequence coord(s)",
                          G_CALLBACK(onExposePrintable), NULL);
 
   gtk_box_pack_start(box, gtk_label_new("/"), FALSE, FALSE, 0);
 
-  createFeedbackBoxEntry(box, DETAIL_VIEW_FEEDBACK_MATCH_LEN, "Match sequence length", 
+  createFeedbackBoxEntry(box, DETAIL_VIEW_FEEDBACK_MATCH_LEN, "Match sequence length",
                          G_CALLBACK(onExposePrintable), NULL);
 
   /* Read depth at selected coord(s) */
   gtk_box_pack_start(box, gtk_label_new("  "), FALSE, FALSE, 0);
-  
-  createFeedbackBoxEntry(box, DETAIL_VIEW_FEEDBACK_DEPTH, DETAIL_VIEW_FEEDBACK_DEPTH_TOOLTIP, 
+
+  createFeedbackBoxEntry(box, DETAIL_VIEW_FEEDBACK_DEPTH, DETAIL_VIEW_FEEDBACK_DEPTH_TOOLTIP,
                          G_CALLBACK(onExposePrintable), NULL);
-  
+
   return feedbackBox;
 }
 
 
-/* Create the status bar for the detail-view toolbar. (This feeds back info to the user 
+/* Create the status bar for the detail-view toolbar. (This feeds back info to the user
  * about the currently-moused-over sequence.) */
 static GtkWidget* createStatusBar(GtkToolbar *toolbar, char *windowColor)
 {
@@ -6152,7 +6153,7 @@ static GtkWidget* createStatusBar(GtkToolbar *toolbar, char *windowColor)
 
 
 /* Create the detail view toolbar */
-static GtkWidget* createDetailViewButtonBar(GtkWidget *detailView, 
+static GtkWidget* createDetailViewButtonBar(GtkWidget *detailView,
                                             GtkWidget *toolbarIn,
                                             BlxBlastMode mode,
                                             const BlxColumnId sortColumn,
@@ -6164,7 +6165,7 @@ static GtkWidget* createDetailViewButtonBar(GtkWidget *detailView,
   GtkToolbar *toolbar = GTK_TOOLBAR(toolbarIn);
 
   blxSetWidgetColor(GTK_WIDGET(toolbar), windowColor);
-  
+
   gtk_toolbar_set_style(toolbar, GTK_TOOLBAR_ICONS);
   gtk_toolbar_set_icon_size(toolbar, GTK_ICON_SIZE_SMALL_TOOLBAR);
 
@@ -6174,9 +6175,9 @@ static GtkWidget* createDetailViewButtonBar(GtkWidget *detailView,
   /* Create a parent hbox which will hold the main toolbar
    * and the detail-view tools. (We do this rather than putting
    * the detail-view tools directly into the toolbar so that
-   * we have more control over spacing. In particular, the 
+   * we have more control over spacing. In particular, the
    * toolbar tools go into a nice drop-down box when there isn't
-   * enough space, but the detail-view tools won't display if 
+   * enough space, but the detail-view tools won't display if
    * that happens, so we keep them separate.) */
   GtkBox *hbox = GTK_BOX(gtk_hbox_new(FALSE, 0));
   gtk_box_pack_start(hbox, toolbarIn, TRUE, TRUE, 0);
@@ -6196,9 +6197,9 @@ static GtkWidget* createDetailViewButtonBar(GtkWidget *detailView,
  * given). The first tree gets associated with grid1 and appended to list1, and the second
  * with grid2 and list2. If hasHeaders is true, the first tree will have visible headers. */
 static void createTwoPanedTrees(GtkWidget *detailView,
-                                GtkPaned *panedWin, 
+                                GtkPaned *panedWin,
                                 GtkCellRenderer *renderer,
-                                GtkWidget *grid1, 
+                                GtkWidget *grid1,
                                 GtkWidget *grid2,
                                 GList **list1,
                                 GList **list2,
@@ -6211,7 +6212,7 @@ static void createTwoPanedTrees(GtkWidget *detailView,
 {
   GtkWidget *tree1 = createDetailViewTree(grid1, detailView, renderer, list1, columnList, seqType, refSeqName, frame1, includeSnpTrack);
   GtkWidget *tree2 = createDetailViewTree(grid2, detailView, renderer, list2, columnList, seqType, refSeqName, frame2, includeSnpTrack);
-  
+
   if (panedWin)
     {
       gtk_paned_pack1(GTK_PANED(panedWin), tree1, TRUE, TRUE);
@@ -6235,7 +6236,7 @@ static void createThreePanedTrees(GtkWidget *detailView,
                                   const gboolean includeSnpTrack)
 {
   const int frame1 = 1, frame2 = 2, frame3 = 3;
-  
+
   /* Create a tree for pane1 (but only add it to the detailView if instructed to).
    * The first tree has headers. */
   GtkWidget *tree1 = createDetailViewTree(grid, detailView, renderer, list, columnList, seqType, refSeqName, frame1, includeSnpTrack);
@@ -6244,13 +6245,13 @@ static void createThreePanedTrees(GtkWidget *detailView,
   if (addToDetailView)
     {
       gtk_paned_pack1(GTK_PANED(panedWin), tree1, TRUE, TRUE);
-      
+
       /* Create another paned widget and place it in pane 2 */
       nestedPanedWidget = GTK_PANED(gtk_vpaned_new());
       gtk_paned_pack2(panedWin, GTK_WIDGET(nestedPanedWidget), TRUE, TRUE);
     }
-  
-  /* Create two more trees (and place them in the nested paned widget, if it is not null). 
+
+  /* Create two more trees (and place them in the nested paned widget, if it is not null).
    * Neither of these trees should have headers. */
   createTwoPanedTrees(detailView, nestedPanedWidget, renderer, grid, grid, list, list, seqType, columnList, refSeqName, frame2, frame3, includeSnpTrack);
 }
@@ -6258,11 +6259,11 @@ static void createThreePanedTrees(GtkWidget *detailView,
 
 /* Create the trees for the detail view, creating sub-panes if necessary depending
  * on how many trees we need */
-static void createDetailViewPanes(GtkWidget *detailView, 
+static void createDetailViewPanes(GtkWidget *detailView,
                                   GtkPaned *panedWin,
                                   GtkCellRenderer *renderer,
-                                  GtkWidget *fwdStrandGrid, 
-                                  GtkWidget *revStrandGrid, 
+                                  GtkWidget *fwdStrandGrid,
+                                  GtkWidget *revStrandGrid,
                                   const int numFrames,
                                   GList **fwdStrandTrees,
                                   GList **revStrandTrees,
@@ -6274,13 +6275,13 @@ static void createDetailViewPanes(GtkWidget *detailView,
   if (numFrames == 1)
     {
       /* DNA matches: we need 2 trees, one for the forward strand and one for the reverse. */
-      createTwoPanedTrees(detailView, 
-                          panedWin, 
+      createTwoPanedTrees(detailView,
+                          panedWin,
                           renderer,
-                          fwdStrandGrid, 
-                          revStrandGrid, 
-                          fwdStrandTrees, 
-                          revStrandTrees, 
+                          fwdStrandGrid,
+                          revStrandGrid,
+                          fwdStrandTrees,
+                          revStrandTrees,
                           seqType,
                           columnList,
                           refSeqName,
@@ -6303,7 +6304,7 @@ static void createDetailViewPanes(GtkWidget *detailView,
  *                     Initialization                      *
  ***********************************************************/
 
-/* Add the MSPs to the detail-view trees. Calculates and returns the lowest ID 
+/* Add the MSPs to the detail-view trees. Calculates and returns the lowest ID
  * out of all the blast matches. modelId specifies which tree data model should
  * be active at the start. If create is true, the tree data stores are created;
  * otherwise we assume they already exist. */
@@ -6317,7 +6318,7 @@ void detailViewAddMspData(GtkWidget *detailView, MSP *mspList, GList *seqList)
   /* Loop through each MSP, and add it to the correct tree based on its strand and
    * reading frame. Also find the lowest ID value out of all the matches. */
   MSP *msp = mspList;
-  
+
   for ( ; msp; msp = msp->next)
     {
       /* Only add matches/exons to trees. For exons, only add the parent exon;
@@ -6340,13 +6341,13 @@ void detailViewAddMspData(GtkWidget *detailView, MSP *mspList, GList *seqList)
             }
         }
     }
-    
-  /* Finally, create a custom-filtered version of the data store for each tree. We do 
+
+  /* Finally, create a custom-filtered version of the data store for each tree. We do
    * this AFTER adding the data so that it doesn't try to re-filter every time we add a row.
    * To do: Note that if we're calling this function a second time to add additional rows, the filter
    * will already exist so this may be slow and we may need to look into improving this. */
   callFuncOnAllDetailViewTrees(detailView, treeCreateFilteredDataModel, NULL);
-  
+
   /* Also create a second data store that will store one sequence per row (as opposed to one
    * MSP per row). This data store will be switched in when the user selects 'squash matches'. */
   callFuncOnAllDetailViewTrees(detailView, addSequencesToTree, seqList);
@@ -6366,7 +6367,7 @@ static gboolean onMouseMoveSnpSplitter(GtkWidget *paned, GdkEventMotion *event,
           const int splitterPos = gtk_paned_get_position(GTK_PANED(paned));
           BlxContext *bc = detailViewGetContext(detailView);
 
-          if (splitterPos != 0 && 
+          if (splitterPos != 0 &&
               !(bc->flags[BLXFLAG_SHOW_VARIATION_TRACK] && bc->flags[BLXFLAG_HIGHLIGHT_VARIATIONS]) )
             {
               /* Show the track. We must also enable highlight-variations or it will not make any
@@ -6395,13 +6396,13 @@ static gboolean onMouseMoveSnpSplitter(GtkWidget *paned, GdkEventMotion *event,
 GtkWidget* snpTrackCreatePanedWin(GtkWidget *detailView, GtkWidget *snpTrack, GtkWidget *otherWidget)
 {
   GtkPaned *paned = GTK_PANED(gtk_vpaned_new());
-  gtk_widget_set_name(GTK_WIDGET(paned), SNP_TRACK_CONTAINER_NAME);  
+  gtk_widget_set_name(GTK_WIDGET(paned), SNP_TRACK_CONTAINER_NAME);
 
   /* Top pane is the snp track. Put it inside a scrollwin */
   GtkWidget *snpScrollWin = gtk_scrolled_window_new(NULL, NULL);
   gtk_container_add(GTK_CONTAINER(snpScrollWin), snpTrack);
 
-  gtk_widget_set_name(GTK_WIDGET(snpScrollWin), SNP_TRACK_SCROLL_WIN_NAME);  
+  gtk_widget_set_name(GTK_WIDGET(snpScrollWin), SNP_TRACK_SCROLL_WIN_NAME);
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(snpScrollWin), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
 
   gtk_paned_pack1(paned, snpScrollWin, FALSE, TRUE);
@@ -6421,8 +6422,8 @@ GtkWidget* createDetailView(GtkWidget *blxWindow,
                             BlxContext *bc,
                             GtkContainer *parent,
                             GtkWidget *toolbar,
-                            GtkAdjustment *adjustment, 
-                            GtkWidget *fwdStrandGrid, 
+                            GtkAdjustment *adjustment,
+                            GtkWidget *fwdStrandGrid,
                             GtkWidget *revStrandGrid,
                             MSP *mspList,
                             GList *columnList,
@@ -6439,11 +6440,11 @@ GtkWidget* createDetailView(GtkWidget *blxWindow,
   /* We'll group the trees in their own container so that we can pass them all around
    * together (so that operations like zooming and scrolling can act on the group). The
    * trees might be a direct child of this or a grandchild/grand-grandchild, so we will need
-   * to look at all children recursively and check if they're the correct type. (We'll give 
+   * to look at all children recursively and check if they're the correct type. (We'll give
    * all of our detail-view trees the same name so that we can identify them.) */
   GtkWidget *detailView = gtk_vbox_new(FALSE, 0);
   gtk_container_add(parent, detailView);
-  
+
   GtkWidget *panedWin = gtk_vpaned_new();
   gtk_widget_set_name(panedWin, DETAIL_VIEW_WIDGET_NAME);
 
@@ -6456,7 +6457,7 @@ GtkWidget* createDetailView(GtkWidget *blxWindow,
   GtkWidget *statusBar = NULL;
   GtkWidget *buttonBar = createDetailViewButtonBar(detailView, toolbar, mode, sortColumn, columnList, windowColor, &feedbackBox, &statusBar);
 
-  /* Create the header bar. If viewing protein matches include one SNP track in the detail 
+  /* Create the header bar. If viewing protein matches include one SNP track in the detail
    * view header; otherwise create SNP tracks in each tree header. */
   const gboolean singleSnpTrack = (seqType == BLXSEQ_PEPTIDE);
   GtkWidget *snpTrack = NULL;
@@ -6467,12 +6468,12 @@ GtkWidget* createDetailView(GtkWidget *blxWindow,
 
   /* Create the trees. */
   GList *fwdStrandTrees = NULL, *revStrandTrees = NULL;
-  createDetailViewPanes(detailView, 
+  createDetailViewPanes(detailView,
                         GTK_PANED(panedWin),
                         renderer,
-                        fwdStrandGrid, 
-                        revStrandGrid, 
-                        numFrames, 
+                        fwdStrandGrid,
+                        revStrandGrid,
+                        numFrames,
                         &fwdStrandTrees,
                         &revStrandTrees,
                         seqType,
@@ -6511,17 +6512,17 @@ GtkWidget* createDetailView(GtkWidget *blxWindow,
   g_signal_connect(G_OBJECT(detailView), "motion-notify-event",  G_CALLBACK(onMouseMoveDetailView),     NULL);
   g_signal_connect(G_OBJECT(detailView), "scroll-event",         G_CALLBACK(onScrollDetailView),        NULL);
 
-  DetailViewProperties *properties = detailViewCreateProperties(detailView, 
-                                                                blxWindow, 
+  DetailViewProperties *properties = detailViewCreateProperties(detailView,
+                                                                blxWindow,
                                                                 bc,
                                                                 coverageViewP,
                                                                 renderer,
                                                                 fwdStrandTrees,
                                                                 revStrandTrees,
-                                                                feedbackBox, 
+                                                                feedbackBox,
                                                                 statusBar,
                                                                 columnList,
-                                                                adjustment, 
+                                                                adjustment,
                                                                 startCoord,
                                                                 sortColumn);
 
@@ -6529,4 +6530,3 @@ GtkWidget* createDetailView(GtkWidget *blxWindow,
 
   return detailView;
 }
-
diff --git a/src/blixemApp/detailview.hpp b/src/blixemApp/detailview.hpp
index 555c1d0db89f9ec8a442d1edf2f20636b0c180ce..9fc357697c6c28bff93c0e91c3b15aecdf0e2a65 100644
--- a/src/blixemApp/detailview.hpp
+++ b/src/blixemApp/detailview.hpp
@@ -1,5 +1,6 @@
 /*  File: detailview.c
  *  Author: Gemma Barson, 2009-11-23
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -29,7 +30,7 @@
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
  * Description: The "detail view" section shows the sequence data in detail,
- *              down to the actual nucleotides and peptides. There is a 
+ *              down to the actual nucleotides and peptides. There is a
  *              separate section to show the alignments for each strand and
  *              (in protein mode) reading-frame. Each section is a list of
  *              alignments (called a "tree" in the code - see detailviewtree.h)
@@ -65,7 +66,7 @@ class CoverageViewProperties;
 /* Column name to use when multiple, duplicate reads with different names are
  * shown on the same row. Note that this is a printf format that must take the
  * number of reads as an integer argument. */
-#define DUPLICATE_READS_COLUMN_NAME               "(%d) matches" 
+#define DUPLICATE_READS_COLUMN_NAME               "(%d) matches"
 #define DUPLICATE_READS_COLUMN_NAME_SGL           "(%d) match" /* as above but for when there is just one read */
 
 
@@ -83,7 +84,7 @@ typedef struct _BlxSpliceSite
 
     char donorSiteRevComp[3];           /* Same as donorSite but revcomp'd */
     char acceptorSiteRevComp[3];        /* Same as acceptorSite but revcomp'd */
-    
+
     gboolean bothReqd;                  /* Whether both donor and acceptor sites must match in order to be considered canonical */
   } BlxSpliceSite;
 
@@ -108,14 +109,14 @@ public:
   DetailViewProperties(GtkWidget *detailView_in,
                        GtkWidget *blxWindow_in,
                        BlxContext *bc_in,
-                       CoverageViewProperties *coverageViewP_in, 
+                       CoverageViewProperties *coverageViewP_in,
                        GtkCellRenderer *renderer_in,
                        GList *fwdStrandTrees_in,
                        GList *revStrandTrees_in,
                        GtkWidget *feedbackBox_in,
                        GtkWidget *statusBar_in,
                        GList *columnList_in,
-                       GtkAdjustment *adjustment_in, 
+                       GtkAdjustment *adjustment_in,
                        const int startCoord_in,
                        const BlxColumnId sortColumn_in);
 
@@ -137,13 +138,13 @@ public:
   GtkWidget *feedbackBox;              /* A text box that feeds back info to the user about the currently selected items */
   GtkWidget *statusBar;                /* A status bar that feeds back info to the user about the currently moused-over items */
   BlxColumnId* sortColumns;            /* Array of columns to sort by, in order of priority. The length of this array will be set to the same length as columnList */
-    
+
   GList *fwdStrandTrees;               /* A list of all the trees that show the forward strand of the ref seq */
   GList *revStrandTrees;               /* A list of all the trees that show the reverse strand of the ref seq */
-    
+
   int cellXPadding;                    /* The x padding between the tree cell background area and their drawing area */
   int cellYPadding;                    /* The y padding between the tree cell background area and their drawing area */
-        
+
   DetailViewIndex selectedRangeInit;   /* Caches the initial selected index when selecting a range */
   DetailViewIndex selectedRangeStart;  /* The currently-selected range start (if shift-selecting) */
   DetailViewIndex selectedRangeEnd;    /* The currently-selected range end (if shift-selecting) */
@@ -156,11 +157,11 @@ public:
 
   int snpConnectorHeight;              /* The height of the connector between the SNP track and the DNA base track */
   int numUnalignedBases;               /* If the display-unaligned-sequence option is on, this specifies how many additional bases to show at each end of the alignment */
-        
+
   int exonBoundaryLineWidth;                 /* line width for exon boundaries */
   GdkLineStyle exonBoundaryLineStyle;        /* line style for exon boundaries */
   GdkLineStyle exonBoundaryLineStylePartial; /* line style for exon boundaries (where the boundary is part-way through a codon) */
-    
+
   GSList *spliceSites;           /* List of splice sites that can be found and highlighted by
                                     Blixem */
 
@@ -259,11 +260,11 @@ void                    zoomDetailView(GtkWidget *detailView, const gboolean zoo
 void                    updateDynamicColumnWidths(GtkWidget *detailView);
 void                    refilterDetailView(GtkWidget *detailView, const IntRange* const oldRange);
 
-void                    detailViewSetSelectedDisplayIdx(GtkWidget *detailView, 
-                                                        const int selectedBaseIdx, 
-                                                        const int frame, 
-                                                        const int baseNum, 
-                                                        const gboolean allowScroll, 
+void                    detailViewSetSelectedDisplayIdx(GtkWidget *detailView,
+                                                        const int selectedBaseIdx,
+                                                        const int frame,
+                                                        const int baseNum,
+                                                        const gboolean allowScroll,
                                                         const gboolean scrollMinimum,
                                                         const gboolean extend);
 
@@ -310,9 +311,9 @@ gboolean                onExposeDnaTrack(GtkWidget *headerWidget, GdkEventExpose
 
 void                    selectClickedSnp(GtkWidget *snpTrack,
                                          GtkWidget *colHeader,
-                                         GtkWidget *detailView, 
-                                         const int xIn, 
-                                         const int yIn, 
+                                         GtkWidget *detailView,
+                                         const int xIn,
+                                         const int yIn,
                                          const gboolean expandSnps,
                                          const int clickedBase);
 
@@ -327,7 +328,7 @@ gboolean                onExposeGenericHeader(GtkWidget *headerWidget, GdkEventE
 
 gint                    sortByColumnCompareFunc(GList *mspGList1,
                                                 GList *mspGList2,
-                                                GtkWidget *detailView, 
+                                                GtkWidget *detailView,
                                                 const BlxColumnId sortColumn);
 
 void                    drawHeaderChar(BlxContext *bc,
@@ -343,8 +344,8 @@ GtkWidget*              createDetailView(GtkWidget *blxWindow,
                                          BlxContext *bc,
                                          GtkContainer *parent,
                                          GtkWidget *toolbar,
-                                         GtkAdjustment *adjustment, 
-                                         GtkWidget *fwdStrandGrid, 
+                                         GtkAdjustment *adjustment,
+                                         GtkWidget *fwdStrandGrid,
                                          GtkWidget *revStrandGrid,
                                          MSP *mspList,
                                          GList *columnList,
@@ -358,9 +359,9 @@ GtkWidget*              createDetailView(GtkWidget *blxWindow,
                                          const gboolean optionalDataLoaded,
                                          char *windowColor);
 
-GtkWidget*              createDetailViewScrollBar(GtkAdjustment *adjustment, 
+GtkWidget*              createDetailViewScrollBar(GtkAdjustment *adjustment,
                                                   GtkWidget *blxWindow);
 
-GtkWidget*              snpTrackCreatePanedWin(GtkWidget* detailView, GtkWidget *snpTrack, GtkWidget *otherWidget); 
+GtkWidget*              snpTrackCreatePanedWin(GtkWidget* detailView, GtkWidget *snpTrack, GtkWidget *otherWidget);
 
 #endif /* _detail_view_included_ */
diff --git a/src/blixemApp/detailviewtree.cpp b/src/blixemApp/detailviewtree.cpp
index 99a3e56a2c190136cb77821c5b459668f9b788ae..0a4b21cd2a700d77af64d44d540d3e2d3490d6d4 100644
--- a/src/blixemApp/detailviewtree.cpp
+++ b/src/blixemApp/detailviewtree.cpp
@@ -1,5 +1,6 @@
 /*  File: detailviewtree.c
  *  Author: Gemma Barson, 2009-11-23
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -51,7 +52,7 @@ using namespace std;
 /* Global variables */
 
 /* This enables "mouse-drag" mode: see the expose function for how this is used. */
-static gboolean g_mouse_drag_mode = FALSE;  
+static gboolean g_mouse_drag_mode = FALSE;
 
 
 /* Local function declarations */
@@ -81,10 +82,10 @@ static void assertTree(GtkWidget *tree)
 {
   if (!tree)
     g_error("Tree is null\n");
-  
+
   if (!GTK_IS_WIDGET(tree))
     g_error("Tree is not a valid widget [%p]\n", tree);
-    
+
   if (!GTK_IS_TREE_VIEW(tree))
     g_error("Tree is not a valid tree view [%p]\n", tree);
 
@@ -99,7 +100,7 @@ static void assertTree(GtkWidget *tree)
 static GtkWidget *treeGetDetailView(GtkWidget *tree)
 {
   assertTree(tree);
-  
+
   /* optimisation: cache result, because we know there is only ever one detail view */
   static GtkWidget *detailView = NULL;
 
@@ -108,7 +109,7 @@ static GtkWidget *treeGetDetailView(GtkWidget *tree)
       TreeProperties *properties = treeGetProperties(tree);
       detailView = properties ? properties->detailView : NULL;
     }
-  
+
   return detailView;
 }
 
@@ -184,14 +185,14 @@ static TreeColumnHeaderInfo* treeColumnGetHeaderInfo(GtkWidget *tree, BlxColumnI
   TreeProperties *properties = treeGetProperties(tree);
   GList *headerInfoItem = properties->treeColumnHeaderList;
   TreeColumnHeaderInfo *result = NULL;
-  
+
   for ( ; headerInfoItem && !result; headerInfoItem = headerInfoItem->next)
     {
       TreeColumnHeaderInfo *headerInfo = (TreeColumnHeaderInfo*)(headerInfoItem->data);
-      
+
       /* Loop through each column id included under this header */
       GList *columnIdItem = headerInfo->columnIds;
-      
+
       for ( ; columnIdItem && !result; columnIdItem = columnIdItem->next)
 	{
 	  if (GPOINTER_TO_INT(columnIdItem->data) == columnId)
@@ -200,7 +201,7 @@ static TreeColumnHeaderInfo* treeColumnGetHeaderInfo(GtkWidget *tree, BlxColumnI
 	    }
 	}
     }
-  
+
   return result;
 }
 
@@ -212,7 +213,7 @@ static TreeColumnHeaderInfo* treeColumnGetHeaderInfo(GtkWidget *tree, BlxColumnI
 void callFuncOnAllDetailViewTrees(GtkWidget *detailView, GtkCallback func, gpointer data)
 {
   int numFrames = detailViewGetNumFrames(detailView);
-  
+
   /* Call the function on the forward strand tree and reverse strand tree
    * for each frame. */
   int frame = 1;
@@ -220,12 +221,12 @@ void callFuncOnAllDetailViewTrees(GtkWidget *detailView, GtkCallback func, gpoin
     {
       GtkWidget *fwdTree = detailViewGetTree(detailView, BLXSTRAND_FORWARD, frame);
       GtkWidget *revTree = detailViewGetTree(detailView, BLXSTRAND_REVERSE, frame);
-      
+
       if (fwdTree)
 	{
 	  func(fwdTree, data);
 	}
-      
+
       if (revTree)
 	{
 	  func(revTree, data);
@@ -237,12 +238,12 @@ void callFuncOnAllDetailViewTrees(GtkWidget *detailView, GtkCallback func, gpoin
 /* Add the msps in the given BlxSequence to a single row in the given tree store */
 static void addSequenceMspsToSingleRow(BlxSequence *blxSeq, GtkWidget *tree, GtkListStore *store)
 {
-  /* Only add msps that are in the correct strand for this tree (since the same 
+  /* Only add msps that are in the correct strand for this tree (since the same
    * sequence may have matches against both ref seq strands) */
   GList *mspsToAdd = NULL;
   GList *mspItem = blxSeq->mspList;
   const BlxStrand treeStrand = treeGetStrand(tree);
-  
+
   for ( ; mspItem; mspItem = mspItem->next)
     {
       MSP *msp  = (MSP*)(mspItem->data);
@@ -272,7 +273,7 @@ static void addSequenceMspsToSingleRow(BlxSequence *blxSeq, GtkWidget *tree, Gtk
 
       /* Loop through the rest of the columns */
       GList *item = columnList;
-      
+
       for ( ; item; item = item->next)
         {
           BlxColumnInfo *columnInfo = (BlxColumnInfo*)(item->data);
@@ -293,11 +294,11 @@ static void addSequenceMspsToSingleRow(BlxSequence *blxSeq, GtkWidget *tree, Gtk
               if (val) gtk_list_store_set_value(store, &iter, columnInfo->columnIdx, val);
             }
         }
-      
+
       /* Remember which row these msps are in */
       GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
       GList *mspItem = mspsToAdd;
-      
+
       for ( ; mspItem; mspItem = mspItem->next)
         {
           MSP *curMsp = (MSP*)(mspItem->data);
@@ -315,15 +316,15 @@ static void addSequenceMspsToSeparateRows(BlxSequence *blxSeq, GtkWidget *tree,
 {
   const BlxStrand treeStrand = treeGetStrand(tree);
   GList *mspItem = blxSeq->mspList;
-  
+
   for ( ; mspItem; mspItem = mspItem->next)
     {
       MSP *msp  = (MSP*)(mspItem->data);
 
-      /* Only add msps that are in the correct strand for this tree (since the same 
+      /* Only add msps that are in the correct strand for this tree (since the same
        * sequence may have matches against both ref seq strands) */
-      if (typeShownInDetailView(msp->type) && 
-          msp->qStrand == treeStrand && 
+      if (typeShownInDetailView(msp->type) &&
+          msp->qStrand == treeStrand &&
           msp->qFrame == treeGetFrame(tree))
         {
           addMspToTree(msp, tree, store);
@@ -335,7 +336,7 @@ static void addSequenceMspsToSeparateRows(BlxSequence *blxSeq, GtkWidget *tree,
 /* Add the given BlxSequence as a row in the given tree store */
 static void addSequenceToTree(BlxSequence *blxSeq, GtkWidget *tree, GtkListStore *store)
 {
-  /* Only add matches and transcripts to the detail-view. Also, 
+  /* Only add matches and transcripts to the detail-view. Also,
    * we exclude sequences with squash-identical-features set because
    * these are added separately. */
   if (!blxSequenceShownInDetailView(blxSeq) ||
@@ -359,7 +360,7 @@ static void addSequenceToTree(BlxSequence *blxSeq, GtkWidget *tree, GtkListStore
 static int sortByDnaCompareFunc(gconstpointer a, gconstpointer b)
 {
   double result = 0;
-  
+
   const MSP* const msp1 = *((const MSP**)a);
   const MSP* const msp2 = *((const MSP**)b);
 
@@ -386,24 +387,24 @@ static int sortByDnaCompareFunc(gconstpointer a, gconstpointer b)
     {
       result = -1;
     }
-  else 
+  else
     {
       result = 1;
     }
 
   /* For fractional results, round up (or down if negative), so that we still
-   * recognise a fracional difference as a difference (e.g. a difference of 
+   * recognise a fracional difference as a difference (e.g. a difference of
    * -0.2 in the scores would mean a < b, so we return -1). */
   if (result > 0)
     return ceil(result);
   else if (result < 0)
     return floor(result);
-  else 
+  else
     return 0;
 }
 
 
-/* For matches that should be squashed if identical, add them to the given tree, 
+/* For matches that should be squashed if identical, add them to the given tree,
  * placing duplicate sequences on the same row as each other to create a compact tree. */
 static void addFeaturesToCompactTree(GtkWidget *tree, GtkListStore *store, GtkWidget *blxWindow)
 {
@@ -423,7 +424,7 @@ static void addFeaturesToCompactTree(GtkWidget *tree, GtkListStore *store, GtkWi
         g_array_prepend_val(array, val);
     }
 
-  /* Sort the array by DNA sequence so that duplicates are adjacent. */ 
+  /* Sort the array by DNA sequence so that duplicates are adjacent. */
   g_array_sort(array, sortByDnaCompareFunc);
 
   /* Loop through each MSP, compiling a list of MSPs to add to the
@@ -432,12 +433,12 @@ static void addFeaturesToCompactTree(GtkWidget *tree, GtkListStore *store, GtkWi
   MSP *prevMsp = NULL;
   MSP *msp = mspArrayIdx(array, i);
   GList *mspsToAdd = NULL;
-  
+
   for ( ; msp || prevMsp; msp = mspArrayIdx(array, ++i))
     {
       if (msp && mspGetRefStrand(msp) != treeStrand)
         continue;
-      
+
       if (msp && prevMsp && sortByDnaCompareFunc(&prevMsp, &msp) == 0)
         {
           /* Same as previous sequence; add to current row */
@@ -453,11 +454,11 @@ static void addFeaturesToCompactTree(GtkWidget *tree, GtkListStore *store, GtkWi
 
               /* Loop through the columns */
               GList *item = blxWindowGetColumnList(blxWindow);
-      
+
               for ( ; item; item = item->next)
                 {
                   BlxColumnInfo *columnInfo = (BlxColumnInfo*)(item->data);
-                  
+
                   if (columnInfo->columnId == BLXCOL_SCORE)
                     gtk_list_store_set(store, &iter, columnInfo->columnIdx, prevMsp->score, -1);
                   else if (columnInfo->columnId == BLXCOL_ID)
@@ -474,11 +475,11 @@ static void addFeaturesToCompactTree(GtkWidget *tree, GtkListStore *store, GtkWi
                       if (val) gtk_list_store_set_value(store, &iter, columnInfo->columnIdx, val);
                     }
                 }
-              
+
               /* Remember which row these msps are in */
               GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
               GList *mspItem = mspsToAdd;
-          
+
               for ( ; mspItem; mspItem = mspItem->next)
                 {
                   MSP *curMsp = (MSP*)(mspItem->data);
@@ -486,20 +487,20 @@ static void addFeaturesToCompactTree(GtkWidget *tree, GtkListStore *store, GtkWi
                 }
 
               gtk_tree_path_free(path);
-          
+
               /* Reset the list pointer ready for the next row. Note that
                * we do not free the list because it is now owned by the tree */
               mspsToAdd = NULL;
             }
-          
+
           /* Add the new msp */
           if (msp)
             mspsToAdd = g_list_prepend(mspsToAdd, msp);
         }
-      
+
       prevMsp = msp;
     }
-  
+
   /* Re-sort by default sort order (required for filtering) if this msp type
    * appears in the detail-view */
   if (typeShownInDetailView(BLXMSP_MATCH))
@@ -511,16 +512,16 @@ static void addFeaturesToCompactTree(GtkWidget *tree, GtkListStore *store, GtkWi
 void addSequencesToTree(GtkWidget *tree, gpointer data)
 {
   GList *seqList = (GList*)data;
-  
+
   /* Create the data store for the tree. We must know how many columns
    * we have, and their data types. */
-  GtkWidget *detailView = treeGetDetailView(tree);  
+  GtkWidget *detailView = treeGetDetailView(tree);
   GList *columnList = detailViewGetColumnList(detailView);
   const int numCols = g_list_length(columnList);
   GType *typeList = columnListGetTypes(columnList);
 
   GtkListStore *store = gtk_list_store_newv(numCols, typeList);
-  
+
   /* Set the sort function for each column */
   int colNum = 0;
   for ( ; colNum < numCols; ++colNum)
@@ -532,7 +533,7 @@ void addSequencesToTree(GtkWidget *tree, gpointer data)
    * sequences as BlxSequences */
   GtkWidget *blxWindow = treeGetBlxWindow(tree);
   GList *seqItem = seqList;
-  
+
   for ( ; seqItem; seqItem = seqItem->next)
     {
       BlxSequence *blxSeq = (BlxSequence*)(seqItem->data);
@@ -541,18 +542,18 @@ void addSequencesToTree(GtkWidget *tree, gpointer data)
 
   /* Also add one row for each match that has duplcate DNA to the compact tree */
   addFeaturesToCompactTree(tree, store, blxWindow);
-  
+
   /* Create a filtered version which will only show sequences that are in the display range */
   GtkTreeModel *filter = gtk_tree_model_filter_new(GTK_TREE_MODEL(store), NULL);
   gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(filter), (GtkTreeModelFilterVisibleFunc)isTreeRowVisible, tree, NULL);
-  
+
   /* Lose the local reference to 'store' because the tree filter has a reference to it. */
   g_object_unref(G_OBJECT(store));
-  
+
   /* Remember the base tree store in the properties so we can switch between this and the 'unsquashed' tree model */
   TreeProperties *properties = treeGetProperties(tree);
   properties->treeModels[BLXMODEL_SQUASHED] = GTK_TREE_MODEL(filter);
-  
+
   /* Note that we don't decrement the ref count to 'filter' even though we're losing
    * the local pointer to it, because we've also added a pointer to it from the tree
    * properties. */
@@ -562,7 +563,7 @@ void addSequencesToTree(GtkWidget *tree, gpointer data)
 /* Return the MSP(s) in a given tree row */
 GList* treeGetMsps(GtkTreeModel *model, GtkTreeIter *iter)
 {
-  GList *mspGList = NULL;  
+  GList *mspGList = NULL;
 
   /* Get the sequence column index (note this may be different to the column id) */
   GtkWidget *blxWindow = getBlixemWindow();
@@ -593,7 +594,7 @@ static GtkStatusbar* treeGetStatusBar(GtkWidget *tree)
   GtkWidget *detailView = treeGetDetailView(tree);
   DetailViewProperties *dvProperties = detailViewGetProperties(detailView);
   return GTK_STATUSBAR(dvProperties->statusBar);
-  
+
   //GTK_STATUSBAR(treeGetContext(tree)->statusBar);
 }
 
@@ -603,9 +604,9 @@ static GtkStatusbar* treeGetStatusBar(GtkWidget *tree)
 GtkTreeModel* treeGetBaseDataModel(GtkTreeView *tree)
 {
   assertTree(GTK_WIDGET(tree));
-  
+
   GtkTreeModel *result = NULL;
-  
+
   if (tree)
     {
       GtkTreeModel *model = gtk_tree_view_get_model(tree);
@@ -618,7 +619,7 @@ GtkTreeModel* treeGetBaseDataModel(GtkTreeView *tree)
           result = model;
         }
     }
-  
+
   return result;
 }
 
@@ -626,7 +627,7 @@ GtkTreeModel* treeGetBaseDataModel(GtkTreeView *tree)
 /* Decrease the font size in the detail view trees (i.e. effectively zoom out) */
 void treeUpdateFontSize(GtkWidget *tree, gpointer data)
 {
-  PangoFontDescription *fontDesc = treeGetFontDesc(tree);  
+  PangoFontDescription *fontDesc = treeGetFontDesc(tree);
   gtk_widget_modify_font(tree, fontDesc);
 }
 
@@ -636,18 +637,18 @@ void treeUpdateSquashMatches(GtkWidget *tree, gpointer data)
 {
   BlxContext *bc = treeGetContext(tree);
   TreeProperties *properties = treeGetProperties(tree);
-  
+
   /* Find the new model */
   GtkTreeModel *newModel = properties->treeModels[bc->modelId];
-  
+
   if (newModel)
     gtk_tree_view_set_model(GTK_TREE_VIEW(tree), newModel);
-  
+
   /* Re-sort and re-filter, because the new one might not be up to date */
-  /* Note that we sort the base data model, not the filtered one (i.e. sort all rows, 
+  /* Note that we sort the base data model, not the filtered one (i.e. sort all rows,
    * not just visible ones) */
   newModel = treeGetBaseDataModel(GTK_TREE_VIEW(tree));
-  
+
   if (newModel)
     {
       resortTree(tree, NULL);
@@ -665,16 +666,16 @@ void treeUpdateSquashMatches(GtkWidget *tree, gpointer data)
 void refreshTreeHeaders(GtkWidget *tree, gpointer data)
 {
   TreeProperties *properties = treeGetProperties(tree);
-  
+
   /* Loop through all column headers and call their individual refresh functions
    * (this sets the specific data for the column headers) */
   GList *headerItem = properties->treeColumnHeaderList;
   PangoFontDescription *fontDesc = treeGetFontDesc(tree);
-  
+
   for ( ; headerItem; headerItem = headerItem->next)
     {
       TreeColumnHeaderInfo *headerInfo = (TreeColumnHeaderInfo*)headerItem->data;
-      
+
       if (headerInfo && headerInfo->headerWidget)
 	{
 	  /* Set the background color  */
@@ -701,16 +702,16 @@ static void resizeTreeHeaders(GtkWidget *tree, gpointer data)
 {
   TreeProperties *properties = treeGetProperties(tree);
   GList *header = properties->treeColumnHeaderList;
-  
+
   for ( ; header; header = header->next)
     {
       TreeColumnHeaderInfo *headerInfo = (TreeColumnHeaderInfo*)header->data;
-      
+
       if (headerInfo && headerInfo->headerWidget && g_list_length(headerInfo->columnIds) > 0)
 	{
 	  int firstColId = GPOINTER_TO_INT(headerInfo->columnIds->data);
 
-          /* For the sequence column, don't set the size request to the real size, or we 
+          /* For the sequence column, don't set the size request to the real size, or we
            * won't be able to shrink the window. (The sequence col header will be resized
            * dynamically anyway.) */
 	  if (firstColId != BLXCOL_SEQUENCE)
@@ -722,7 +723,7 @@ static void resizeTreeHeaders(GtkWidget *tree, gpointer data)
 	    }
 	}
     }
-  
+
   refreshTreeHeaders(tree, NULL);
 }
 
@@ -732,7 +733,7 @@ static void resizeTreeHeaders(GtkWidget *tree, gpointer data)
 void resizeTreeColumns(GtkWidget *tree, gpointer data)
 {
   GtkWidget *detailView = treeGetDetailView(tree);
-  
+
   GList *listItem = detailViewGetColumnList(detailView);
 
   /* Loop through each column in the tree and set the column width and visibility
@@ -741,12 +742,12 @@ void resizeTreeColumns(GtkWidget *tree, gpointer data)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)(listItem->data);
 
-      /* We don't set the width of the sequence column - this is an autosize column, so it will 
+      /* We don't set the width of the sequence column - this is an autosize column, so it will
        * be updated dynamically when any of the other columns change. */
 //      if (columnInfo->columnId != BLXCOL_SEQUENCE)
 	{
 	  GtkTreeViewColumn *treeColumn = gtk_tree_view_get_column(GTK_TREE_VIEW(tree), columnInfo->columnIdx);
-      
+
 	  int width = columnInfo->width;
 	  if (columnInfo->columnId == BLXCOL_END)
 	    {
@@ -782,10 +783,10 @@ void treeScrollSelectionIntoView(GtkWidget *tree, gpointer data)
   /* Get the last selected sequence */
   GtkWidget *blxWindow = treeGetBlxWindow(tree);
   const BlxSequence *lastSelectedSeq = blxWindowGetLastSelectedSeq(blxWindow);
-  
+
   /* Get the tree row(s) that contain that sequence. (If multiple, just use 1st one) */
   GList *rows = treeGetSequenceRows(tree, lastSelectedSeq);
-  
+
   if (g_list_length(rows) > 0)
     {
       GtkTreePath *path = (GtkTreePath*)(rows->data);
@@ -811,7 +812,7 @@ static gboolean onSelectionChangedTree(GObject *selection, gpointer data)
 void refilterTree(GtkWidget *tree, gpointer data)
 {
   assertTree(tree);
-  
+
   GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
   gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(model));
 }
@@ -823,18 +824,18 @@ static gboolean updateMspPaths(GtkTreeModel *model, GtkTreePath *path, GtkTreeIt
 {
   BlxModelId modelId = (BlxModelId)GPOINTER_TO_INT(data);
   GList *mspItem = treeGetMsps(model, iter);
-  
+
   for ( ; mspItem; mspItem = mspItem->next)
     {
       MSP *msp = (MSP*)(mspItem->data);
-      
+
       /* clear any existing path string */
       if (msp->treePaths[modelId])
         g_free(msp->treePaths[modelId]);
-      
+
       msp->treePaths[modelId] = gtk_tree_path_to_string(path);
     }
-  
+
   return FALSE;
 }
 
@@ -848,31 +849,31 @@ void resortTree(GtkWidget *tree, gpointer data)
   const int numColumns = g_list_length(columnList);
 
   if (numColumns < 1)
-    return; 
+    return;
 
   /* Find the main column to sort by. We set this as the sort column on the tree.
-   * It actually doesn't make a lot of difference which column we set except that 
-   * we call the correct sort-by function; the sort-by function will actually sort 
+   * It actually doesn't make a lot of difference which column we set except that
+   * we call the correct sort-by function; the sort-by function will actually sort
    * by multiple columns based on the detail-view properties. */
   int sortColumn = dvProperties->sortColumns[0];
-  
+
   /* The column ID enum includes some values that are not valid tree columns, i.e. those
    * outside the enum for the max number of columns. If we've got one of these, then
    * set the tree to be unsorted. */
   if (sortColumn >= numColumns)
     sortColumn = GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID;
-  
+
   /* Note that the sort function takes care of whether it's asc or desc, so we
    * always set asc. */
   GtkSortType sortOrder = GTK_SORT_ASCENDING;
-  
-  /* Not sure if there's a better way to do this, but we can force a re-sort by 
+
+  /* Not sure if there's a better way to do this, but we can force a re-sort by
    * setting the sort column to something else and then back again. */
   GtkTreeModel *model = treeGetBaseDataModel(GTK_TREE_VIEW(tree));
   gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, sortOrder);
   gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), sortColumn, sortOrder);
 
-  
+
   /* Update the cached path held by each MSP about the row it is in. */
   BlxContext *bc = treeGetContext(tree);
   gtk_tree_model_foreach(model, updateMspPaths, GINT_TO_POINTER(bc->modelId));
@@ -881,9 +882,9 @@ void resortTree(GtkWidget *tree, gpointer data)
 
 /* Utility that returns true if the given MSP is currently shown in the tree with the given
  * strand/frame */
-static gboolean isMspVisible(const MSP* const msp, 
-			     const BlxContext *bc, 
-			     const int frame, 
+static gboolean isMspVisible(const MSP* const msp,
+			     const BlxContext *bc,
+			     const int frame,
 			     const IntRange* const displayRange,
 			     const int numUnalignedBases,
                              const gboolean seqSelected,
@@ -912,9 +913,9 @@ static gboolean isMspVisible(const MSP* const msp,
 static gboolean isTreeRowVisible(GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
 {
   gboolean bDisplay = FALSE;
-  
+
   GList *mspList = treeGetMsps(model, iter);
-  
+
   if (g_list_length(mspList) > 0)
     {
       GtkWidget *tree = GTK_WIDGET(data);
@@ -923,12 +924,12 @@ static gboolean isTreeRowVisible(GtkTreeModel *model, GtkTreeIter *iter, gpointe
       BlxContext *bc = blxWindowGetContext(dvProperties->blxWindow());
 
       /* Check the first msp to see if this sequence is in a group that's hidden.
-       * (Note that all MSPs in the same row should be in the same sequence - we 
+       * (Note that all MSPs in the same row should be in the same sequence - we
        * don't check this here because this function is called many times so we
        * avoid any unnecessary checks.) */
       const MSP *firstMsp = (const MSP*)(mspList->data);
       list <const SequenceGroup*> groups = bc->getSequenceGroups(firstMsp->sSequence);
-      
+
       if (bc->isGroupVisible(groups, firstMsp->sSequence->type))
 	{
 	  BlxContext *bc = treeGetContext(tree);
@@ -942,20 +943,20 @@ static gboolean isTreeRowVisible(GtkTreeModel *model, GtkTreeIter *iter, gpointe
 	  /* Show the row if any MSP in the list is an exon or blast match in the correct frame/strand
 	   * and within the display range */
 	  GList *mspListItem = mspList;
-	
+
 	  for ( ; mspListItem; mspListItem = mspListItem->next)
 	    {
 	      const MSP* msp = (const MSP*)(mspListItem->data);
-	      
+
               if (isMspVisible(msp, bc, frame, displayRange, dvProperties->numUnalignedBases, seqSelected, groups))
 		{
 		  bDisplay = TRUE;
 		  break;
 		}
-	    }	  
+	    }
 	}
     }
-  
+
   return bDisplay;
 }
 
@@ -978,7 +979,7 @@ BlxContext* treeGetContext(GtkWidget *tree)
 static void onDestroyTree(GtkWidget *widget)
 {
   TreeProperties *properties = treeGetProperties(widget);
-  
+
   if (properties)
     {
       if (properties->treeColumnHeaderList)
@@ -986,22 +987,22 @@ static void onDestroyTree(GtkWidget *widget)
 	  g_list_free(properties->treeColumnHeaderList);
 	  properties->treeColumnHeaderList = NULL;
 	}
-    
+
       delete properties;
       properties = NULL;
       g_object_set_data(G_OBJECT(widget), "TreeProperties", NULL);
     }
 }
 
-static void treeCreateProperties(GtkWidget *widget, 
-				 GtkWidget *grid, 
-				 GtkWidget *detailView, 
+static void treeCreateProperties(GtkWidget *widget,
+				 GtkWidget *grid,
+				 GtkWidget *detailView,
 				 const int frame,
 				 GList *treeColumnHeaderList,
 				 const gboolean hasSnpHeader)
 {
   if (widget)
-    { 
+    {
       TreeProperties *properties = new TreeProperties;
 
       properties->widget = widget;
@@ -1010,13 +1011,13 @@ static void treeCreateProperties(GtkWidget *widget,
       properties->readingFrame = frame;
       properties->treeColumnHeaderList = treeColumnHeaderList;
       properties->hasSnpHeader = hasSnpHeader;
-      
+
       int i = 0;
       for ( ; i < BLXMODEL_NUM_MODELS; ++i)
         properties->treeModels[i] = NULL;
 
       g_object_set_data(G_OBJECT(widget), "TreeProperties", properties);
-      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyTree), NULL); 
+      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyTree), NULL);
     }
 }
 
@@ -1039,11 +1040,11 @@ static gboolean treeGetNegateCoords(GtkWidget *tree)
 static void onScrollChangedTree(GtkObject *object, gpointer data)
 {
   GtkWidget *tree = GTK_WIDGET(data);
-  
+
   /* Remove any message from the detail-view status bar, because this shows info for the
    * currently-moused-over item, which may have changed now we've scrolled. */
    GtkStatusbar *statusBar = treeGetStatusBar(tree);
-   
+
    if (statusBar)
      {
        guint contextId = gtk_statusbar_get_context_id(GTK_STATUSBAR(statusBar), DETAIL_VIEW_STATUSBAR_CONTEXT);
@@ -1057,20 +1058,20 @@ static void onScrollChangedTree(GtkObject *object, gpointer data)
 static void drawRefSeqHeader(GtkWidget *headerWidget, GtkWidget *tree)
 {
   GdkDrawable *drawable = createBlankPixmap(headerWidget);
-  
+
   BlxContext *bc = treeGetContext(tree);
   const BlxStrand strand = treeGetStrand(tree);
   const int frame = treeGetFrame(tree);
-  
+
   GtkWidget *detailView = treeGetDetailView(tree);
   DetailViewProperties *properties = detailViewGetProperties(detailView);
-  
+
   const gboolean highlightSnps = treeHasSnpHeader(tree) && bc->flags[BLXFLAG_HIGHLIGHT_VARIATIONS];
-  
-  /* Find the segment of the ref seq to display. Ref seq is in nucleotide coords so convert the 
+
+  /* Find the segment of the ref seq to display. Ref seq is in nucleotide coords so convert the
    * display range to nucleotide coords. */
   const int qIdx1 = convertDisplayIdxToDnaIdx(properties->displayRange.min(), bc->seqType, frame, 1, bc->numFrames, bc->displayRev, &bc->refSeqRange);
-  const int qIdx2 = convertDisplayIdxToDnaIdx(properties->displayRange.max(), bc->seqType, frame, bc->numFrames, bc->numFrames, bc->displayRev, &bc->refSeqRange); 
+  const int qIdx2 = convertDisplayIdxToDnaIdx(properties->displayRange.max(), bc->seqType, frame, bc->numFrames, bc->numFrames, bc->displayRev, &bc->refSeqRange);
   IntRange qRange(qIdx1, qIdx2);
 
   /* The q range may be outside the ref seq range if we are at the start/end and we have included
@@ -1078,7 +1079,7 @@ static void drawRefSeqHeader(GtkWidget *headerWidget, GtkWidget *tree)
    * base number within the reading frame. */
   int offsetMin = 0;
   int offsetMax = 0;
-  
+
   while (qRange.min() < bc->refSeqRange.min())
     {
       qRange.setMin(qRange.min() + bc->numFrames);
@@ -1090,15 +1091,15 @@ static void drawRefSeqHeader(GtkWidget *headerWidget, GtkWidget *tree)
       qRange.setMax(qRange.max() - bc->numFrames);
       ++offsetMax;
     }
-  
+
   GError *error = NULL;
-  
+
   gchar *segmentToDisplay = getSequenceSegment(bc->refSeq,
                                                &qRange,
-					       strand, 
+					       strand,
 					       BLXSEQ_DNA,      /* input ref seq is always in nucleotide coords */
                                                bc->seqType,     /* required segment is in display coords */
-					       frame, 
+					       frame,
 					       bc->numFrames,
 					       &bc->refSeqRange,
 					       bc->blastMode,
@@ -1107,7 +1108,7 @@ static void drawRefSeqHeader(GtkWidget *headerWidget, GtkWidget *tree)
 					       bc->displayRev,	/* show backwards if display reversed */
 					       TRUE,		/* always complement reverse strand */
 					       &error);
-  
+
   if (!segmentToDisplay)
     {
       g_assert(error);
@@ -1120,14 +1121,14 @@ static void drawRefSeqHeader(GtkWidget *headerWidget, GtkWidget *tree)
       /* If there's an error but the sequence was still returned it's a non-critical warning */
       reportAndClearIfError(&error, G_LOG_LEVEL_WARNING);
     }
-  
+
   GdkGC *gc = gdk_gc_new(drawable);
 
   /* Offset the x coord where we'll start drawing if we did not start at the beginning of the display range. */
   const int offset = bc->displayRev ? offsetMax : offsetMin;
   gdouble xStart = (gdouble)offset * properties->charWidth();
   const int yStart = 0;
-  
+
   /* Find out if there are any special bases that need highlighting. */
   GHashTable *basesToHighlight = getRefSeqBasesToHighlight(detailView, &qRange, bc->seqType, strand);
 
@@ -1159,29 +1160,29 @@ static void drawRefSeqHeader(GtkWidget *headerWidget, GtkWidget *tree)
       baseData.displayIdxSelected = detailViewIsDisplayIdxSelected(detailView, displayIdx + offset);
       baseData.dnaIdxSelected = baseData.displayIdxSelected;
       baseData.baseChar = segmentToDisplay[displayIdx - properties->displayRange.min()];
-      
+
       const int x = (int)((gdouble)xStart + (gdouble)(displayIdx - properties->displayRange.min()) * properties->charWidth());
 
       /* Draw the character, seting the background color and outline depending on whether this base is selected or
        * is affected by a SNP or polyA signal etc. */
       drawHeaderChar(bc, properties, drawable, gc, x, yStart, basesToHighlight, &baseData);
-     
+
       baseData.dnaIdx += incrementValue;
       ++displayIdx;
     }
-  
+
   /* Mark up the text to highlight the selected base, if there is one */
   PangoLayout *layout = gtk_widget_create_pango_layout(detailView, segmentToDisplay);
   pango_layout_set_font_description(layout, detailViewGetFontDesc(detailView));
-  
+
   if (layout)
     {
       gtk_paint_layout(headerWidget->style, drawable, GTK_STATE_NORMAL, TRUE, NULL, detailView, NULL, xStart, yStart, layout);
       g_object_unref(layout);
     }
-  
+
   drawColumnSeparatorLine(headerWidget, drawable, gc, bc);
- 
+
   g_hash_table_unref(basesToHighlight);
   g_free(segmentToDisplay);
   g_object_unref(gc);
@@ -1193,12 +1194,12 @@ static void drawRefSeqHeader(GtkWidget *headerWidget, GtkWidget *tree)
 static gboolean onExposeRefSeqHeader(GtkWidget *headerWidget, GdkEventExpose *event, gpointer data)
 {
   GdkWindow *window = GTK_IS_LAYOUT(headerWidget) ? GTK_LAYOUT(headerWidget)->bin_window : headerWidget->window;
-  
+
   if (window)
     {
       /* See if there's a cached drawable and, if not, create it */
       GdkDrawable *bitmap = widgetGetDrawable(headerWidget);
-      
+
       if (!bitmap)
 	{
 	  /* There isn't a bitmap yet. Create it now. */
@@ -1206,7 +1207,7 @@ static gboolean onExposeRefSeqHeader(GtkWidget *headerWidget, GdkEventExpose *ev
 	  drawRefSeqHeader(headerWidget, tree);
 	  bitmap = widgetGetDrawable(headerWidget);
 	}
-      
+
       if (bitmap)
 	{
 	  /* Push the bitmap onto the window */
@@ -1215,19 +1216,19 @@ static gboolean onExposeRefSeqHeader(GtkWidget *headerWidget, GdkEventExpose *ev
           g_object_unref(gc);
 	}
     }
-  
+
   return FALSE;
 }
 
 
-/* This function checks if there is a display index/range selected and, if so, 
+/* This function checks if there is a display index/range selected and, if so,
  * colors the background for that range with the relevant highlight color. */
 static void treeHighlightSelectedBase(GtkWidget *tree, GdkDrawable *drawable)
 {
   GtkWidget *detailView = treeGetDetailView(tree);
   DetailViewProperties *properties = detailViewGetProperties(detailView);
   GList *columnList = detailViewGetColumnList(detailView);
-  
+
   int start = UNSET_INT;
   int end = UNSET_INT;
   gboolean ok = FALSE;
@@ -1235,7 +1236,7 @@ static void treeHighlightSelectedBase(GtkWidget *tree, GdkDrawable *drawable)
   /* Use the selection range, if set, otherwise the selected coord */
   if (detailViewGetSelectedIdxSet(detailView))
     {
-      /* Display coords may be in reverse direction but this access function returns them 
+      /* Display coords may be in reverse direction but this access function returns them
        * in min->max order */
       IntRange *range = detailViewGetSelectedDisplayIdxRange(detailView);
 
@@ -1262,17 +1263,17 @@ static void treeHighlightSelectedBase(GtkWidget *tree, GdkDrawable *drawable)
             {
               /* Convert the display-range index to a 0-based index in the display range */
               const int charIdx = coord - properties->displayRange.min();
-      
+
               /* Get the x coords for the start and end of the sequence column */
               IntRange xRange;
               getColumnXCoords(columnList, BLXCOL_SEQUENCE, &xRange);
-      
+
               const int x = xRange.min() + (charIdx * properties->charWidth());
               const int y = 0;
-      
+
               BlxContext *bc = blxWindowGetContext(properties->blxWindow());
               GdkColor *color = getGdkColor(BLXCOLOR_SELECTION, bc->defaultColors, FALSE, bc->usePrintColors);
-      
+
               drawRect(drawable, color, x, y, roundNearest(properties->charWidth()), tree->allocation.height, 0.3, CAIRO_OPERATOR_XOR);
             }
         }
@@ -1280,12 +1281,12 @@ static void treeHighlightSelectedBase(GtkWidget *tree, GdkDrawable *drawable)
 }
 
 
-/* Expose function for a detail-view tree 
- * 
+/* Expose function for a detail-view tree
+ *
  * There is a bit of hacky code in here to try to speed up the redraw of the
  * tree, which can be very slow on some systems (I'm not sure why but it seems
  * quite a common problem with GtkTreeView, sadly).
- * 
+ *
  * The way the drawing works is as follows:
  *  - First time round, there is no cached drawable, so it creates the drawable
  *    and saves it in the widget. It is blank at this point. The default handler
@@ -1296,26 +1297,26 @@ static void treeHighlightSelectedBase(GtkWidget *tree, GdkDrawable *drawable)
  *    do the drawing and overwrite the cached drawable (see notes below) ...
  *  - ... EXCEPT when middle-dragging. The default handler would have to re-draw
  *    everything when middle-dragging, because the highlighted column on
- *    every row changes, and this can be slow. We therefore use the cached 
+ *    every row changes, and this can be slow. We therefore use the cached
  *    drawable instead and draw the highlighted column over the top of it.
  *
  * Notes:
  *  - Ideally on subsequent calls we would just push the cached drawable to screen,
  *    (unless it has been cleared to force a re-draw). However, this does not
- *    work well for vertical scrolling, because it slows things down if we clear 
+ *    work well for vertical scrolling, because it slows things down if we clear
  *    and re-draw everything (I think the renderer normally just draws the
- *    relevant rows, so is quicker). This is why we let the default handler do 
+ *    relevant rows, so is quicker). This is why we let the default handler do
  *    the drawing in most cases.  (We could perhaps implement some cleverer
  *    caching for vertical scrolling. Ideally caching needs to be done by the
  *    renderer, not by the tree.)
  *  - It should be safe to use the cached drawable while middle-dragging because the
  *    user should not be doing any other operations that will change what is
- *    shown in the trees (although we might need to introduce some blocks to avoid 
- *    other inputs happening by accident). We make sure the cached drawable is 
+ *    shown in the trees (although we might need to introduce some blocks to avoid
+ *    other inputs happening by accident). We make sure the cached drawable is
  *    up to date by forcing a re-draw when the user clicks the mouse, and then
  *    set the "mouse drag mode" flag to indicate that we want to use it (and
  *    to also stop it being overwritten).
- *  - The previously-highlighted column will still be highlighted for the duration 
+ *  - The previously-highlighted column will still be highlighted for the duration
  *    of a drag, but the highlighting is in a slightly different color, so this is
  *    actually quite a useful effect because you can see where you started dragging
  *    from.
@@ -1332,14 +1333,14 @@ static gboolean onExposeDetailViewTree(GtkWidget *tree, GdkEventExpose *event, g
       GdkWindow *window = gtk_tree_view_get_bin_window(GTK_TREE_VIEW(tree));
       gdk_draw_drawable(window, gc, drawable, 0, 0, 0, 0, -1, -1);
       g_object_unref(gc);
-      
+
       treeHighlightSelectedBase(tree, window);
 
       handled = TRUE;
     }
   else
     {
-      /* Create a new drawable to draw to. Our custom cell renderer will draw 
+      /* Create a new drawable to draw to. Our custom cell renderer will draw
        * to this as well as the widget's window. The cached drawable is used
        * for printing and for mouse-drag mode. */
       GdkDrawable *drawable = gdk_pixmap_new(tree->window, tree->allocation.width, tree->allocation.height, -1);
@@ -1348,17 +1349,17 @@ static gboolean onExposeDetailViewTree(GtkWidget *tree, GdkEventExpose *event, g
 
       /* Draw a blank rectangle of the required widget background color */
       GdkGC *gc = gdk_gc_new(drawable);
-      
+
       GdkColor *bgColor = tree->style->bg;
       gdk_gc_set_foreground(gc, bgColor);
       gdk_draw_rectangle(drawable, gc, TRUE, 0, 0, tree->allocation.width, tree->allocation.height);
-      
+
       g_object_unref(gc);
-      
+
       /* Let the default handler continue to do the actual drawing */
       handled = FALSE;
     }
-  
+
   return handled;
 }
 
@@ -1366,28 +1367,28 @@ static gboolean onExposeDetailViewTree(GtkWidget *tree, GdkEventExpose *event, g
 /* Select the range of rows in the given tree from the first path to the last inclusive */
 static void treeSelectRowRange(GtkWidget *blxWindow, GtkTreeModel *model, GtkTreePath *firstPath, GtkTreePath *lastPath)
 {
-  /* We currently only ever have a list, so this function assumes the model is a list. If 
+  /* We currently only ever have a list, so this function assumes the model is a list. If
    * the alignment lists are ever changed to be trees, this function will need updating. */
   if (GTK_IS_TREE_STORE(model))
     {
       g_warning("Error selecting range of rows: function not implemented (expected alignments to be in a list store, not a tree store).");
       return;
     }
-  
+
   /* Loop through all the rows from the last selected one to the one that was clicked
    * on. The direction depends on which one appears first in the list. */
   gint *firstIdx = gtk_tree_path_get_indices(firstPath);
   gint *lastIdx = gtk_tree_path_get_indices(lastPath);
-  
+
   gint currentIdx = *firstIdx;
   const gint incrementValue = *firstIdx < *lastIdx ? 1 : -1;
   gboolean done = FALSE;
-  
+
   while (!done)
     {
       /* Select the sequence in the current row */
       GtkTreePath *currentPath = gtk_tree_path_new_from_indices(currentIdx, -1);
-      
+
       GtkTreeIter currentIter;
       if (gtk_tree_model_get_iter(model, &currentIter, currentPath))
 	{
@@ -1399,7 +1400,7 @@ static void treeSelectRowRange(GtkWidget *blxWindow, GtkTreeModel *model, GtkTre
 	  g_warning("Invalid iterator found when selecting a range of rows\n");
 	  done = TRUE;
 	}
-      
+
       /* Get the next path, unless we're already at the last one */
       if (currentIdx == *lastIdx)
 	{
@@ -1419,17 +1420,17 @@ static gboolean treeSelectRow(GtkWidget *tree, GdkEventButton *event)
 {
   const gboolean ctrlModifier = (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
   const gboolean shiftModifier = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
-  
+
   if (!ctrlModifier && !shiftModifier)
     {
       blxWindowDeselectAllSeqs(treeGetBlxWindow(tree));
     }
-  
-  /* If we've clicked a different tree to the previously selected one, make this tree's 
+
+  /* If we've clicked a different tree to the previously selected one, make this tree's
    * reading frame the active one */
   GtkWidget *detailView = treeGetDetailView(tree);
   detailViewSetActiveFrame(detailView, treeGetFrame(tree));
-  
+
   /* Find which row was clicked */
   GtkTreePath *clickedPath = NULL;
   GtkTreeViewColumn *clickedCol = NULL;
@@ -1441,14 +1442,14 @@ static gboolean treeSelectRow(GtkWidget *tree, GdkEventButton *event)
       GtkTreeModel *model = treeGetVisibleDataModel(GTK_TREE_VIEW(tree));
       GtkTreeIter clickedIter;
       gtk_tree_model_get_iter(model, &clickedIter, clickedPath);
-      
+
       /* Get the sequence of the MSP(s) in this row */
       BlxSequence *clickedSeq = treeGetSequence(model, &clickedIter);
 
       if (clickedSeq)
 	{
 	  GtkWidget *blxWindow = treeGetBlxWindow(tree);
-	  
+
 	  if (!ctrlModifier && !shiftModifier)
 	    {
 	      /* No modifiers: select the sequence */
@@ -1464,7 +1465,7 @@ static gboolean treeSelectRow(GtkWidget *tree, GdkEventButton *event)
 	      /* Shift pressed: select all rows between the last-selected sequence and the clicked row */
 	      const BlxSequence *lastSelectedSeq = blxWindowGetLastSelectedSeq(blxWindow);
 	      GList *lastSelectedRows = treeGetSequenceRows(tree, lastSelectedSeq);
-	      
+
 	      if (g_list_length(lastSelectedRows) > 0) /* do nothing if no rows were previously selected */
 		{
 		  /* Get the tree row for the last selected sequence. (If there are multiple rows for this
@@ -1483,7 +1484,7 @@ static gboolean treeSelectRow(GtkWidget *tree, GdkEventButton *event)
 
       gtk_tree_path_free(clickedPath);
     }
-  
+
   return TRUE; /* handled */
 }
 
@@ -1494,7 +1495,7 @@ static gboolean treePfetchRow(GtkWidget *tree)
   GtkWidget *blxWindow = treeGetBlxWindow(tree);
   BlxContext *bc = blxWindowGetContext(blxWindow);
   GList *selectedSeqs = blxWindowGetSelectedSeqs(blxWindow);
-  
+
   if (selectedSeqs)
     {
       BlxSequence *clickedSeq = (BlxSequence*)selectedSeqs->data;
@@ -1514,7 +1515,7 @@ static gboolean treePfetchRow(GtkWidget *tree)
 static gboolean onButtonPressTree(GtkWidget *tree, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   switch (event->button)
     {
     case 1:
@@ -1531,16 +1532,16 @@ static gboolean onButtonPressTree(GtkWidget *tree, GdkEventButton *event, gpoint
 
 	break;
       }
-      
+
     default:
       break;
     };
-  
+
   if (!handled)
-    { 
+    {
       propagateEventButton(tree, treeGetDetailView(tree), event);
     }
-  
+
   return handled;
 }
 
@@ -1557,7 +1558,7 @@ static void treeHeaderSelectClickedVariation(GtkWidget *header, GtkWidget *tree,
       int clickedBase = 1; /* only get in here for DNA matches; so frame/base number is always one */
 
       selectClickedSnp(header, NULL, detailView, x, y, FALSE, clickedBase); /* SNPs are always un-expanded in the DNA track */
-	    
+
       detailViewRefreshAllHeaders(detailView);
     }
 }
@@ -1572,10 +1573,10 @@ static void treeShowHideVariations(GtkWidget *tree)
 
   const gboolean showTrack = !bc->flags[BLXFLAG_SHOW_VARIATION_TRACK];
   bc->flags[BLXFLAG_SHOW_VARIATION_TRACK] = showTrack;
-            
+
   if (showTrack)
     bc->flags[BLXFLAG_HIGHLIGHT_VARIATIONS] = TRUE;
-            
+
   detailViewUpdateShowSnpTrack(detailView, showTrack);
 }
 
@@ -1629,7 +1630,7 @@ static gboolean onButtonPressTreeHeader(GtkWidget *header, GdkEventButton *event
             /* Double click */
             treeShowHideVariations(tree);
 	  }
-	
+
 	handled = TRUE;
 	break;
       }
@@ -1644,18 +1645,18 @@ static gboolean onButtonPressTreeHeader(GtkWidget *header, GdkEventButton *event
         handled = treeHeaderShowContextMenu(header, tree, event);
         break;
       }
-      
+
     default:
       break;
     };
-  
+
   if (!handled)
     {
       /* Propagate to the detail view, translating event coords to detail view widget coords */
       GtkWidget *detailView = treeGetDetailView(tree);
       propagateEventButton(header, detailView, event);
     }
-  
+
   return handled;
 }
 
@@ -1664,13 +1665,13 @@ static BlxSequence* treeGetSequence(GtkTreeModel *model, GtkTreeIter *iter)
 {
   BlxSequence *result = NULL;
   GList *mspGList = treeGetMsps(model, iter);
-  
+
   if (g_list_length(mspGList) > 0)
     {
       const MSP *firstMsp = (const MSP*)(mspGList->data);
       result = firstMsp->sSequence;
     }
-  
+
   return result;
 }
 
@@ -1697,27 +1698,27 @@ static void destroyTreePathList(GList **list)
 static GList *treeGetSequenceRows(GtkWidget *tree, const BlxSequence *clickedSeq)
 {
   GList *resultList = NULL;
-  
+
   /* Loop through all tree rows looking for any with a matching sequence */
   GtkTreeModel *model = treeGetVisibleDataModel(GTK_TREE_VIEW(tree));
-  
+
   GtkTreeIter iter;
   gboolean validIter = gtk_tree_model_get_iter_first(model, &iter);
-  
+
   while (validIter)
     {
       /* Loop through all msps in this row and see if any belong
        * to the clicked sequence. (For normal matches we could just
        * check one msp because they should all belong to the same
-       * BlxSequence, but for short reads we squash matches from 
+       * BlxSequence, but for short reads we squash matches from
        * different sequences onto the same row, so we can't assume
        * this) */
       GList *mspItem = treeGetMsps(model, &iter);
-      
+
       for ( ; mspItem; mspItem = mspItem->next)
 	{
 	  const MSP *firstMsp = (const MSP*)(mspItem->data);
-          
+
 	  if (firstMsp->sSequence == clickedSeq)
 	    {
 	      GtkTreePath *path = gtk_tree_model_get_path(model, &iter);
@@ -1725,7 +1726,7 @@ static GList *treeGetSequenceRows(GtkWidget *tree, const BlxSequence *clickedSeq
               break;
 	    }
 	}
-      
+
       validIter = gtk_tree_model_iter_next(model, &iter);
     }
 
@@ -1739,8 +1740,8 @@ gboolean treeMoveRowSelection(GtkWidget *tree, const gboolean moveUp, const gboo
   /* Get the last selected sequence */
   GtkWidget *blxWindow = treeGetBlxWindow(tree);
   BlxSequence *lastSelectedSeq = blxWindowGetLastSelectedSeq(blxWindow);
-  
-  /* Get the row in this tree that contain MSPs from that sequence (if there are multiple 
+
+  /* Get the row in this tree that contain MSPs from that sequence (if there are multiple
    * rows behaviour is a bit ambiguous; for now just act on the first one that was found) */
   GList *rows = treeGetSequenceRows(tree, lastSelectedSeq);
 
@@ -1748,10 +1749,10 @@ gboolean treeMoveRowSelection(GtkWidget *tree, const gboolean moveUp, const gboo
     {
       GtkTreePath *path = (GtkTreePath*)(rows->data);
       GtkTreeModel *model = treeGetVisibleDataModel(GTK_TREE_VIEW(tree));
-      
+
       GtkTreeIter newRowIter;
       gboolean newRowExists = FALSE;
-      
+
       /* We have to use a path to get the previous row and an iter to get the next row (because
        * gtk_tree_path_next is cyclic, so we can't tell if we're at the bottom already). */
       if (moveUp && gtk_tree_path_prev(path))
@@ -1763,7 +1764,7 @@ gboolean treeMoveRowSelection(GtkWidget *tree, const gboolean moveUp, const gboo
 	  newRowExists = gtk_tree_model_get_iter(model, &newRowIter, path);
 	  newRowExists &= gtk_tree_model_iter_next(model, &newRowIter);
 	}
-      
+
       if (newRowExists)
 	{
 	  BlxSequence *newSeq = treeGetSequence(model, &newRowIter);
@@ -1784,13 +1785,13 @@ gboolean treeMoveRowSelection(GtkWidget *tree, const gboolean moveUp, const gboo
 	      blxWindowDeselectAllSeqs(treeGetBlxWindow(tree));
 	      blxWindowSelectSeq(blxWindow, newSeq);
 	    }
-	  
+
 	  treeScrollSelectionIntoView(tree, NULL);
 	}
     }
 
   destroyTreePathList(&rows);
-  
+
   return TRUE;
 }
 
@@ -1820,20 +1821,20 @@ static gboolean onMouseMoveTree(GtkWidget *tree, GdkEventMotion *event, gpointer
     {
       /* Feed back details about the currently-hovered over row in the detail-view statusbar area */
       GtkStatusbar *statusBar = treeGetStatusBar(tree);
-      
+
       if (statusBar)
         {
           /* Remove any previous message */
           guint contextId = gtk_statusbar_get_context_id(GTK_STATUSBAR(statusBar), DETAIL_VIEW_STATUSBAR_CONTEXT);
           gtk_statusbar_pop(GTK_STATUSBAR(statusBar), contextId);
-          
+
           /* Add details about the current row that is being hovered over */
           int bin_x = event->x, bin_y = event->y;
     //      gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(tree), event->x, event->y, &bin_x, &bin_y); //only from GTK v2.12
-          
+
           GtkTreePath *path = NULL;
           GtkTreeViewColumn *column = NULL;
-          
+
           if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tree), bin_x, bin_y, &path, &column, NULL, NULL))
             {
               GtkTreeIter iter;
@@ -1841,11 +1842,11 @@ static gboolean onMouseMoveTree(GtkWidget *tree, GdkEventMotion *event, gpointer
               gtk_tree_model_get_iter(model, &iter, path);
 
               GList *mspList = treeGetMsps(model, &iter);
-              
+
               if (g_list_length(mspList) > 0)
                 {
                   const MSP* const msp = (const MSP*)(mspList->data);
-                  
+
                   /* Note: this assumes that all MSPs in this row are in the same BlxSequence.
                    * If there are more, it will just show data for the first BlxSequence found. */
                   if (msp->sSequence)
@@ -1854,7 +1855,7 @@ static gboolean onMouseMoveTree(GtkWidget *tree, GdkEventMotion *event, gpointer
                       GList *columnList = detailViewGetColumnList(detailView);
 
                       char *displayText = blxSequenceGetSummaryInfo(msp->sSequence, columnList);
-                  
+
                       if (displayText)
                         {
                           gtk_statusbar_push(GTK_STATUSBAR(statusBar), contextId, displayText);
@@ -1866,7 +1867,7 @@ static gboolean onMouseMoveTree(GtkWidget *tree, GdkEventMotion *event, gpointer
 
           gtk_tree_path_free(path);
         }
-	
+
       return TRUE;
     }
   else
@@ -1880,7 +1881,7 @@ static gboolean onMouseMoveTree(GtkWidget *tree, GdkEventMotion *event, gpointer
 static int treeHeaderGetCoordAtPos(GtkWidget *header, GtkWidget *tree, const int x, const int y)
 {
   int baseIdx = UNSET_INT;
-  
+
   GtkWidget *detailView = treeGetDetailView(tree);
   GtkAdjustment *adjustment = detailViewGetAdjustment(detailView);
 
@@ -1889,7 +1890,7 @@ static int treeHeaderGetCoordAtPos(GtkWidget *header, GtkWidget *tree, const int
       /* Get the 0-based char index at x */
       gdouble charWidth = detailViewGetCharWidth(detailView);
       int charIdx = (int)((gdouble)x / charWidth);
-      
+
       /* Add the start of the scroll range to convert this to the display index */
       baseIdx = charIdx + adjustment->value;
     }
@@ -1901,7 +1902,7 @@ static int treeHeaderGetCoordAtPos(GtkWidget *header, GtkWidget *tree, const int
     {
       baseIdx = adjustment->value = adjustment->page_size;
     }
-  
+
   return baseIdx;
 }
 
@@ -1913,7 +1914,7 @@ static gboolean onMouseMoveTreeHeader(GtkWidget *header, GdkEventMotion *event,
 
   if (event->state & GDK_BUTTON2_MASK)
     {
-      /* Propagate the event to the detail view. The start of the header widget is at 
+      /* Propagate the event to the detail view. The start of the header widget is at
        * the start of the sequence column, so offset the coords before propagating. */
       GtkWidget *detailView = treeGetDetailView(tree);
       IntRange xRange;
@@ -1928,18 +1929,18 @@ static gboolean onMouseMoveTreeHeader(GtkWidget *header, GdkEventMotion *event,
       /* If we're hovering over a base that's affected by a variation, then feed back info
        * about the variation to the user. Only applicable if we're showing a nucleotide sequence. */
       BlxContext *bc = treeGetContext(tree);
-      
+
       if (bc->seqType == BLXSEQ_DNA)
         {
           /* Get the index we're hovering over */
           GtkWidget *detailView = treeGetDetailView(tree);
           const int displayIdx = treeHeaderGetCoordAtPos(header, tree, event->x, event->y);
           const int dnaIdx = convertDisplayIdxToDnaIdx(displayIdx, bc->seqType, detailViewGetActiveFrame(detailView), treeGetFrame(tree), bc->numFrames, bc->displayRev, &bc->refSeqRange);
-          
+
           updateFeedbackAreaNucleotide(detailView, dnaIdx, treeGetStrand(tree));
         }
     }
-      
+
   return handled;
 }
 
@@ -1982,7 +1983,7 @@ static gboolean onEnterTree(GtkWidget *tree, GdkEventCrossing *event, gpointer d
 static void clearStatusbar(GtkWidget *tree)
 {
   GtkStatusbar *statusBar = treeGetStatusBar(tree);
-  
+
   if (statusBar)
     {
       guint contextId = gtk_statusbar_get_context_id(GTK_STATUSBAR(statusBar), DETAIL_VIEW_STATUSBAR_CONTEXT);
@@ -1995,7 +1996,7 @@ static gboolean onLeaveTree(GtkWidget *tree, GdkEventCrossing *event, gpointer d
 {
   /* Remove any statusbar message that was added by mousing over the tree rows */
   clearStatusbar(tree);
-  
+
   /* Return true to stop the default handler re-drawing when the focus changes */
   return TRUE;
 }
@@ -2005,7 +2006,7 @@ static gboolean onLeaveTreeHeader(GtkWidget *header, GdkEventCrossing *event, gp
   /* Remove any statusbar message that was added by mousing over the tree header */
   GtkWidget *tree = GTK_WIDGET(data);
   clearStatusbar(tree);
-  
+
   return TRUE;
 }
 
@@ -2020,14 +2021,14 @@ void addMspToTree(MSP *msp, GtkWidget *tree, GtkListStore *store)
 
       GtkTreeIter iter;
       gtk_list_store_append(store, &iter);
-      
+
       /* The SequenceCellRenderer expects a GList of MSPs, so put our MSP in a list. For exons,
        * we want to add the child CDS/UTRs rather than the exon itself, so use the child list.
        * Note that this means we can have multiple MSPs on the same row even when the 'squash
        * matches' option is not on (which makes sense because realistically they are the same
        * object). */
       GList *mspGList = NULL;
-      
+
       if (msp->type == BLXMSP_EXON && g_list_length(msp->childMsps) > 0)
         {
           mspGList = msp->childMsps;
@@ -2039,7 +2040,7 @@ void addMspToTree(MSP *msp, GtkWidget *tree, GtkListStore *store)
 
       /* Loop through the rest of the columns */
       GList *item = columnList;
-      
+
       for ( ; item; item = item->next)
         {
           BlxColumnInfo *columnInfo = (BlxColumnInfo*)(item->data);
@@ -2060,11 +2061,11 @@ void addMspToTree(MSP *msp, GtkWidget *tree, GtkListStore *store)
               if (val) gtk_list_store_set_value(store, &iter, columnInfo->columnIdx, val);
             }
         }
-      
+
       /* Remember the path to this tree row for each MSP */
       GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
       GList *mspItem = mspGList;
-      
+
       for ( ; mspItem; mspItem = mspItem->next)
         {
           MSP *curMsp = (MSP*)(mspItem->data);
@@ -2079,13 +2080,13 @@ void addMspToTree(MSP *msp, GtkWidget *tree, GtkListStore *store)
 /* Cell data function for the "name" column. This displays the sequence name, but
  * abbreviated to fit the cell, and with a symbol appended to indicate the s strand */
 static void cellDataFunctionNameCol(GtkTreeViewColumn *column,
-				     GtkCellRenderer *renderer, 
-				     GtkTreeModel *model, 
-				     GtkTreeIter *iter, 
+				     GtkCellRenderer *renderer,
+				     GtkTreeModel *model,
+				     GtkTreeIter *iter,
 				     gpointer data)
 {
   GtkWidget *tree = GTK_WIDGET(data);
-  
+
   /* Get the MSP(s) for this row. They should all have the same sequence name. */
   GList	*mspGList = treeGetMsps(model, iter);
   const int numMsps = g_list_length(mspGList);
@@ -2106,8 +2107,8 @@ static void cellDataFunctionNameCol(GtkTreeViewColumn *column,
 
           if (!name)
             name = "<no name>";
-	
-	  /* If the display is squashed and identical matches are on 
+
+	  /* If the display is squashed and identical matches are on
            * the same linke, we need to create a name that includes the
            * number of duplicate matches. */
           BlxContext *bc = treeGetContext(tree);
@@ -2118,15 +2119,15 @@ static void cellDataFunctionNameCol(GtkTreeViewColumn *column,
               displayName = abbreviateText(name2, maxLen - 2);
               g_free(name2);
             }
-          
+
           if (!displayName)
             displayName = abbreviateText(name, maxLen - 2);
-          
+
           if (displayName)
             {
               char displayText[maxLen + 1];
               sprintf(displayText, "%s", displayName);
-	  
+
               int i = strlen(displayName);
               for ( ; i < maxLen - 1; ++i)
                 {
@@ -2137,7 +2138,7 @@ static void cellDataFunctionNameCol(GtkTreeViewColumn *column,
               displayText[maxLen] = 0;
 
               g_object_set(renderer, RENDERER_TEXT_PROPERTY, displayText, NULL);
-              
+
               g_free(displayName);
             }
 	}
@@ -2149,31 +2150,31 @@ static void cellDataFunctionNameCol(GtkTreeViewColumn *column,
 }
 
 
-/* Cell data function for the "start" column. This displays the start coord of the match 
+/* Cell data function for the "start" column. This displays the start coord of the match
  * sequence in normal left-to-right display, but the end coord if the display is reversed */
 static void cellDataFunctionStartCol(GtkTreeViewColumn *column,
-				     GtkCellRenderer *renderer, 
-				     GtkTreeModel *model, 
-				     GtkTreeIter *iter, 
+				     GtkCellRenderer *renderer,
+				     GtkTreeModel *model,
+				     GtkTreeIter *iter,
 				     gpointer data)
 {
   GtkWidget *tree = GTK_WIDGET(data);
 
   /* Get the MSPs in this row */
   GList	*mspGList = treeGetMsps(model, iter);
-  
+
   if (g_list_length(mspGList) > 0)
-    {  
+    {
       /* We want to display the min coord if we're in the same direction as the q strand,
        * or the max coord if we're in the opposite direction (unless the display is reversed,
        * in which case it's vice versa). */
       const MSP* const msp = (const MSP*)(mspGList->data);
-      
+
       if (mspIsBlastMatch(msp))
         {
           const gboolean sameDirection = (treeGetStrand(tree) == mspGetMatchStrand(msp));
           const gboolean findMin = (treeGetDisplayRev(tree) != sameDirection);
-          
+
           int coord = findMspListSExtent(mspGList, findMin);
 
           char displayText[numDigitsInInt(coord) + 1];
@@ -2192,31 +2193,31 @@ static void cellDataFunctionStartCol(GtkTreeViewColumn *column,
 }
 
 
-/* Cell data function for the "end" column. This displays the end coord of the match 
+/* Cell data function for the "end" column. This displays the end coord of the match
  * sequence in normal left-to-right display, but the start coord if the display is reversed */
-static void cellDataFunctionEndCol(GtkTreeViewColumn *column, 
-				   GtkCellRenderer *renderer, 
-				   GtkTreeModel *model, 
-				   GtkTreeIter *iter, 
+static void cellDataFunctionEndCol(GtkTreeViewColumn *column,
+				   GtkCellRenderer *renderer,
+				   GtkTreeModel *model,
+				   GtkTreeIter *iter,
 				   gpointer data)
 {
   GtkWidget *tree = GTK_WIDGET(data);
 
   /* Get the MSPs in this row */
   GList	*mspGList = treeGetMsps(model, iter);
-  
+
   if (g_list_length(mspGList) > 0)
-    {  
+    {
       /* We want to display the max coord if we're in the same direction as the q strand,
        * or the min coord if we're in the opposite direction (unless the display is reversed,
        * in which case it's vice versa). */
       const MSP* const msp = (const MSP*)(mspGList->data);
-      
+
       if (mspIsBlastMatch(msp))
         {
           const gboolean sameDirection = (treeGetStrand(tree) == mspGetMatchStrand(msp));
           const gboolean findMin = (treeGetDisplayRev(tree) == sameDirection);
-          
+
           int coord = findMspListSExtent(mspGList, findMin);
 
           char displayText[numDigitsInInt(coord) + 1];
@@ -2236,10 +2237,10 @@ static void cellDataFunctionEndCol(GtkTreeViewColumn *column,
 
 
 /* Cell data function for the score column. */
-static void cellDataFunctionScoreCol(GtkTreeViewColumn *column, 
-				    GtkCellRenderer *renderer, 
-				    GtkTreeModel *model, 
-				    GtkTreeIter *iter, 
+static void cellDataFunctionScoreCol(GtkTreeViewColumn *column,
+				    GtkCellRenderer *renderer,
+				    GtkTreeModel *model,
+				    GtkTreeIter *iter,
 				    gpointer data)
 {
   /* Get the MSP(s) for this row. Do not display coords if the row contains
@@ -2254,37 +2255,37 @@ static void cellDataFunctionScoreCol(GtkTreeViewColumn *column,
   else
     {
       const MSP* const msp = (const MSP*)(mspGList->data);
-    
+
       /* If the score is negative it means do not show */
       if (msp->score >= 0.0 && (g_list_length(mspGList) == 1 || mspGetFlag(msp, MSPFLAG_SQUASH_IDENTICAL_FEATURES)))
 	{
 	  const gdouble score = msp->score;
 	  char displayText[numDigitsInInt((int)score) + 3]; /* +3 to include decimal point, 1 dp, and terminating nul */
-	  
-    //      sprintf(displayText, "%1.1f", score); 
-	  sprintf(displayText, "%d", (int)score); 
-	  
+
+    //      sprintf(displayText, "%1.1f", score);
+	  sprintf(displayText, "%d", (int)score);
+
 	  g_object_set(renderer, RENDERER_TEXT_PROPERTY, displayText, NULL);
 	}
       else
 	{
 	  g_object_set(renderer, RENDERER_TEXT_PROPERTY, "", NULL);
 	}
-	
+
     }
 }
 
 
 /* Cell data function for the id column. */
-static void cellDataFunctionIdCol(GtkTreeViewColumn *column, 
-				  GtkCellRenderer *renderer, 
-				  GtkTreeModel *model, 
-				  GtkTreeIter *iter, 
+static void cellDataFunctionIdCol(GtkTreeViewColumn *column,
+				  GtkCellRenderer *renderer,
+				  GtkTreeModel *model,
+				  GtkTreeIter *iter,
 				  gpointer data)
 {
   /* Get the MSP(s) for this row. Do not display coords if the row contains multiple MSPs */
   GList	*mspGList = treeGetMsps(model, iter);
-  
+
   if (g_list_length(mspGList) < 1)
     {
       g_object_set(renderer, RENDERER_TEXT_PROPERTY, "", NULL);
@@ -2294,15 +2295,15 @@ static void cellDataFunctionIdCol(GtkTreeViewColumn *column,
       const MSP* const msp = (const MSP*)(mspGList->data);
 
       /* If the score is negative it means do not show. Also only display the
-       * ID if we only have one msp in the row (unless they are short reads, in 
+       * ID if we only have one msp in the row (unless they are short reads, in
        * which case the ID should be the same for all of them) */
       if (msp->id >= 0.0 && (g_list_length(mspGList) == 1 || mspGetFlag(msp, MSPFLAG_SQUASH_IDENTICAL_FEATURES)))
 	{
 	  const gdouble id = msp->id;
 	  char displayText[numDigitsInInt((int)id) + 3]; /* +3 to include decimal point, 1 dp, and terminating nul */
-	  
-          sprintf(displayText, "%1.1f", id); 
-//	  sprintf(displayText, "%d", (int)id); 
+
+          sprintf(displayText, "%1.1f", id);
+//	  sprintf(displayText, "%d", (int)id);
 
 	  g_object_set(renderer, RENDERER_TEXT_PROPERTY, displayText, NULL);
 	}
@@ -2315,16 +2316,16 @@ static void cellDataFunctionIdCol(GtkTreeViewColumn *column,
 
 
 /* Cell data function for the Group column. */
-static void cellDataFunctionGroupCol(GtkTreeViewColumn *column, 
-                                     GtkCellRenderer *renderer, 
-                                     GtkTreeModel *model, 
-                                     GtkTreeIter *iter, 
+static void cellDataFunctionGroupCol(GtkTreeViewColumn *column,
+                                     GtkCellRenderer *renderer,
+                                     GtkTreeModel *model,
+                                     GtkTreeIter *iter,
                                      gpointer data)
 {
   /* Get the MSP(s) for this row and find out they are in a group. All MSPs in a row should
    * be in the same sequence. */
   GList	*mspGList = treeGetMsps(model, iter);
-  
+
   if (g_list_length(mspGList) > 0)
     {
       const MSP* const msp = (const MSP*)(mspGList->data);
@@ -2333,7 +2334,7 @@ static void cellDataFunctionGroupCol(GtkTreeViewColumn *column,
       GtkWidget *blxWindow = treeGetBlxWindow(tree);
 
       SequenceGroup *group = blxWindowGetSequenceGroup(blxWindow, msp->sSequence);
-      
+
       if (group)
         {
           g_object_set(renderer, RENDERER_TEXT_PROPERTY, group->groupName, NULL);
@@ -2357,7 +2358,7 @@ static void cellDataFunctionOrganismCol(GtkTreeViewColumn *column, GtkCellRender
         {
           text = mspGetOrganism(msp);
         }
-      
+
       if (text)
         {
           g_object_set(renderer, RENDERER_TEXT_PROPERTY, text, NULL);
@@ -2376,7 +2377,7 @@ static void cellDataFunctionGenericCol(GtkTreeViewColumn *column, GtkCellRendere
     {
       const MSP* const msp = (const MSP*)(mspGList->data);
       const char *text = mspGetColumn(msp, columnId);
-      
+
       if (text)
         {
           g_object_set(renderer, RENDERER_TEXT_PROPERTY, text, NULL);
@@ -2389,7 +2390,7 @@ static const char* mspListGetSource(GList *mspList)
 {
   const char *result = NULL;
   GList *item = mspList;
-  
+
   for ( ; item; item = item->next)
     {
       const MSP* const msp = (const MSP*)(item->data);
@@ -2411,7 +2412,7 @@ static const char* mspListGetSource(GList *mspList)
           /* All sources are not the same. Return null. */
           result = NULL;
           break;
-        }      
+        }
     }
 
   return result;
@@ -2423,7 +2424,7 @@ static void cellDataFunctionSourceCol(GtkTreeViewColumn *column, GtkCellRenderer
 {
   GList	*mspGList = treeGetMsps(model, iter);
   const char *source = mspListGetSource(mspGList);
-  
+
   if (source)
     {
       g_object_set(renderer, RENDERER_TEXT_PROPERTY, source, NULL);
@@ -2444,16 +2445,16 @@ static void onSeqColWidthChanged(GtkTreeViewColumn *column, GParamSpec *paramSpe
 
 
 /* Create a single column in the tree. */
-static GtkTreeViewColumn* createTreeColumn(GtkWidget *tree, 
+static GtkTreeViewColumn* createTreeColumn(GtkWidget *tree,
                                            GtkWidget *detailView,
-                                           GtkCellRenderer *renderer, 
+                                           GtkCellRenderer *renderer,
                                            BlxColumnInfo *columnInfo,
                                            BlxColumnInfo *seqColInfo)
 {
   /* Create the column in the tree */
   GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(
-    columnInfo->title, 
-    renderer, 
+    columnInfo->title,
+    renderer,
     columnInfo->propertyName, columnInfo->columnIdx,  /* set the relevant property in the tree for the given column */
     RENDERER_DATA_PROPERTY, seqColInfo->columnIdx,  /* set the 'data' property in the tree to be the 'sequence' column (i.e. the MSP data) */
     NULL);
@@ -2465,12 +2466,12 @@ static GtkTreeViewColumn* createTreeColumn(GtkWidget *tree,
     {
       width = width - scrollBarWidth();
     }
-  
+
   if (columnInfo->columnId == BLXCOL_SEQUENCE)
     {
       g_signal_connect(G_OBJECT(column), "notify::width", G_CALLBACK(onSeqColWidthChanged), detailView);
     }
-  
+
   /* Set the column properties and add the column to the tree */
   if (width > 0)
     {
@@ -2483,11 +2484,11 @@ static GtkTreeViewColumn* createTreeColumn(GtkWidget *tree,
       /* Can't have 0 width, so hide the column instead */
       gtk_tree_view_column_set_visible(column, FALSE);
     }
-  
+
   gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
   gtk_tree_view_column_set_resizable(column, TRUE);
   gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
-  
+
   /* Special treatment for specific columns */
   switch (columnInfo->columnId)
   {
@@ -2495,7 +2496,7 @@ static GtkTreeViewColumn* createTreeColumn(GtkWidget *tree,
       gtk_tree_view_column_set_expand(column, TRUE);
       gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
       break;
-      
+
     case BLXCOL_SEQNAME:
       gtk_tree_view_column_set_cell_data_func(column, renderer, cellDataFunctionNameCol, tree, NULL);
       break;
@@ -2503,11 +2504,11 @@ static GtkTreeViewColumn* createTreeColumn(GtkWidget *tree,
     case BLXCOL_START:
       gtk_tree_view_column_set_cell_data_func(column, renderer, cellDataFunctionStartCol, tree, NULL);
       break;
-      
+
     case BLXCOL_END:
       gtk_tree_view_column_set_cell_data_func(column, renderer, cellDataFunctionEndCol, tree, NULL);
       break;
-      
+
     case BLXCOL_SCORE:
       gtk_tree_view_column_set_cell_data_func(column, renderer, cellDataFunctionScoreCol, tree, NULL);
       break;
@@ -2519,7 +2520,7 @@ static GtkTreeViewColumn* createTreeColumn(GtkWidget *tree,
     case BLXCOL_GROUP:
       gtk_tree_view_column_set_cell_data_func(column, renderer, cellDataFunctionGroupCol, tree, NULL);
       break;
-      
+
     case BLXCOL_SOURCE:
       gtk_tree_view_column_set_cell_data_func(column, renderer, cellDataFunctionSourceCol, tree, NULL);
       break;
@@ -2527,12 +2528,12 @@ static GtkTreeViewColumn* createTreeColumn(GtkWidget *tree,
     case BLXCOL_ORGANISM:
       gtk_tree_view_column_set_cell_data_func(column, renderer, cellDataFunctionOrganismCol, tree, NULL);
       break;
-    
+
     default:
       gtk_tree_view_column_set_cell_data_func(column, renderer, cellDataFunctionGenericCol, GINT_TO_POINTER(columnInfo->columnId), NULL);
       break;
   }
-  
+
   return column;
 }
 
@@ -2543,7 +2544,7 @@ static GtkTreeViewColumn* createTreeColumn(GtkWidget *tree,
 static void refreshNameColHeader(GtkWidget *headerWidget, gpointer data)
 {
   GtkWidget *label = getLabelWidget(headerWidget);
-  
+
   if (GTK_IS_LABEL(label))
     {
       GtkWidget *tree = GTK_WIDGET(data);
@@ -2557,13 +2558,13 @@ static void refreshNameColHeader(GtkWidget *headerWidget, gpointer data)
       /* Abbreviate the name */
       const char *refSeqName = blxWindowGetRefSeqName(treeGetBlxWindow(tree));
       const int maxLen = (int)((gdouble)colWidth / treeGetCharWidth(tree));
-      
+
       char strandChar = (treeGetStrand(tree) == BLXSTRAND_FORWARD ? '+' : '-');
       char *stringToAppend = g_strdup_printf("(%c%d)", strandChar, treeGetFrame(tree));
       const int numCharsToAppend = strlen(stringToAppend);
-      
+
       gchar *displayText = NULL;
-      
+
       if (maxLen > numCharsToAppend)
 	{
 	  /* Abbreviate the name and then append the strand/frame */
@@ -2596,7 +2597,7 @@ static void refreshNameColHeader(GtkWidget *headerWidget, gpointer data)
 static void refreshStartColHeader(GtkWidget *headerWidget, gpointer data)
 {
   GtkWidget *label = getLabelWidget(headerWidget);
-  
+
   if (GTK_IS_LABEL(label))
     {
       GtkWidget *tree = GTK_WIDGET(data);
@@ -2605,22 +2606,22 @@ static void refreshStartColHeader(GtkWidget *headerWidget, gpointer data)
       /* Update the font, in case its size has changed */
       gtk_widget_modify_font(label, treeGetFontDesc(tree));
 
-      int displayVal = getStartDnaCoord(treeGetDisplayRange(tree), 
+      int displayVal = getStartDnaCoord(treeGetDisplayRange(tree),
 					treeGetFrame(tree),
-					bc->seqType, 
-					bc->displayRev, 
+					bc->seqType,
+					bc->displayRev,
 					bc->numFrames,
 					&bc->refSeqRange);
-      
+
       if (treeGetNegateCoords(tree))
         displayVal *= -1;
 
       const int displayTextLen = numDigitsInInt(displayVal) + 1;
-      
+
       gchar displayText[displayTextLen];
       sprintf(displayText, "%d", displayVal);
       displayText[displayTextLen - 1] = '\0';
-      
+
       gtk_label_set_text(GTK_LABEL(label), displayText);
     }
   else
@@ -2639,23 +2640,23 @@ static void refreshEndColHeader(GtkWidget *headerWidget, gpointer data)
     {
       GtkWidget *tree = GTK_WIDGET(data);
       BlxContext *bc = treeGetContext(tree);
-    
+
       int displayVal = getEndDnaCoord(treeGetDisplayRange(tree),
 				      treeGetFrame(tree),
-				      bc->seqType, 
-				      bc->displayRev, 
+				      bc->seqType,
+				      bc->displayRev,
 				      bc->numFrames,
 				      &bc->refSeqRange);
-      
+
       if (treeGetNegateCoords(tree))
         displayVal *= -1;
-      
+
       const int displayTextLen = numDigitsInInt(displayVal) + 1;
-      
+
       gchar displayText[displayTextLen];
       sprintf(displayText, "%d", displayVal);
       displayText[displayTextLen - 1] = '\0';
-      
+
       gtk_label_set_text(GTK_LABEL(label), displayText);
     }
   else
@@ -2669,40 +2670,40 @@ static int calculateColumnWidth(TreeColumnHeaderInfo *headerInfo, GtkWidget *tre
 {
   GtkWidget *detailView = treeGetDetailView(tree);
   GList *columnList = detailViewGetColumnList(detailView);
-  
+
   /* Sum the width of all columns that this header includes */
   GList *listItem = headerInfo->columnIds;
   int width = 0;
-  
+
   for ( ; listItem; listItem = listItem->next)
     {
       BlxColumnId columnId = (BlxColumnId)GPOINTER_TO_INT(listItem->data);
-      
+
       BlxColumnInfo *columnInfo = getColumnInfo(columnList, columnId);
-      
+
       if (showColumn(columnInfo))
         {
           width = width + columnInfo->width;
         }
     }
-  
+
   return width;
 }
 
 
 /* Utility function to create a TreeColumnHeaderInfo struct and initialise its values */
-static TreeColumnHeaderInfo* createTreeColumnHeaderInfo(GtkWidget *headerWidget, 
-							GtkWidget *tree, 
-							GList *columnIds, 
+static TreeColumnHeaderInfo* createTreeColumnHeaderInfo(GtkWidget *headerWidget,
+							GtkWidget *tree,
+							GList *columnIds,
 							GtkCallback refreshFunc)
 {
   TreeColumnHeaderInfo *headerInfo = new TreeColumnHeaderInfo;
-  
+
   headerInfo->headerWidget = headerWidget;
   headerInfo->tree = tree;
   headerInfo->columnIds = columnIds;
   headerInfo->refreshFunc = refreshFunc;
-  
+
   return headerInfo;
 }
 
@@ -2710,7 +2711,7 @@ static TreeColumnHeaderInfo* createTreeColumnHeaderInfo(GtkWidget *headerWidget,
 /* Create the column header widget for the given column in the tree header. It gets placed in
  * a TreecolumnHeaderInfo struct along with other header properties. The tree header shows
  * information about the reference sequence. */
-static TreeColumnHeaderInfo* createTreeColHeader(GList **columnHeaders, 
+static TreeColumnHeaderInfo* createTreeColHeader(GList **columnHeaders,
                                                  GtkTreeViewColumn *treeColumn,
                                                  BlxColumnInfo *columnInfo,
                                                  TreeColumnHeaderInfo* firstTreeCol,
@@ -2721,13 +2722,13 @@ static TreeColumnHeaderInfo* createTreeColHeader(GList **columnHeaders,
                                                  const int frame,
                                                  const BlxStrand strand)
 {
-  /* Create a header widget for this column, if required. Also create a list of other 
+  /* Create a header widget for this column, if required. Also create a list of other
    * column IDs we wish to merge under the same header (i.e. the 'Name' header spans over
    * the name column as well as the score and Id columns). */
   GtkWidget *columnHeader = NULL;
   GList *columnIds = NULL;
   GtkCallback refreshFunc = NULL;
-  
+
   switch (columnInfo->columnId)
     {
       case BLXCOL_SEQNAME:
@@ -2741,16 +2742,16 @@ static TreeColumnHeaderInfo* createTreeColHeader(GList **columnHeaders,
 	  g_signal_connect(G_OBJECT(columnHeader), "expose-event", G_CALLBACK(onExposeGenericHeader), detailView);
 	  break;
 	}
-	
+
       case BLXCOL_SEQUENCE:
 	{
 	  /* The sequence column header contains the reference sequence. */
 	  columnHeader = gtk_layout_new(NULL, NULL);
-	  
+
 	  seqColHeaderSetRow(columnHeader, frame);
 	  gtk_widget_set_name(columnHeader, DNA_TRACK_HEADER_NAME);
 	  g_signal_connect(G_OBJECT(columnHeader), "expose-event", G_CALLBACK(onExposeRefSeqHeader), tree);
-	  
+
 	  refreshFunc = refreshTextHeader;
 	  columnIds = g_list_append(columnIds, GINT_TO_POINTER(columnInfo->columnId));
 
@@ -2762,7 +2763,7 @@ static TreeColumnHeaderInfo* createTreeColHeader(GList **columnHeaders,
           g_signal_connect(G_OBJECT(columnHeader), "button-release-event",  G_CALLBACK(onButtonReleaseTreeHeader), tree);
           g_signal_connect(G_OBJECT(columnHeader), "motion-notify-event",   G_CALLBACK(onMouseMoveTreeHeader), tree);
           g_signal_connect(G_OBJECT(columnHeader), "leave-notify-event",    G_CALLBACK(onLeaveTreeHeader), tree);
-          
+
 	  break;
 	}
 
@@ -2775,7 +2776,7 @@ static TreeColumnHeaderInfo* createTreeColHeader(GList **columnHeaders,
           g_signal_connect(G_OBJECT(columnHeader), "expose-event", G_CALLBACK(onExposeGenericHeader), detailView);
 	  break;
 	}
-	
+
       case BLXCOL_END:
 	{
 	  /* The end column header displays the start index of the current display range */
@@ -2794,20 +2795,20 @@ static TreeColumnHeaderInfo* createTreeColHeader(GList **columnHeaders,
             {
               firstTreeCol->columnIds = g_list_append(firstTreeCol->columnIds, GINT_TO_POINTER(columnInfo->columnId));
             }
-          
+
           break;
         }
     };
 
   TreeColumnHeaderInfo *headerInfo = NULL;
-  
+
   if (columnHeader)
     {
       /* Create a header info struct for each column, even if its contents are null */
       headerInfo = createTreeColumnHeaderInfo(columnHeader, tree, columnIds, refreshFunc);
       *columnHeaders = g_list_append(*columnHeaders, headerInfo);
     }
-  
+
   return headerInfo;
 }
 
@@ -2817,24 +2818,24 @@ static TreeColumnHeaderInfo* createTreeColHeader(GList **columnHeaders,
 //{
 //  int binx, biny;
 //  gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(tree), x, y, &binx, &biny);
-//  
+//
 //  GtkTreeViewColumn *column = NULL;
 //  gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tree), binx, biny, NULL, &column, NULL, NULL);
-//  
+//
 //  if (column == gtk_tree_view_get_column(GTK_TREE_VIEW(tree), BLXCOL_SEQNAME))
 //    {
 //        gtk_tooltip_set_text(tooltip, "hello");
 //
 //    }
-//  
+//
 //  return TRUE;
 //}
 
 
 /* Create the columns. Returns a list of header info for the column headers */
-static GList* createTreeColumns(GtkWidget *tree, 
+static GList* createTreeColumns(GtkWidget *tree,
                                 GtkWidget *detailView,
-                                GtkCellRenderer *renderer, 
+                                GtkCellRenderer *renderer,
                                 const BlxSeqType seqType,
                                 GList *columnList,
                                 GtkWidget *columnHeaderBar,
@@ -2852,26 +2853,26 @@ static GList* createTreeColumns(GtkWidget *tree,
   TreeColumnHeaderInfo* firstTreeCol = NULL;
   GList *column = columnList;
   BlxColumnInfo *seqColInfo = getColumnInfo(columnList, BLXCOL_SEQUENCE);
-  
+
   for ( ; column; column = column->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)column->data;
-      
+
       if (columnInfo)
 	{
 	  GtkTreeViewColumn *treeColumn = createTreeColumn(tree, detailView, renderer, columnInfo, seqColInfo);
-          
-	  TreeColumnHeaderInfo* headerInfo = createTreeColHeader(&treeColumns, 
-                                                                 treeColumn, 
-                                                                 columnInfo, 
-                                                                 firstTreeCol, 
-                                                                 columnHeaderBar, 
-                                                                 tree, 
-                                                                 detailView, 
-                                                                 refSeqName, 
-                                                                 frame, 
+
+	  TreeColumnHeaderInfo* headerInfo = createTreeColHeader(&treeColumns,
+                                                                 treeColumn,
+                                                                 columnInfo,
+                                                                 firstTreeCol,
+                                                                 columnHeaderBar,
+                                                                 tree,
+                                                                 detailView,
+                                                                 refSeqName,
+                                                                 frame,
                                                                  strand);
-          
+
           if (!firstTreeCol)
             {
               firstTreeCol = headerInfo;
@@ -2882,7 +2883,7 @@ static GList* createTreeColumns(GtkWidget *tree,
 	  g_warning("Error creating column; invalid column info in detail-view column-list.\n");
 	}
     }
-  
+
   /* Set a tooltip to display the sequence name. To do: at the moment this shows
    * the tooltip when hovering anywhere over the tree: really we probably just
    * want to show it when hovering over the name column. */
@@ -2898,29 +2899,29 @@ static GList* createTreeColumns(GtkWidget *tree,
 static void addColumnsToTreeHeader(GtkWidget *headerBar, GList *columnList)
 {
   GList *columnItem = columnList;
-  
+
   for ( ; columnItem; columnItem = columnItem->next)
     {
       TreeColumnHeaderInfo *columnInfo = (TreeColumnHeaderInfo*)(columnItem->data);
-      
+
       /* Put the header widget in an event box so that we can color its background. */
       GtkWidget *eventBox = gtk_event_box_new();
       gtk_container_add(GTK_CONTAINER(eventBox), columnInfo->headerWidget);
-      
+
       /* Put the event box into the header bar. If it's the sequence column, set the expand property. */
       gboolean expand = (g_list_find(columnInfo->columnIds, GINT_TO_POINTER(BLXCOL_SEQUENCE)) != NULL);
-      
+
       gtk_box_pack_start(GTK_BOX(headerBar), eventBox, expand, TRUE, 0);
     }
 }
 
 
-/* This is the main sort comparison function for comparing two rows of a 
+/* This is the main sort comparison function for comparing two rows of a
  * tree view. The sort criteria are specified in the detailView properties;
  * we may sort by multiple columns.
- * 
+ *
  * Returns a negative value if the first row appears before the second,
- * positive if the second appears before the first, or 0 if they are 
+ * positive if the second appears before the first, or 0 if they are
  * equivalent. */
 static gint sortColumnCompareFunc(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter *iter2, gpointer data)
 {
@@ -2940,7 +2941,7 @@ static gint sortColumnCompareFunc(GtkTreeModel *model, GtkTreeIter *iter1, GtkTr
       for ( ; priority < numColumns; ++priority)
         {
           BlxColumnId sortColumn = dvProperties->sortColumns[priority];
-          
+
           /* NONE indicates an unused entry in the priority array; if we reach
            * an unset value, there should be no more values after it */
           if (sortColumn == BLXCOL_NONE)
@@ -2949,16 +2950,16 @@ static gint sortColumnCompareFunc(GtkTreeModel *model, GtkTreeIter *iter1, GtkTr
           /* Extract the MSPs for the two rows that we're comparing */
           GList *mspGList1 = treeGetMsps(model, iter1);
           GList *mspGList2 = treeGetMsps(model, iter2);
-  
+
           /* Do the comparison on this column */
           result = sortByColumnCompareFunc(mspGList1, mspGList2, detailView, sortColumn);
-          
+
           /* If rows are equal, continue to sort; otherwise we're done */
           if (result != 0)
             break;
         }
     }
-  
+
   return result;
 }
 
@@ -2969,10 +2970,10 @@ void treeCreateBaseDataModel(GtkWidget *tree, gpointer data)
   /* Create the data store for the tree view (unless it already exists) */
   if (treeGetBaseDataModel(GTK_TREE_VIEW(tree)))
     return;
-  
+
   /* Create the data store for the tree. We must know how many columns
    * we have, and their data types. */
-  GtkWidget *detailView = treeGetDetailView(tree);  
+  GtkWidget *detailView = treeGetDetailView(tree);
   GList *columnList = detailViewGetColumnList(detailView);
   const int numCols = g_list_length(columnList);
   GType *typeList = columnListGetTypes(columnList);
@@ -2985,12 +2986,12 @@ void treeCreateBaseDataModel(GtkWidget *tree, gpointer data)
     {
       gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store), colNum,	sortColumnCompareFunc, tree, NULL);
     }
-  
+
   gtk_tree_view_set_model(GTK_TREE_VIEW(tree), GTK_TREE_MODEL(store));
-  
+
   /* gtk_tree_view_set_model increments the reference count to 'store', so we should
    * decrement the reference count when we lose our local reference to it. */
-  g_object_unref(G_OBJECT(store));  
+  g_object_unref(G_OBJECT(store));
 }
 
 
@@ -3003,22 +3004,22 @@ void treeCreateFilteredDataModel(GtkWidget *tree, gpointer data)
    * model is different to the base model, we can assume it's the filtered model.)*/
   if (treeGetVisibleDataModel(GTK_TREE_VIEW(tree)) != baseModel)
     return;
-  
+
   GtkTreeModel *filter = gtk_tree_model_filter_new(GTK_TREE_MODEL(baseModel), NULL);
 
-  gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(filter), 
-					 (GtkTreeModelFilterVisibleFunc)isTreeRowVisible, 
-					 tree, 
+  gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(filter),
+					 (GtkTreeModelFilterVisibleFunc)isTreeRowVisible,
+					 tree,
 					 NULL);
-  
+
   /* Add the filtered store to the tree view */
   gtk_tree_view_set_model(GTK_TREE_VIEW(tree), GTK_TREE_MODEL(filter));
-  
+
   /* Keep a reference to the model in the properties so we can switch between this and the 'squashed' model */
   TreeProperties *properties = treeGetProperties(tree);
   properties->treeModels[BLXMODEL_NORMAL] = gtk_tree_view_get_model(GTK_TREE_VIEW(tree));
-  
-  /* Note that we would normally decrement the reference count to 'filter' because we 
+
+  /* Note that we would normally decrement the reference count to 'filter' because we
    * will lose the local pointer to it.  However, we've also added a pointer to it
    * from our properties, so we would need to increment the reference count again */
 }
@@ -3028,22 +3029,22 @@ static void setTreeStyle(GtkTreeView *tree)
 {
   gtk_widget_set_name(GTK_WIDGET(tree), DETAIL_VIEW_TREE_NAME);
   gtk_widget_set_redraw_on_allocate(GTK_WIDGET(tree), FALSE);
-  
+
   gtk_tree_view_set_grid_lines(tree, GTK_TREE_VIEW_GRID_LINES_NONE);
   gtk_tree_selection_set_mode(gtk_tree_view_get_selection(tree), GTK_SELECTION_MULTIPLE);
   gtk_tree_view_set_reorderable(tree, TRUE);
   gtk_tree_view_set_headers_visible(tree, FALSE);
   gtk_tree_view_set_enable_search(tree, FALSE);
-  
+
   /* Set the background color for the rows to be the same as the widget's background color */
   gtk_widget_modify_base(GTK_WIDGET(tree), GTK_STATE_NORMAL, GTK_WIDGET(tree)->style->bg);
 
-  /* The default text color when rows are selected is white. This doesn't work 
+  /* The default text color when rows are selected is white. This doesn't work
    * well against our default background color of cyan, so use the same text color
    * as unselected rows. */
   gtk_widget_modify_text(GTK_WIDGET(tree), GTK_STATE_SELECTED, GTK_WIDGET(tree)->style->text);
   gtk_widget_modify_text(GTK_WIDGET(tree), GTK_STATE_ACTIVE, GTK_WIDGET(tree)->style->text);
-  
+
   /* Set the expander size to 0 so that we can have tiny rows (otherwise the min is 12pt).
    * Also set the vertical separator to 0 so that we can have the option of the smallest
    * fonts possible. (The vertical separator causes gaps between rows. We want rows to be
@@ -3057,30 +3058,30 @@ static void setTreeStyle(GtkTreeView *tree)
 	  "GtkTreeView::horizontal-separator  = 0\n"
 	  "}"
 	  "widget \"*%s*\" style \"packedTree\"", DETAIL_VIEW_TREE_NAME);
-  gtk_rc_parse_string(parseString);  
+  gtk_rc_parse_string(parseString);
 }
 
 
 /* Create the widget that will contain all the header widgets. If includeNnpTrack is
  * not null then the snpTrack is also created */
-static GtkWidget *createDetailViewTreeHeader(GtkWidget *detailView, 
+static GtkWidget *createDetailViewTreeHeader(GtkWidget *detailView,
                                              const BlxStrand strand,
                                              const gboolean includeSnpTrack,
                                              GtkWidget **snpTrack)
 {
   GtkWidget *columnHeaderBar = gtk_hbox_new(FALSE, 0);
-  
+
   if (includeSnpTrack && snpTrack)
     {
       *snpTrack = createSnpTrackHeader(detailView, strand);
     }
-   
+
   return columnHeaderBar;
 }
 
 
-GtkWidget* createDetailViewTree(GtkWidget *grid, 
-				GtkWidget *detailView, 
+GtkWidget* createDetailViewTree(GtkWidget *grid,
+				GtkWidget *detailView,
 				GtkCellRenderer *renderer,
 				GList **treeList,
 				GList *columnList,
@@ -3091,13 +3092,13 @@ GtkWidget* createDetailViewTree(GtkWidget *grid,
 {
   /* Find the strand the tree belongs to from the grid */
   const BlxStrand strand = gridGetStrand(grid);
-  
+
   /* Create a tree view for the list of match sequences */
   GtkWidget *tree = gtk_tree_view_new();
   setTreeStyle(GTK_TREE_VIEW(tree));
 
   /* Put it in a scrolled window for vertical scrolling only (hoz scrolling will be via our
-   * custom adjustment). Always display the scrollbars because we assume the column widths 
+   * custom adjustment). Always display the scrollbars because we assume the column widths
    * are the same for all trees and they won't be if one shows a scrollbar and another doesn't. */
   GtkWidget *scrollWin = gtk_scrolled_window_new(NULL, NULL);
   //gtk_widget_set_name(scrollWin, DETAIL_VIEW_TREE_CONTAINER_NAME);
@@ -3111,7 +3112,7 @@ GtkWidget* createDetailViewTree(GtkWidget *grid,
   /* Create a header */
   GtkWidget *snpTrack = NULL;
   GtkWidget *columnHeaderBar = createDetailViewTreeHeader(detailView, strand, includeSnpTrack, &snpTrack);
-  
+
   /* Pack the headers and alignments in a container. */
   GtkWidget *container = NULL;
 
@@ -3135,17 +3136,17 @@ GtkWidget* createDetailViewTree(GtkWidget *grid,
 
       gtk_box_pack_start(GTK_BOX(container), columnHeaderBar, FALSE, FALSE, 0);
       gtk_box_pack_start(GTK_BOX(container), scrollWin, TRUE, TRUE, 0);
-    }  
+    }
 
   /* Create the tree columns */
   GList *treeColumnHeaderList = createTreeColumns(tree, detailView, renderer, seqType, columnList, columnHeaderBar, refSeqName, frame, strand);
-  
+
   /* Add the columns to the tree header */
   addColumnsToTreeHeader(columnHeaderBar, treeColumnHeaderList);
-  
+
   /* Set the essential tree properties */
   treeCreateProperties(tree, grid, detailView, frame, treeColumnHeaderList, includeSnpTrack);
-  
+
   /* Connect signals */
   gtk_widget_add_events(tree, GDK_FOCUS_CHANGE_MASK);
   g_signal_connect(G_OBJECT(tree), "button-press-event",    G_CALLBACK(onButtonPressTree),	NULL);
@@ -3167,7 +3168,7 @@ GtkWidget* createDetailViewTree(GtkWidget *grid,
   gtk_widget_set_name(treeFrame, DETAIL_VIEW_TREE_CONTAINER_NAME);
   gtk_frame_set_shadow_type(GTK_FRAME(treeFrame), GTK_SHADOW_IN);
   gtk_container_add(GTK_CONTAINER(treeFrame), container);
-  
+
   /* Add the tree's outermost container to the given tree list. Also increase its ref count so that
    * we can add/remove it from its parent (which we do to switch panes when we toggle strands)
    * without worrying about it being destroyed. */
@@ -3176,4 +3177,3 @@ GtkWidget* createDetailViewTree(GtkWidget *grid,
 
   return treeFrame;
 }
-
diff --git a/src/blixemApp/detailviewtree.hpp b/src/blixemApp/detailviewtree.hpp
index 6d47338fffe46fdebbc9705a910826ed33755cd2..49ab971c8edd80b4798a365e3ed900406006f9e4 100644
--- a/src/blixemApp/detailviewtree.hpp
+++ b/src/blixemApp/detailviewtree.hpp
@@ -1,5 +1,6 @@
 /*  File: detailviewtree.h
  *  Author: Gemma Barson, 2009-11-23
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -28,8 +29,8 @@
  *      Roy Storey        (Sanger Institute, UK)  <rds@sanger.ac.uk>
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
- * Description: A detail-view tree shows all of the alignments for a particular 
- *              reading-frame and strand of the reference sequence. It 
+ * Description: A detail-view tree shows all of the alignments for a particular
+ *              reading-frame and strand of the reference sequence. It
  *              constitutes one pane in the detail-view. It has a header
  *              showing the reference sequence and, lined up below this, shows
  *              the sequence data for each match sequence within the current
@@ -42,7 +43,7 @@
  *
  *              All detail-view trees share the same scrollbar/display-range
  *              so that they all show the same section of reference sequence.
- *              The cell contents of the tree are drawn by a custom cell 
+ *              The cell contents of the tree are drawn by a custom cell
  *              renderer - see sequencecellrenderer.h.
  *----------------------------------------------------------------------------
  */
@@ -71,7 +72,7 @@ typedef struct _TreeColumnHeaderInfo
 
 
 /* This struct holds info about a detail-view tree pane */
-class TreeProperties 
+class TreeProperties
 {
 public:
   GtkWidget *widget;                /* The tree widget */
@@ -117,7 +118,7 @@ void              treeDrawCachedBitmap(GtkWidget *tree, gpointer data);
 
 void              setMouseDragMode(const gboolean value);
 
-GtkWidget*	  createDetailViewTree(GtkWidget *grid, 
+GtkWidget*	  createDetailViewTree(GtkWidget *grid,
 				       GtkWidget *detailView,
 				       GtkCellRenderer *renderer,
 				       GList **treeList,
diff --git a/src/blixemApp/exonview.cpp b/src/blixemApp/exonview.cpp
index dcdcb75fa34b49331e9bc491382dd4f7b52853c1..6df5b3462a7fef6cac768665fa64d928b2803cde 100644
--- a/src/blixemApp/exonview.cpp
+++ b/src/blixemApp/exonview.cpp
@@ -1,5 +1,6 @@
 /*  File: exonview.c
  *  Author: Gemma Barson, 2009-12-24
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -60,15 +61,15 @@ public:
   GtkWidget *widget;                  /* The exon view */
   GtkWidget *bigPicture;	      /* The big picture that this view belongs to */
   BlxStrand currentStrand;	      /* Which strand of the ref seq this view displays exons for */
-    
+
   gboolean expanded;		      /* Whether the exon view is expanded or compressed */
-    
+
   int yPad;			      /* y padding */
-    
+
   GdkRectangle exonViewRect;	      /* The drawing area for the exon view */
   GdkRectangle highlightRect;       /* The area that the highlight box will cover (indicating the current detail-view display range) */
-    
-  int exonHeight;                   /* the height of an individual exon */ 
+
+  int exonHeight;                   /* the height of an individual exon */
 };
 
 
@@ -105,8 +106,8 @@ static ExonViewProperties*	exonViewGetProperties(GtkWidget *exonView);
  *                       Utility functions                 *
  ***********************************************************/
 
-/* Calls the given function (passed as the data pointer) on the given widget 
- * if it is an exon view in the big picture view, or, if it is a container, 
+/* Calls the given function (passed as the data pointer) on the given widget
+ * if it is an exon view in the big picture view, or, if it is a container,
  * calls the function on all children/grandchildren/etc that are exon views */
 void callFuncOnAllBigPictureExonViews(GtkWidget *widget, gpointer data)
 {
@@ -123,15 +124,15 @@ void callFuncOnAllBigPictureExonViews(GtkWidget *widget, gpointer data)
 }
 
 
-static gboolean calculateExonIntronDimensions(const MSP* const msp, 
+static gboolean calculateExonIntronDimensions(const MSP* const msp,
                                               BlxContext *bc,
                                               const IntRange* const displayRange,
                                               GdkRectangle *exonViewRect,
-                                              int *x, 
+                                              int *x,
                                               int *width)
 {
   gboolean drawn = FALSE;
-  
+
   /* Find the coordinates of the start and end base in this msp, converting to display coords. Note
    * that display coords always increase from left-to-right, even if the actual coords are inverted. */
   const IntRange* const mspDisplayRange = mspGetDisplayRange(msp);
@@ -145,20 +146,20 @@ static gboolean calculateExonIntronDimensions(const MSP* const msp,
       convertDisplayRangeToDnaRange(displayRange, bc->seqType,
                                     bc->numFrames, bc->displayRev,
                                     &bc->refSeqRange, &dnaDispRange);
-      
+
       /* The grid pos for coords gives the left edge of the coord, so draw to max + 1 to be inclusive */
       const int qStart = msp->qRange.min(true, bc->displayRev);
       const int qEnd = msp->qRange.max(true, bc->displayRev);
-  
+
       const gint x1 = convertBaseIdxToRectPos(qStart, exonViewRect, &dnaDispRange,
                                               TRUE, bc->displayRev, FALSE);
-      const gint x2 = convertBaseIdxToRectPos(qEnd, exonViewRect, &dnaDispRange, 
+      const gint x2 = convertBaseIdxToRectPos(qEnd, exonViewRect, &dnaDispRange,
                                               TRUE, bc->displayRev, FALSE);
-      
+
       *x = min(x1, x2);
       *width = abs(x1 - x2);
     }
- 
+
   return drawn;
 }
 
@@ -168,10 +169,10 @@ static gboolean showMspInExonView(const MSP *msp, const BlxStrand strand, BlxCon
 {
   /* Check it's an exon or intron */
   gboolean showMsp = mspIsBoxFeature(msp) || mspIsIntron(msp);
-  
+
   /* Check it's in a visible layer */
   showMsp &= mspLayerIsVisible(msp);
-  
+
   /* Check it's the correct strand */
   showMsp &= (mspGetRefStrand(msp) == strand);
 
@@ -188,7 +189,7 @@ static gboolean showMspInExonView(const MSP *msp, const BlxStrand strand, BlxCon
 
 /* Mark the given exon's transcript as selected if this exon contains the given coords.
  * Returns true if it was selected. */
-static gboolean selectExonIfContainsCoords(GtkWidget *exonView, 
+static gboolean selectExonIfContainsCoords(GtkWidget *exonView,
                                            ExonViewProperties *properties,
                                            BlxContext *bc,
                                            const IntRange* const displayRange,
@@ -200,12 +201,12 @@ static gboolean selectExonIfContainsCoords(GtkWidget *exonView,
                                            gboolean *drawn)
 {
   gboolean wasSelected = FALSE;
-  
-  if (showMspInExonView(msp, properties->currentStrand, bc) && 
+
+  if (showMspInExonView(msp, properties->currentStrand, bc) &&
       rangesOverlap(displayRange, mspGetDisplayRange(msp)))
     {
       *drawn = TRUE;
-      
+
       int mspX = UNSET_INT, mspWidth = UNSET_INT;
       calculateExonIntronDimensions(msp, bc, displayRange, &properties->exonViewRect, &mspX, &mspWidth);
 
@@ -213,14 +214,14 @@ static gboolean selectExonIfContainsCoords(GtkWidget *exonView,
 	{
 	  /* It's a hit. Select this sequence. */
 	  GtkWidget *blxWindow = exonViewGetBlxWindow(exonView);
-	  
+
 	  if (deselectOthers)
 	    {
 	      blxWindowDeselectAllSeqs(blxWindow);
 	    }
-	  
+
 	  blxWindowSelectSeq(blxWindow, msp->sSequence);
-	  
+
 	  /* Update the selected strand */
 	  GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
           ExonViewProperties *properties = exonViewGetProperties(exonView);
@@ -232,16 +233,16 @@ static gboolean selectExonIfContainsCoords(GtkWidget *exonView,
 	  wasSelected = TRUE;
 	}
     }
-  
+
   return wasSelected;
 }
 
 
 /* Loop through all the msp lines for this grid and mark them as selected
  * if they contain the coords of the mouse press */
-static gboolean selectClickedExon(GtkWidget *exonView, 
-                                  GdkEventButton *event, 
-                                  const gboolean ctrlModifier, 
+static gboolean selectClickedExon(GtkWidget *exonView,
+                                  GdkEventButton *event,
+                                  const gboolean ctrlModifier,
                                   const gboolean shiftModifier)
 {
   ExonViewProperties *properties = exonViewGetProperties(exonView);
@@ -254,17 +255,17 @@ static gboolean selectClickedExon(GtkWidget *exonView,
 
   gboolean found = FALSE;
   int y = properties->yPad;
-  
+
   for ( ; seqItem && !found; seqItem = seqItem->next)
     {
       const BlxSequence* const seq = (const BlxSequence*)(seqItem->data);
       GList *mspItem = seq->mspList;
       gboolean drawn = FALSE;
-            
+
       for ( ; mspItem && !found; mspItem = mspItem->next)
         {
           const MSP* const msp = (const MSP*)(mspItem->data);
-          found = selectExonIfContainsCoords(exonView, properties, bc, 
+          found = selectExonIfContainsCoords(exonView, properties, bc,
                                              bigPictureGetDisplayRange(properties->bigPicture),
                                              msp, event->x, event->y, deselectOthers, y, &drawn);
         }
@@ -285,30 +286,30 @@ void calculateExonViewHeight(GtkWidget *exonView)
 
   BigPictureProperties *bpProperties = bigPictureGetProperties(properties->bigPicture);
   const IntRange* const displayRange = &bpProperties->displayRange;
-  
+
   BlxContext *bc = blxWindowGetContext(bpProperties->blxWindow());
 
   /* Calculate the height based on how many exon lines will actually be drawn */
   int numExons = 0;
   int maxExons = properties->expanded ? UNSET_INT : 1; /* unset means no limit */
-  
+
   /* Loop through all sequences */
   GList *seqItem = bc->matchSeqs;
-  
+
   for ( ; seqItem; seqItem = seqItem->next)
     {
       /* Loop through all msps */
       const BlxSequence *seq = (BlxSequence*)(seqItem->data);
       GList *mspItem = seq->mspList;
-      
+
       for ( ; mspItem; mspItem = mspItem->next)
 	{
 	  const MSP *msp = (const MSP*)(mspItem->data);
-          
+
           if (showMspInExonView(msp, properties->currentStrand, bc))
 	    {
 	      const IntRange* const mspDisplayRange = mspGetDisplayRange(msp);
-              
+
               if (rangesOverlap(mspDisplayRange, displayRange))
 		{
 		  ++numExons;
@@ -316,23 +317,23 @@ void calculateExonViewHeight(GtkWidget *exonView)
 		}
 	    }
 	}
-      
+
       /* Break after we've found the maximum number of lines, if a max is specified */
       if (maxExons != UNSET_INT && numExons >= maxExons)
 	{
 	  break;
 	}
     }
-  
+
   const int newHeight = (numExons * (properties->exonHeight + properties->yPad)) + (2 * properties->yPad);
-  
+
   if (newHeight != properties->exonViewRect.height)
     {
       DEBUG_OUT("Setting new height = %d\n", newHeight);
       properties->exonViewRect.height = newHeight;
       gtk_widget_set_size_request(exonView, -1, properties->exonViewRect.height);
     }
-  
+
   DEBUG_EXIT("calculateExonViewHeight returning");
 }
 
@@ -341,7 +342,7 @@ void calculateExonViewHighlightBoxBorders(GtkWidget *exonView)
 {
   ExonViewProperties *properties = exonViewGetProperties(exonView);
   BlxContext *bc = bigPictureGetContext(properties->bigPicture);
-  
+
   /* Get the big picture display range in dna coords */
   IntRange bpRange;
   convertDisplayRangeToDnaRange(bigPictureGetDisplayRange(properties->bigPicture), bc->seqType, bc->numFrames, bc->displayRev, &bc->refSeqRange, &bpRange);
@@ -350,14 +351,14 @@ void calculateExonViewHighlightBoxBorders(GtkWidget *exonView)
   IntRange dvRange;
   GtkWidget *detailView = bigPictureGetDetailView(properties->bigPicture);
   convertDisplayRangeToDnaRange(detailViewGetDisplayRange(detailView), bc->seqType, bc->numFrames, bc->displayRev, &bc->refSeqRange, &dvRange);
-  
+
   /* Calculate how many pixels from the left edge of the widget to the first base in the range. */
   const int x1 = convertBaseIdxToRectPos(dvRange.min(true, bc->displayRev), &properties->exonViewRect, &bpRange, TRUE, bc->displayRev, TRUE);
   const int x2 = convertBaseIdxToRectPos(dvRange.max(true, bc->displayRev), &properties->exonViewRect, &bpRange, TRUE, bc->displayRev, TRUE);
-  
+
   properties->highlightRect.x = min(x1, x2);
   properties->highlightRect.y = 0;
-  
+
   properties->highlightRect.width = abs(x1 - x2);
   properties->highlightRect.height = exonView->allocation.height;
 }
@@ -367,11 +368,11 @@ static void calculateExonViewBorders(GtkWidget *exonView)
 {
   ExonViewProperties *properties = exonViewGetProperties(exonView);
   BigPictureProperties *bigPictureProperties = bigPictureGetProperties(properties->bigPicture);
-  
+
   /* Calculate the size of the exon view */
   properties->exonViewRect.x = roundNearest(bigPictureProperties->contentXPos());
   properties->exonViewRect.width = bigPictureProperties->contentWidth();
-  
+
   /* Calculate the size of the highlight box */
   calculateExonViewHighlightBoxBorders(exonView);
 }
@@ -382,11 +383,11 @@ static void calculateExonViewBorders(GtkWidget *exonView)
  ***********************************************************/
 
 /* Draw an exon (well, any box-shaped feature, actually) */
-static void drawExon(const MSP* const msp, 
-                     DrawData *data, 
-                     const BlxSequence *blxSeq, 
-                     const gboolean isSelected, 
-                     const gint x, 
+static void drawExon(const MSP* const msp,
+                     DrawData *data,
+                     const BlxSequence *blxSeq,
+                     const gboolean isSelected,
+                     const gint x,
                      const gint y,
                      const gint widthIn,
                      const gint height)
@@ -395,10 +396,10 @@ static void drawExon(const MSP* const msp,
   gint xStart = x;
   gint xEnd = x + widthIn;
   gint width = widthIn;
-  
+
   const gint xMin = data->exonViewRect->x;
   const gint xMax = data->exonViewRect->x + data->exonViewRect->width;
-  
+
   if (xStart <= xMax && xEnd >= xMin)
     {
       if (xStart < xMin)
@@ -417,14 +418,14 @@ static void drawExon(const MSP* const msp,
       const GdkColor *fillColor = mspGetColor(msp, data->bc->defaultColors, BLXCOLOR_BACKGROUND, blxSeq, isSelected, data->bc->usePrintColors, TRUE, BLXCOLOR_EXON_FILL, BLXCOLOR_EXON_LINE, BLXCOLOR_CDS_FILL, BLXCOLOR_CDS_LINE, BLXCOLOR_UTR_FILL, BLXCOLOR_UTR_LINE);
       gdk_gc_set_foreground(data->gc, fillColor);
       gdk_draw_rectangle(data->drawable, data->gc, TRUE, xStart, y, width, height);
-      
+
       /* Draw outline (exon box outline always the same (unselected) color; only intron lines change when selected) */
       const GdkColor *lineColor = mspGetColor(msp, data->bc->defaultColors, BLXCOLOR_BACKGROUND, blxSeq, isSelected, data->bc->usePrintColors, FALSE, BLXCOLOR_EXON_FILL, BLXCOLOR_EXON_LINE, BLXCOLOR_CDS_FILL, BLXCOLOR_CDS_LINE, BLXCOLOR_UTR_FILL, BLXCOLOR_UTR_LINE);
       gdk_gc_set_foreground(data->gc, lineColor);
       gdk_draw_rectangle(data->drawable, data->gc, FALSE, xStart, y, width, height);
     }
 }
-  
+
 
 /* Utility to actually draw the line for an intron. Clips it if necessary, maintaining the same
  * angle for the line */
@@ -433,24 +434,24 @@ static void drawIntronLine(DrawData *data, const gint x1, const gint y1, const g
   /* Only draw anything if at least part of the line is within range. We are only ever called with
    * y values that are in range so don't bother checking them. */
   const gint xMax = clipRect->x + clipRect->width;
-  
+
   if (x1 <= xMax && x2 >= clipRect->x)
     {
       int xStart = x1;
       int xEnd = x2;
       int yStart = y1;
       int yEnd = y2;
-      
+
       /* Clip the start/end x values if out of range */
       if (xStart < clipRect->x)
         {
           const int origWidth = abs(xEnd - xStart);
-        
+
           xStart = clipRect->x;
 
           const int newWidth = abs(xEnd - xStart);
           const int newHeight = roundNearest((double)(yEnd - yStart) * (double)newWidth / (double)origWidth); /* negative if yend < ystart */
-          
+
           yStart = yEnd - newHeight;
         }
 
@@ -462,23 +463,23 @@ static void drawIntronLine(DrawData *data, const gint x1, const gint y1, const g
 
           const int newWidth = abs(xEnd - xStart);
           const int newHeight = roundNearest((double)(yEnd - yStart) * (double)newWidth / (double)origWidth);
-          
+
           yEnd = yStart + newHeight;
         }
-        
+
       gdk_draw_line(data->drawable, data->gc, xStart, yStart, xEnd, yEnd);
     }
 }
 
 
 /* Draw an intron */
-static void drawIntron(const MSP* const msp, 
-                       DrawData *data, 
-                       const BlxSequence *blxSeq, 
-                       const gboolean isSelected, 
-                       const gint x, 
-                       const gint y, 
-                       const gint width, 
+static void drawIntron(const MSP* const msp,
+                       DrawData *data,
+                       const BlxSequence *blxSeq,
+                       const gboolean isSelected,
+                       const gint x,
+                       const gint y,
+                       const gint width,
                        const gint height)
 {
   const GdkColor *lineColor = mspGetColor(msp, data->bc->defaultColors, BLXCOLOR_BACKGROUND, blxSeq, isSelected, data->bc->usePrintColors, FALSE, BLXCOLOR_EXON_FILL, BLXCOLOR_EXON_LINE, BLXCOLOR_CDS_FILL, BLXCOLOR_CDS_LINE, BLXCOLOR_UTR_FILL, BLXCOLOR_UTR_LINE);
@@ -486,7 +487,7 @@ static void drawIntron(const MSP* const msp,
 
   int yTop = y;
   int yBottom = y + roundNearest((double)height / 2.0);
-  
+
   /* Draw the first section, from the given x to the mid point, sloping up */
   int xStart = x;
   int xEnd = x + roundNearest((double)width / 2.0);
@@ -500,14 +501,14 @@ static void drawIntron(const MSP* const msp,
 
 
 /* Draw the given exon/intron, if it is in range. Returns true if it was drawn */
-static gboolean drawExonIntron(const MSP *msp, 
+static gboolean drawExonIntron(const MSP *msp,
                                DrawData *data,
                                const gboolean isSelected,
                                const BlxSequence *blxSeq)
 {
   int x = UNSET_INT, width = UNSET_INT;
-  
-  gboolean drawn = calculateExonIntronDimensions(msp, data->bc, data->displayRange, 
+
+  gboolean drawn = calculateExonIntronDimensions(msp, data->bc, data->displayRange,
                                                  data->exonViewRect, &x, &width);
 
   if (drawn)
@@ -521,7 +522,7 @@ static gboolean drawExonIntron(const MSP *msp,
 	  drawIntron(msp, data, blxSeq, isSelected, x, data->y, width, data->height);
 	}
     }
-  
+
   return drawn;
 }
 
@@ -536,23 +537,23 @@ static void drawExonIntronItem(gpointer listItemData, gpointer data)
   const gboolean isSelected = blxWindowIsSeqSelected(drawData->blxWindow, seq);
   SequenceGroup *group = drawData->bc->getFirstSequenceGroup(seq);
   gboolean seqDrawn = FALSE;
-  
+
   if (!drawData->normalOnly || (!isSelected && !group))
     {
       /* Loop through all msps in this sequence */
       GList *mspListItem = seq->mspList;
-  
+
       for ( ; mspListItem; mspListItem = mspListItem->next)
 	{
 	  MSP *msp = (MSP*)(mspListItem->data);
-      
+
           if (showMspInExonView(msp, drawData->strand, drawData->bc))
 	    {
 	      seqDrawn |= drawExonIntron(msp, drawData, isSelected, seq);
 	    }
 	}
     }
-  
+
   /* If the view is expanded, increase the y-coord for the next sequence */
   if (seqDrawn && drawData->expanded)
     {
@@ -566,7 +567,7 @@ static void drawExonView(GtkWidget *exonView, GdkDrawable *drawable)
 {
   GtkWidget *blxWindow = exonViewGetBlxWindow(exonView);
   BlxContext *bc = blxWindowGetContext(blxWindow);
-  
+
   ExonViewProperties *properties = exonViewGetProperties(exonView);
   const IntRange* const displayRange = bigPictureGetDisplayRange(properties->bigPicture);
 
@@ -574,20 +575,20 @@ static void drawExonView(GtkWidget *exonView, GdkDrawable *drawable)
   /* Get the display range in dna coords */
   IntRange bpRange;
   convertDisplayRangeToDnaRange(displayRange, bc->seqType, bc->numFrames, bc->displayRev, &bc->refSeqRange, &bpRange);
-  
+
   GdkColor *gapColor = getGdkColor(BLXCOLOR_ASSEMBLY_GAP, bc->defaultColors, FALSE, bc->usePrintColors);
   drawAssemblyGaps(exonView, drawable, gapColor, bc->displayRev, &properties->exonViewRect, &bpRange, bc->featureLists[BLXMSP_GAP]);
-  
+
   /* Set a clip rectangle for drawing the exons and introns (because they are drawn "over the
    * edges" to make sure intron lines have the correct slope etc.) */
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   gdk_gc_set_clip_origin(gc, 0, 0);
   gdk_gc_set_clip_rectangle(gc, &properties->exonViewRect);
-  
+
   /* Draw the exons and introns. Since we could have a lot of them in the loop, extract all the
    * info we need now and pass it around so we don't have to look for this stuff each time. */
-  
+
   DrawData drawData = {
     drawable,
     gc,
@@ -606,13 +607,13 @@ static void drawExonView(GtkWidget *exonView, GdkDrawable *drawable)
     properties->exonViewRect.y,
     properties->exonHeight
   };
-  
+
   /* If the view is compressed (i.e. exons will overlap each other), then
    * only draw "normal" MSPs the first time round, and draw grouped/selected
-   * MSPs afterwards, so that they appear on top. If the view is expanded, 
+   * MSPs afterwards, so that they appear on top. If the view is expanded,
    * we can draw them all in a single loop, because they will not overlap. */
   drawData.normalOnly = !properties->expanded;
-  
+
   /* Loop through all sequences, drawing all msps that are exons/introns */
   GList *seqList = blxWindowGetAllMatchSeqs(blxWindow);
   g_list_foreach(seqList, drawExonIntronItem, &drawData);
@@ -620,10 +621,10 @@ static void drawExonView(GtkWidget *exonView, GdkDrawable *drawable)
   if (!properties->expanded)
     {
       drawData.normalOnly = FALSE;
-  
+
       /* Draw all selected msps */
       g_list_foreach(bc->selectedSeqs, drawExonIntronItem, &drawData);
-      
+
       /* Increment the y value when finished, because we calculate the view height based on this */
       drawData.y += drawData.height + drawData.yPad;
     }
@@ -631,7 +632,7 @@ static void drawExonView(GtkWidget *exonView, GdkDrawable *drawable)
   /* Set the height based on the height of the exons that were actually drawn */
   const int newHeight = drawData.y - properties->exonViewRect.y + drawData.yPad;
   gtk_layout_set_size(GTK_LAYOUT(exonView), exonView->allocation.width, newHeight);
-  
+
   g_object_unref(gc);
 }
 
@@ -641,12 +642,12 @@ static void drawExonView(GtkWidget *exonView, GdkDrawable *drawable)
 void exonViewPrepareForPrinting(GtkWidget *exonView)
 {
   GdkDrawable *drawable = widgetGetDrawable(exonView);
-  
+
   if (drawable)
     {
       ExonViewProperties *properties = exonViewGetProperties(exonView);
       BlxContext *bc = bigPictureGetContext(properties->bigPicture);
-      
+
       GdkColor *highlightBoxColor = getGdkColor(BLXCOLOR_HIGHLIGHT_BOX, bc->defaultColors, FALSE, bc->usePrintColors);
       drawHighlightBox(drawable, &properties->highlightRect, HIGHLIGHT_BOX_MIN_WIDTH, highlightBoxColor);
     }
@@ -674,28 +675,28 @@ static void onDestroyExonView(GtkWidget *exonView)
     }
 }
 
-static void exonViewCreateProperties(GtkWidget *exonView, 
-				     GtkWidget *bigPicture, 
+static void exonViewCreateProperties(GtkWidget *exonView,
+				     GtkWidget *bigPicture,
 				     const BlxStrand currentStrand)
 {
   if (exonView)
     {
       ExonViewProperties *properties = new ExonViewProperties;
-      
+
       properties->widget              = exonView;
       properties->bigPicture	      = bigPicture;
       properties->currentStrand	      = currentStrand;
-      
+
       properties->expanded	      = FALSE;
       properties->yPad		      =	DEFAULT_EXON_YPAD;
-      
+
       properties->exonViewRect.x      = 0;
       properties->exonViewRect.y      = DEFAULT_EXON_YPAD;
       properties->exonViewRect.width  = 0;
       properties->exonViewRect.height = DEFAULT_EXON_HEIGHT;
 
       properties->exonHeight          = DEFAULT_EXON_HEIGHT;
-      
+
       gtk_widget_set_size_request(exonView, 0, DEFAULT_EXON_HEIGHT + (2 * DEFAULT_EXON_YPAD));
 
       g_object_set_data(G_OBJECT(exonView), "ExonViewProperties", properties);
@@ -732,12 +733,12 @@ void exonViewSetExpanded(GtkWidget *exonView, const gboolean expanded)
       properties->yPad = DEFAULT_EXON_YPAD_BUMPED;
       properties->exonHeight = DEFAULT_EXON_HEIGHT_BUMPED;
     }
-  else 
+  else
     {
       properties->yPad = DEFAULT_EXON_YPAD;
       properties->exonHeight = DEFAULT_EXON_HEIGHT;
     }
-  
+
   calculateExonViewHeight(exonView);
   forceResize(properties->bigPicture);
   bigPictureRedrawAll(properties->bigPicture);
@@ -759,35 +760,35 @@ void exonViewToggleExpanded(GtkWidget *exonView)
 static gboolean onExposeExonView(GtkWidget *exonView, GdkEventExpose *event, gpointer data)
 {
   GdkDrawable *drawable = widgetGetDrawable(exonView);
-  
+
   if (!drawable)
     {
       /* Create a pixmap and draw the exon view onto it */
       drawable = createBlankPixmap(exonView);
       drawExonView(exonView, drawable);
     }
-  
+
   if (drawable)
-    {  
+    {
       /* Push the pixmap onto the screen */
       GdkDrawable *window = GTK_LAYOUT(exonView)->bin_window;
-      
+
       GdkGC *gc = gdk_gc_new(window);
       gdk_draw_drawable(window, gc, drawable, 0, 0, 0, 0, -1, -1);
       g_object_unref(gc);
-      
+
       /* Draw the highlight box on top of it */
       ExonViewProperties *properties = exonViewGetProperties(exonView);
       BigPictureProperties *bpProperties = bigPictureGetProperties(properties->bigPicture);
       BlxContext *bc = blxWindowGetContext(bpProperties->blxWindow());
-      
+
       GdkColor *highlightBoxColor = getGdkColor(BLXCOLOR_HIGHLIGHT_BOX, bc->defaultColors, FALSE, bc->usePrintColors);
       drawHighlightBox(window, &properties->highlightRect, HIGHLIGHT_BOX_MIN_WIDTH, highlightBoxColor);
 
       /* Draw the preview box too, if it is set */
       bpProperties->drawPreviewBox(window, &properties->exonViewRect, &properties->highlightRect);
     }
-  
+
   return TRUE;
 }
 
@@ -796,7 +797,7 @@ static void onSizeAllocateExonView(GtkWidget *exonView, GtkAllocation *allocatio
   DEBUG_ENTER("onSizeAllocateExonView");
 
   calculateExonViewBorders(exonView);
-  
+
   DEBUG_EXIT("onSizeAllocateExonView returning");
 }
 
@@ -813,25 +814,25 @@ static gboolean onButtonPressExonView(GtkWidget *exonView, GdkEventButton *event
 
       handled = selectClickedExon(exonView, event, ctrlModifier, shiftModifier);
     }
-  
+
   ExonViewProperties *properties = exonViewGetProperties(exonView);
 
   if (event->button == 2 ||
-      (event->button == 1 && !handled && 
-       (event->type == GDK_2BUTTON_PRESS || 
+      (event->button == 1 && !handled &&
+       (event->type == GDK_2BUTTON_PRESS ||
         clickedInRect(event, &properties->highlightRect, HIGHLIGHT_BOX_MIN_WIDTH))))
     {
       /* Draw the preview box (draw it on the other big picture components as well) */
       int x = event->x;
-      
+
       if (event->button == 1 && event->type == GDK_BUTTON_PRESS)
         x = properties->highlightRect.x + properties->highlightRect.width / 2;
-      
+
       BigPictureProperties *bpProperties = bigPictureGetProperties(properties->bigPicture);
       bpProperties->startPreviewBox(event->x, TRUE, x - event->x);
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -844,7 +845,7 @@ static gboolean onButtonReleaseExonView(GtkWidget *exonView, GdkEventButton *eve
       BigPictureProperties *bpProperties = bigPictureGetProperties(properties->bigPicture);
       bpProperties->finishPreviewBox(event->x, &properties->exonViewRect, &properties->highlightRect);
     }
-  
+
   return TRUE;
 }
 
@@ -858,7 +859,7 @@ static gboolean onMouseMoveExonView(GtkWidget *exonView, GdkEventMotion *event,
       BigPictureProperties *bpProperties = bigPictureGetProperties(properties->bigPicture);
       bpProperties->startPreviewBox(event->x, FALSE, 0);
     }
-  
+
   return TRUE;
 }
 
@@ -869,7 +870,7 @@ static gboolean onMouseMoveExonView(GtkWidget *exonView, GdkEventMotion *event,
 static gboolean onScrollExonView(GtkWidget *exonView, GdkEventScroll *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   switch (event->direction)
     {
       case GDK_SCROLL_LEFT:
@@ -878,7 +879,7 @@ static gboolean onScrollExonView(GtkWidget *exonView, GdkEventScroll *event, gpo
 	  handled = TRUE;
 	  break;
 	}
-	
+
       case GDK_SCROLL_RIGHT:
 	{
           scrollBigPictureRightStep(exonViewGetBigPicture(exonView));
@@ -892,7 +893,7 @@ static gboolean onScrollExonView(GtkWidget *exonView, GdkEventScroll *event, gpo
 	  break;
 	}
     };
-  
+
   return handled;
 }
 
@@ -912,7 +913,7 @@ GtkWidget *createExonView(GtkWidget *bigPicture, const BlxStrand currentStrand)
   gtk_widget_add_events(exonView, GDK_BUTTON_PRESS_MASK);
   gtk_widget_add_events(exonView, GDK_BUTTON_RELEASE_MASK);
   gtk_widget_add_events(exonView, GDK_POINTER_MOTION_MASK);
-  
+
   g_signal_connect(G_OBJECT(exonView),	"expose-event",		G_CALLBACK(onExposeExonView),	      NULL);
   g_signal_connect(G_OBJECT(exonView),	"size-allocate",	G_CALLBACK(onSizeAllocateExonView),   NULL);
   g_signal_connect(G_OBJECT(exonView),	"button-press-event",   G_CALLBACK(onButtonPressExonView),    NULL);
diff --git a/src/blixemApp/exonview.hpp b/src/blixemApp/exonview.hpp
index ddab944991e05e12baeadb2250e5b09714e63753..33d7bc03683df216a675b9f5ae48d0b3a8da0fcb 100644
--- a/src/blixemApp/exonview.hpp
+++ b/src/blixemApp/exonview.hpp
@@ -1,5 +1,6 @@
 /*  File: exonview.h
  *  Author: Gemma Barson, 2009-12-24
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -30,7 +31,7 @@
  *
  * Description: A section of the big picture showing exons, introns and basic
  *              (box-shaped) features for a particular strand of the reference
- *              sequence. The naming is all based around exons but has been 
+ *              sequence. The naming is all based around exons but has been
  *              expanded to draw any box-shape feature.
  *
  *              Pending: It would be good to consolidate the Blixem and Dotter
diff --git a/src/blixemApp/sequencecellrenderer.cpp b/src/blixemApp/sequencecellrenderer.cpp
index 6e1a10c45c323a70d3a764875cc22d9689d9afb7..2de7d3e509de15bccec8c0e62b83be9a6b332b11 100644
--- a/src/blixemApp/sequencecellrenderer.cpp
+++ b/src/blixemApp/sequencecellrenderer.cpp
@@ -1,5 +1,6 @@
 /*  File: sequencecellrenderer.c
  *  Author: Gemma Barson, 2009-10-15
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -104,10 +105,10 @@ typedef struct _RenderData
 
 
 /* Properties */
-enum 
+enum
 {
   PROP_0,
-  
+
   PROP_TEXT,
   PROP_MSP,
   PROP_DATA
@@ -123,15 +124,15 @@ static gboolean mspGetVisibleRange(MSP *msp, RenderData *data, IntRange *result)
 void		drawAllVisibleExonBoundaries(GtkWidget *tree, RenderData *data);
 
 static void mspDrawSequenceText(GtkWidget *tree,
-                                gchar *displayText, 
+                                gchar *displayText,
                                 const IntRange* const segmentRange,
                                 RenderData *data);
 
 
-static void segmentGetCoordsForBaseIdx(const int segmentIdx, 
+static void segmentGetCoordsForBaseIdx(const int segmentIdx,
                                        const IntRange* const segmentRange,
                                        RenderData *data,
-                                       int *x, 
+                                       int *x,
                                        int* y);
 
 
@@ -180,7 +181,7 @@ static void paintLayout2(GtkStyle *style,
 {
   if (drawable1)
     gtk_paint_layout (style, drawable1, state_type, use_text, area, widget, detail, x, y, layout);
-  
+
   if (drawable2)
     gtk_paint_layout (style, drawable2, state_type, use_text, area, widget, detail, x, y, layout);
 }
@@ -200,20 +201,20 @@ void drawLine2(GdkDrawable *drawable1,
 //      cairo_set_line_width(cr, 0.5);
 //      cairo_move_to(cr, x1 + 0.5, y1);
 //      cairo_line_to(cr, x2 + 0.5, y2);
-//      cairo_stroke(cr); 
+//      cairo_stroke(cr);
 //      cairo_destroy(cr);
       gdk_draw_line(drawable1, gc, x1, y1, x2, y2);
     }
-  
+
   if (drawable2)
     {
 //      cairo_t *cr = gdk_cairo_create(drawable2);
 //      cairo_set_line_width(cr, 0.5);
 //      cairo_move_to(cr, x1 + 0.5, y1);
 //      cairo_line_to(cr, x2 + 0.5, y2);
-//      cairo_stroke(cr); 
+//      cairo_stroke(cr);
 //      cairo_destroy(cr);
-      
+
       gdk_draw_line(drawable2, gc, x1, y1, x2, y2);
     }
 }
@@ -232,12 +233,12 @@ void drawRectangle2(GdkDrawable *drawable1,
 //  cairo_rectangle(cr, x, y, width, height);
 //  cairo_fill(cr);
 //  cairo_destroy(cr);
-  
+
   if (drawable1)
     {
       gdk_draw_rectangle(drawable1, gc, filled, x, y, width, height);
     }
-  
+
   if (drawable2)
     {
       gdk_draw_rectangle(drawable2, gc, filled, x, y, width, height);
@@ -274,7 +275,7 @@ GType
 sequence_cell_renderer_get_type (void)
 {
   static GType cell_sequence_type = 0;
-  
+
   if (cell_sequence_type == 0)
     {
       static const GTypeInfo cell_sequence_info =
@@ -289,14 +290,14 @@ sequence_cell_renderer_get_type (void)
 	0,                                                        /* n_preallocs */
 	(GInstanceInitFunc) sequence_cell_renderer_init,
       };
-      
+
       /* Derive from GtkCellRenderer */
       cell_sequence_type = g_type_register_static (GTK_TYPE_CELL_RENDERER,
 						   "SequenceCellRenderer",
 						   &cell_sequence_info,
                                                    (GTypeFlags)0);
     }
-  
+
   return cell_sequence_type;
 }
 
@@ -338,7 +339,7 @@ sequence_cell_renderer_class_init (SequenceCellRendererClass *klass)
 {
   GtkCellRendererClass *cell_class   = GTK_CELL_RENDERER_CLASS(klass);
   GObjectClass         *object_class = G_OBJECT_CLASS(klass);
-  
+
   parent_class           = g_type_class_peek_parent (klass);
   object_class->finalize = sequence_cell_renderer_finalize;
 
@@ -346,11 +347,11 @@ sequence_cell_renderer_class_init (SequenceCellRendererClass *klass)
    *   of a cell renderer in the parent class */
   cell_class->get_size = sequence_cell_renderer_get_size;
   cell_class->render   = sequence_cell_renderer_render;
-  
+
   /* Override functions to get/set properties */
   object_class->get_property = sequence_cell_renderer_get_property;
   object_class->set_property = sequence_cell_renderer_set_property;
-  
+
   g_object_class_install_property (object_class,
                                    PROP_DATA,
                                    g_param_spec_pointer (RENDERER_DATA_PROPERTY,
@@ -387,9 +388,9 @@ sequence_cell_renderer_finalize (GObject *object)
   /*
    SequenceCellRenderer *cellrenderersequence = SEQUENCE_CELL_RENDERER(object);
    */
-  
+
   /* Free any dynamically allocated resources here */
-  
+
   (* G_OBJECT_CLASS (parent_class)->finalize) (object);
 }
 
@@ -409,7 +410,7 @@ sequence_cell_renderer_new (void)
 
 /***************************************************************************
  *
- *  sequence_cell_renderer_set_property: 
+ *  sequence_cell_renderer_set_property:
  *
  ***************************************************************************/
 
@@ -429,14 +430,14 @@ sequence_cell_renderer_set_property (GObject      *object,
 				     GParamSpec   *pspec)
 {
   SequenceCellRenderer *renderer = SEQUENCE_CELL_RENDERER(object);
-  
+
   switch (param_id)
   {
     case PROP_DATA:
       /* Additional data. DON'T reset other properties. */
       renderer->data = (GList*)g_value_get_pointer(value);
       break;
-      
+
     case PROP_MSP:
       /* We set either the msp data or the text data, not both;
        * so make sure nothing else is set */
@@ -450,7 +451,7 @@ sequence_cell_renderer_set_property (GObject      *object,
       setAllPropertiesNull(renderer);
       renderer->text = g_strdup(g_value_get_string(value));
       break;
-      
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
       break;
@@ -460,7 +461,7 @@ sequence_cell_renderer_set_property (GObject      *object,
 
 /***************************************************************************
  *
- *  sequence_cell_renderer_get_property: 
+ *  sequence_cell_renderer_get_property:
  *
  ***************************************************************************/
 
@@ -480,7 +481,7 @@ sequence_cell_renderer_get_property (GObject      *object,
     case PROP_MSP:
       g_value_set_pointer(value, renderer->mspGList);
       break;
-      
+
     case PROP_TEXT:
       g_value_set_string(value, renderer->text);
       break;
@@ -503,20 +504,20 @@ get_size (GtkCellRenderer *cell,
 {
   if (height)
     *height = cell->height;
-  
+
   if (width)
     *width = cell->width;
-  
+
   if (cell_area)
     cell_area->height = cell->height;
 }
 
 
 /* Render function for a cell that contains simple text */
-static void rendererDrawSimpleText(SequenceCellRenderer *renderer, 
+static void rendererDrawSimpleText(SequenceCellRenderer *renderer,
                                    GtkWidget *tree,
-                                   GdkWindow *window, 
-                                   GtkStateType state, 
+                                   GdkWindow *window,
+                                   GtkStateType state,
                                    GdkRectangle *cell_area)
 {
   gchar *displayText = renderer->text;
@@ -533,11 +534,11 @@ static void rendererDrawSimpleText(SequenceCellRenderer *renderer,
 	       TRUE,
 	       NULL,
 	       tree,
-	       NULL, 
+	       NULL,
 	       cell_area->x - treeGetCellXPadding(tree),
 	       cell_area->y - treeGetCellYPadding(tree),
 	       layout);
-  
+
   g_object_unref(layout);
 }
 
@@ -552,7 +553,7 @@ static void highlightSelectedBase(const int selectedBaseIdx,
     {
       /* Convert the display-range index to a 0-based index for the section of sequence displayed */
       const int segmentIdx = selectedBaseIdx - data->displayRange->min();
-      
+
       int x, y;
       segmentGetCoordsForBaseIdx(segmentIdx, data->displayRange, data, &x, &y);
 
@@ -567,19 +568,19 @@ static void highlightSelectedBase(const int selectedBaseIdx,
  * base 3 (if end)... or vice versa if the display is reversed */
 static gboolean exonCoordIsPartialCodon(const MSP* const msp, const gboolean start, RenderData *data, int *displayIdxOut)
 {
-  /* To be a complete codon, if we're at the start the the coord must be base 1 
+  /* To be a complete codon, if we're at the start the the coord must be base 1
    * or if we're at the end then coord must be base 3 */
   const int reqdBase = (start != data->bc->displayRev) ? 1 : data->bc->numFrames;
-  
+
   /* Calculate the actual base number of the start/end coord */
   const int dnaIdx = start ? msp->qRange.min() : msp->qRange.max();
-  
+
   int baseNum = UNSET_INT;
   const int frame = mspGetRefFrame(msp, data->bc->seqType);
-  
-  const int displayIdx = convertDnaIdxToDisplayIdx(dnaIdx, data->bc->seqType, frame, 
+
+  const int displayIdx = convertDnaIdxToDisplayIdx(dnaIdx, data->bc->seqType, frame,
     data->bc->numFrames, data->bc->displayRev, &data->bc->refSeqRange, &baseNum);
-  
+
   if (displayIdxOut)
     *displayIdxOut = displayIdx;
 
@@ -591,7 +592,7 @@ static gboolean exonCoordIsPartialCodon(const MSP* const msp, const gboolean sta
 static gboolean coordIsSelected(RenderData *data, const int coord)
 {
   gboolean result = FALSE;
-  
+
   gboolean coordSelected = FALSE;
 
   if (data->selectionRange && valueWithinRange(coord, data->selectionRange))
@@ -600,7 +601,7 @@ static gboolean coordIsSelected(RenderData *data, const int coord)
   if (data->selectionRange && data->selectionRange->length() > 1)
     {
       /* There is a range of selected coords. We highlight the base if it's in this range.
-       * We only highlight selection-range coords for the currently selected sequence(s), unless 
+       * We only highlight selection-range coords for the currently selected sequence(s), unless
        * there are no selected sequences, in which case highlight all rows. */
       if (data->seqSelected || !data->selectedSeqs || g_list_length(data->selectedSeqs) < 1)
         result = coordSelected;
@@ -622,16 +623,16 @@ static gboolean coordIsSelected(RenderData *data, const int coord)
 /* Highlight the start (min) peptide of the given msp if it is a partial codon, i.e. if it
  * does not start at base 1 (or end at base 3, if the display is reversed). OR highlight the end
  * (max) codon if 'start' is FALSE. The x/y coords give the top left corner of the peptide. */
-static void exonHighlightPartialCodons(const MSP* const msp, 
-                                       const gboolean start, 
-                                       const int x, 
-                                       const int y, 
+static void exonHighlightPartialCodons(const MSP* const msp,
+                                       const gboolean start,
+                                       const int x,
+                                       const int y,
                                        RenderData *data)
 {
   int displayIdx = UNSET_INT;
   gboolean isPartial = exonCoordIsPartialCodon(msp, start, data, &displayIdx);
-  
-  if (isPartial && valueWithinRange(displayIdx, data->displayRange)) 
+
+  if (isPartial && valueWithinRange(displayIdx, data->displayRange))
     {
       /* It's not a complete codon, so highlight this base */
       const gboolean isSelected = coordIsSelected(data, displayIdx);
@@ -655,7 +656,7 @@ static void drawBoxFeature(SequenceCellRenderer *renderer,
   if (mspLayerIsVisible(msp))
     {
       IntRange segmentRange;
-      
+
       if (!mspGetVisibleRange(msp, data, &segmentRange))
         {
           return;
@@ -672,12 +673,12 @@ static void drawBoxFeature(SequenceCellRenderer *renderer,
        * is selected, but note we don't highlight the whole row if a coord range is also selected. */
       gboolean fill = TRUE;
       const gboolean highlightExon = data->seqSelected && (!data->selectionRange || data->selectionRange->length() < 2);
-      const GdkColor *color = mspGetColor(msp, 
-                                          data->bc->defaultColors, 
-                                          BLXCOLOR_BACKGROUND, 
-                                          msp->sSequence, 
-                                          highlightExon, 
-                                          data->bc->usePrintColors, 
+      const GdkColor *color = mspGetColor(msp,
+                                          data->bc->defaultColors,
+                                          BLXCOLOR_BACKGROUND,
+                                          msp->sSequence,
+                                          highlightExon,
+                                          data->bc->usePrintColors,
                                           fill,
                                           BLXCOLOR_EXON_FILL, BLXCOLOR_EXON_LINE,
                                           BLXCOLOR_CDS_FILL, BLXCOLOR_CDS_LINE,
@@ -686,7 +687,7 @@ static void drawBoxFeature(SequenceCellRenderer *renderer,
 
       gdk_gc_set_foreground(data->gc, color);
       drawRectangle2(data->window, data->drawable, data->gc, fill, x, y, width, height);
-      
+
       /* If a base is selected, highlight it. Its color depends on whether it the base is within the exon range or not. */
       if (data->selectionRange)
         {
@@ -709,12 +710,12 @@ static void drawBoxFeature(SequenceCellRenderer *renderer,
       color = mspGetColor(msp, data->bc->defaultColors, BLXCOLOR_BACKGROUND, msp->sSequence, data->seqSelected, data->bc->usePrintColors, fill, BLXCOLOR_EXON_FILL, BLXCOLOR_EXON_LINE, BLXCOLOR_CDS_FILL, BLXCOLOR_CDS_LINE, BLXCOLOR_UTR_FILL, BLXCOLOR_UTR_LINE);
       gdk_gc_set_foreground(data->gc, color);
       drawRectangle2(data->window, data->drawable, data->gc, fill, x, y, width, height);
-      
+
       /* If the start or end index is not a full codon, highlight it in a different color */
       exonHighlightPartialCodons(msp, !data->bc->displayRev, x, y, data);
       exonHighlightPartialCodons(msp, data->bc->displayRev, x + width - data->charWidth, y, data);
     }
-} 
+}
 
 
 /* Get the base from the given sequence at the given index. Converts to
@@ -724,9 +725,9 @@ static void drawBoxFeature(SequenceCellRenderer *renderer,
 static char blxSeqGetMatchSeqBase(BlxSequence *blxSeq, const int sIdx, const BlxSeqType seqType)
 {
   char result = SEQUENCE_CHAR_PAD;
-  
+
   const char *sequence = blxSequenceGetSequence(blxSeq);
-  
+
   if (sequence && sIdx <= (int)strlen(sequence))
     {
       result = sequence[sIdx - 1];
@@ -739,12 +740,12 @@ static char blxSeqGetMatchSeqBase(BlxSequence *blxSeq, const int sIdx, const Blx
 
 /* Color in the background of a particular base in the given match sequence. Returns
  * the calculated index into the match sequence (for effiency, so that we don't have to
- * recalculate it later on). Returns the equivalent index in the subject sequence, or 
+ * recalculate it later on). Returns the equivalent index in the subject sequence, or
  * UNSET_INT if there is none. */
 static void mspDrawBaseBg(MSP *msp,
-                          const int segmentIdx, 
+                          const int segmentIdx,
                           const IntRange* const segmentRange,
-                          char *refSeqSegment, 
+                          char *refSeqSegment,
                           RenderData *data,
                           const int x,
                           const int y,
@@ -754,14 +755,14 @@ static void mspDrawBaseBg(MSP *msp,
 {
   char sBase = '\0';
   GdkColor *baseBgColor = NULL;
-  
+
   /* From the segment index, find the display index and the ref seq coord */
   const int displayIdx = segmentRange->min() + segmentIdx;
   *qIdx = convertDisplayIdxToDnaIdx(displayIdx, data->bc->seqType, data->qFrame, 1, data->bc->numFrames, data->bc->displayRev, &data->bc->refSeqRange);
-  
+
   /* Find the match-sequence coord at this ref-seq coord */
   gboolean found_sIdx = mspGetMatchCoord(msp, *qIdx, data->seqSelected, data->numUnalignedBases, data->bc, sIdx);
-  
+
   /* Highlight the base if its base index is selected, or if its sequence is selected.
    * (If it is selected in both, show it in the normal color) */
   gboolean selected = coordIsSelected(data, displayIdx);
@@ -769,13 +770,13 @@ static void mspDrawBaseBg(MSP *msp,
   if (!valueWithinRange(*qIdx, &msp->qRange))
     {
       /* We're outside the alignment range. There might still be a base to display if
-       * we're displaying unaligned parts of the match sequence or polyA tails; otherwise, we 
+       * we're displaying unaligned parts of the match sequence or polyA tails; otherwise, we
        * show nothing. */
       if (found_sIdx)
 	{
           sBase = blxSeqGetMatchSeqBase(msp->sSequence, *sIdx, data->bc->seqType);
 
-          if (data->bc->flags[BLXFLAG_SHOW_POLYA_SITE] && 
+          if (data->bc->flags[BLXFLAG_SHOW_POLYA_SITE] &&
               (!data->bc->flags[BLXFLAG_SHOW_POLYA_SITE_SELECTED] || data->seqSelected) &&
               mspCoordInPolyATail(*qIdx, msp))
             {
@@ -803,7 +804,7 @@ static void mspDrawBaseBg(MSP *msp,
 	{
 	  /* Match */
 	  baseBgColor = selected ? data->matchColorSelected : data->matchColor;
-	  
+
 	  /* If we're highlighting differences, don't show this base (show a dash instead) */
 	  if (data->highlightDiffs)
 	    {
@@ -828,7 +829,7 @@ static void mspDrawBaseBg(MSP *msp,
       gdk_gc_set_foreground(data->gc, baseBgColor);
       drawRectangle2(data->window, data->drawable, data->gc, TRUE, x, y, ceil(data->charWidth), roundNearest(data->charHeight));
     }
-  
+
   if (sBase != '\0')
     {
       /* Add this character into the display text */
@@ -850,17 +851,17 @@ static PangoLayout* pangoGetLayoutFromText(gchar *displayText, GtkWidget *tree,
 
 
 /* Return the x/y coords for the top-left corner where we want to draw the base
- * with the given index in the segment, where the segment starts at the given 
+ * with the given index in the segment, where the segment starts at the given
  * index in the display. */
-static void segmentGetCoordsForBaseIdx(const int segmentIdx, 
+static void segmentGetCoordsForBaseIdx(const int segmentIdx,
                                        const IntRange* const segmentRange,
                                        RenderData *data,
-                                       int *x, 
+                                       int *x,
                                        int* y)
 {
   /* Find the start of the segment with respect to the display range */
   const int startPos = segmentRange->min() - data->displayRange->min();
-  
+
   /* Find the position of the character within the segment */
   int charIdx = startPos + segmentIdx;
 
@@ -878,13 +879,13 @@ static gboolean exonDrawBoundary(const MSP *msp, RenderData *rd)
     {
       /* Get the msp's start/end in terms of the display coords */
       const IntRange* const mspRange = mspGetDisplayRange(msp);
-      
+
       if (valueWithinRange(mspRange->min(), rd->displayRange))
 	{
 	  /* Draw the lower index. The color and line style depend on whether it's the start or end index. */
 	  GdkColor *color = rd->bc->displayRev ? rd->exonBoundaryColorEnd : rd->exonBoundaryColorStart;
 	  gdk_gc_set_foreground(rd->gc, color);
-	  
+
           /* Check if it's the boundary of a partial codon - we'll draw a dotted
            * line if it is, to indicate that the boundary is not exactly at this position. */
           const gboolean isPartial = exonCoordIsPartialCodon(msp, !rd->bc->displayRev, rd, NULL);
@@ -892,25 +893,25 @@ static gboolean exonDrawBoundary(const MSP *msp, RenderData *rd)
           gdk_gc_set_line_attributes(rd->gc, rd->exonBoundaryWidth, lineStyle, GDK_CAP_BUTT, GDK_JOIN_MITER);
 
           const int idx = mspRange->min() - rd->displayRange->min();
-          
+
 	  int x = UNSET_INT, y = UNSET_INT;
 	  segmentGetCoordsForBaseIdx(idx, rd->displayRange, rd, &x, &y);
-          
+
           drawLine2(rd->window, rd->drawable, rd->gc, x, y, x, y + roundNearest(rd->charHeight));
 	}
-      
+
       if (valueWithinRange(mspRange->max(), rd->displayRange))
 	{
 	  /* Draw the upper index. The color and line style depend on whether it's the start or end index. */
 	  GdkColor *color = rd->bc->displayRev ? rd->exonBoundaryColorStart : rd->exonBoundaryColorEnd;
 	  gdk_gc_set_foreground(rd->gc, color);
-	  
+
           /* Check if it's the boundary of a partial codon - we'll draw a dotted
            * line if it is, to indicate that the boundary is not exactly at this position. */
           const gboolean isPartial = exonCoordIsPartialCodon(msp, rd->bc->displayRev, rd, NULL);
 	  GdkLineStyle lineStyle = isPartial ? rd->exonBoundaryStylePartial : rd->exonBoundaryStyle;
           gdk_gc_set_line_attributes(rd->gc, rd->exonBoundaryWidth, lineStyle, GDK_CAP_BUTT, GDK_JOIN_MITER);
-	  
+
 	  const int idx = mspRange->max() + 1 - rd->displayRange->min();
 
 	  int x = UNSET_INT, y = UNSET_INT;
@@ -919,7 +920,7 @@ static gboolean exonDrawBoundary(const MSP *msp, RenderData *rd)
           drawLine2(rd->window, rd->drawable, rd->gc, x, y, x, y + roundNearest(rd->charHeight));
 	}
     }
-  
+
   return FALSE;
 }
 
@@ -942,19 +943,19 @@ void drawAllVisibleExonBoundaries(GtkWidget *tree, RenderData *data)
 
 
 /* Draw a vertical yellow line to indicate an insertion between two bases in the match sequence */
-static void mspDrawInsertionMarker(int sIdx, 
-                                   int lastFoundSIdx, 
-                                   int qIdx, 
-                                   int lastFoundQIdx, 
-                                   int x, 
-                                   int y, 
+static void mspDrawInsertionMarker(int sIdx,
+                                   int lastFoundSIdx,
+                                   int qIdx,
+                                   int lastFoundQIdx,
+                                   int x,
+                                   int y,
                                    RenderData *data)
 {
   if (sIdx != UNSET_INT && lastFoundSIdx != UNSET_INT && abs(sIdx - lastFoundSIdx) > 1)
     {
       /* There is a gap between this index and the previous one (in a left-to-right sense),
        * so draw an insertion marker between these two bases (at the position given by x and y). */
-      
+
       /* This is not very sophisticated - just uses a fudge factor to find a suitable width and
        * draws it half over the current base and half over the previous one. */
       int gapWidth = roundNearest(data->charWidth * GAP_WIDTH_AS_FRACTION);
@@ -973,7 +974,7 @@ static void mspDrawInsertionMarker(int sIdx,
 
 /* Draw the given sequence text at the given coords */
 static void mspDrawSequenceText(GtkWidget *tree,
-                                gchar *displayText, 
+                                gchar *displayText,
                                 const IntRange* const segmentRange,
                                 RenderData *data)
 {
@@ -983,7 +984,7 @@ static void mspDrawSequenceText(GtkWidget *tree,
        * was constructed such that everything else will line up from here. */
       int x, y;
       segmentGetCoordsForBaseIdx(0, segmentRange, data, &x, &y);
-      
+
       PangoFontDescription *font_desc = pango_font_description_copy(tree->style->font_desc);
       PangoLayout *layout = pangoGetLayoutFromText(displayText, tree, font_desc);
       pango_font_description_free(font_desc);
@@ -1002,21 +1003,21 @@ static void mspDrawSequenceText(GtkWidget *tree,
     {
       g_warning("Invalid string constructed when trying to display sequence.\n");
     }
-  
+
 }
 
 
 /* Get the range of the msp that is inside the currently displayed range. The
- * return value is FALSE if no part of the msp is visible. The result coords 
+ * return value is FALSE if no part of the msp is visible. The result coords
  * are in display coords. */
 static gboolean mspGetVisibleRange(MSP *msp, RenderData *data, IntRange *result)
 {
   gboolean found = FALSE;
-  
+
   /* Get the full display range of the MSP (including any portions of unaligned sequence etc.) */
   const IntRange *fullRange = mspGetFullDisplayRange(msp, data->seqSelected, data->bc);
   result->set(fullRange);
-  
+
   if (rangesOverlap(result, data->displayRange))
     {
       /* Limit the returned range to the display range. */
@@ -1037,16 +1038,16 @@ static gboolean mspGetVisibleRange(MSP *msp, RenderData *data, IntRange *result)
  * sequence range) then draw a marker at the clip point so that the user knows there
  * is more data for the match that isn't shown. */
 static void mspDrawClippedMarker(const MSP* const msp,
-                                 const int qIdx, 
-                                 const int segmentIdx, 
+                                 const int qIdx,
+                                 const int segmentIdx,
                                  const IntRange* const segmentRange,
-                                 const int x, 
-                                 const int y, 
+                                 const int x,
+                                 const int y,
                                  RenderData *data)
 {
   gboolean clipStart = FALSE;
   gboolean clipEnd = FALSE;
-  
+
   /* Check if we're at the very first/last index in the reference sequence range */
   if (qIdx == data->bc->refSeqRange.min() && msp->qRange.min() < qIdx)
     {
@@ -1084,7 +1085,7 @@ static void mspDrawClippedMarker(const MSP* const msp,
 
 /* Draw the the given MSP. As well as the sequence text this also draws the background
  * color for each base based on how well it matches the reference sequence, and also
- * draws insertion markers and "clipped" markers. 
+ * draws insertion markers and "clipped" markers.
  * Optionally returns the visible range of the MSP in segmentRange_out. */
 static void drawMsp(SequenceCellRenderer *renderer,
                     MSP *msp,
@@ -1093,7 +1094,7 @@ static void drawMsp(SequenceCellRenderer *renderer,
 {
   /* Extract the section of the reference sequence that we're interested in. */
   IntRange segmentRange;
-  
+
   if (!mspGetVisibleRange(msp, data, &segmentRange))
     {
       return;
@@ -1108,10 +1109,10 @@ static void drawMsp(SequenceCellRenderer *renderer,
   GError *error = NULL;
   gchar *refSeqSegment = getSequenceSegment(data->bc->refSeq,
                                             &qRange,
-					    data->qStrand, 
+					    data->qStrand,
                                             BLXSEQ_DNA,               /* ref seq is always in nucleotide coords */
 					    data->bc->seqType,        /* required segment is in display coords */
-					    data->qFrame, 
+					    data->qFrame,
 					    data->bc->numFrames,
 					    &data->bc->refSeqRange,
 					    data->bc->blastMode,
@@ -1133,12 +1134,12 @@ static void drawMsp(SequenceCellRenderer *renderer,
       /* If there's an error but the sequence was still returned it's a non-critical warning */
       reportAndClearIfError(&error, G_LOG_LEVEL_WARNING);
     }
-    
+
   /* We'll populate a string with the characters we want to display as we loop through the indices. */
   const int segmentLen = strlen(refSeqSegment);
   gchar displayText[segmentLen + 1];
   displayText[0] = '\0';
-  
+
   int lastFoundSIdx = UNSET_INT;  /* remember the last index where we found a valid base */
   int lastFoundQIdx = UNSET_INT;  /* remember the last index where we found a valid base */
 
@@ -1147,12 +1148,12 @@ static void drawMsp(SequenceCellRenderer *renderer,
     {
       int x = UNSET_INT, y = UNSET_INT;
       segmentGetCoordsForBaseIdx(segmentIdx, &segmentRange, data, &x, &y);
-      
+
       /* Find the base in the match sequence and draw the background color according to how well it matches */
       int sIdx = UNSET_INT, qIdx = UNSET_INT;
       mspDrawBaseBg(msp, segmentIdx, &segmentRange, refSeqSegment, data, x, y, displayText, &sIdx, &qIdx);
-      
-      /* If there is an insertion (i.e. extra bases on the match sequence) between this 
+
+      /* If there is an insertion (i.e. extra bases on the match sequence) between this
        * and the previous coord, draw a marker */
       mspDrawInsertionMarker(sIdx, lastFoundSIdx, qIdx, lastFoundQIdx, x, y, data);
 
@@ -1174,7 +1175,7 @@ static void drawMsp(SequenceCellRenderer *renderer,
   mspDrawSequenceText(tree, displayText, &segmentRange, data);
 
   g_free(refSeqSegment);
-}    
+}
 
 
 /* Draw a colinearity line between the two given MSPs, if applicable */
@@ -1220,7 +1221,7 @@ static void mspDrawColinearityLine(const MSP* msp1, const MSP* msp2, const gbool
             {
               if (x1 < data->cell_area->x)
                 x1 = data->cell_area->x;
-      
+
               if (x2 > data->cell_area->x + data->cell_area->width)
                 x2 = data->cell_area->x + data->cell_area->width;
 
@@ -1244,11 +1245,11 @@ static void mspDrawColinearityLineAdjacent(const MSP* msp, const gboolean select
           if (mspItem->data == msp)
             break;
         }
-      
+
       if (mspItem) /* found it */
         {
           GList *adjacentItem = (prev ? mspItem->prev : mspItem->next);
-          
+
           if (adjacentItem)
             {
               const MSP* adjacentMsp = (const MSP*)(adjacentItem->data);
@@ -1257,7 +1258,7 @@ static void mspDrawColinearityLineAdjacent(const MSP* msp, const gboolean select
                 mspDrawColinearityLine(adjacentMsp, msp, selected, data);
               else
                 mspDrawColinearityLine(msp, adjacentMsp, selected, data);
-            }  
+            }
         }
     }
 }
@@ -1280,7 +1281,7 @@ static void mspDrawColinearityLines(const MSP* cur_msp, const MSP* prev_msp, con
            * in different rows. */
           if (prev_msp == NULL)
             mspDrawColinearityLineAdjacent(cur_msp, selected, data, TRUE);
-          
+
           /* If it's the last MSP in the row, then check for adjacent MSPs in the sequence that may be
            * in different rows. */
           if (cur_msp == NULL)
@@ -1295,7 +1296,7 @@ static void mspDrawColinearityLines(const MSP* cur_msp, const MSP* prev_msp, con
            * they will overlap but otherwise they need to be shown in each frame) */
           if (cur_msp)
             mspDrawColinearityLineAdjacent(cur_msp, selected, data, TRUE);
-          
+
           if (prev_msp)
             mspDrawColinearityLineAdjacent(prev_msp, selected, data, FALSE);
         }
@@ -1308,7 +1309,7 @@ static void mspDrawColinearityLines(const MSP* cur_msp, const MSP* prev_msp, con
  * and draws each one (IF it is in the correct strand/frame for this tree). */
 static void rendererDrawMsps(SequenceCellRenderer *renderer,
                              GtkWidget *tree,
-                             GdkWindow *window, 
+                             GdkWindow *window,
                              GtkStateType state,
                              GdkRectangle *cell_area)
 {
@@ -1316,7 +1317,7 @@ static void rendererDrawMsps(SequenceCellRenderer *renderer,
   TreeProperties *treeProperties = treeGetProperties(tree);
   DetailViewProperties *detailViewProperties = detailViewGetProperties(treeProperties->detailView);
   BlxContext *bc = blxWindowGetContext(detailViewProperties->blxWindow());
-  
+
   const gboolean highlightDiffs = bc->flags[BLXFLAG_HIGHLIGHT_DIFFS]; /* swap match/mismatch colors if this is true */
   const MSP *firstMsp = (const MSP*)(renderer->mspGList->data);
   const BlxSequence *seq = firstMsp ? firstMsp->sSequence : NULL;
@@ -1326,9 +1327,9 @@ static void rendererDrawMsps(SequenceCellRenderer *renderer,
   GdkColor *mismatchColor = getGdkColor(BLXCOLOR_MISMATCH, bc->defaultColors, FALSE, bc->usePrintColors);
   GdkColor *mismatchColorSelected = getGdkColor(BLXCOLOR_MISMATCH, bc->defaultColors, TRUE, bc->usePrintColors);
   GdkColor *backgroundColorSelected = getGdkColor(BLXCOLOR_BACKGROUND, bc->defaultColors, TRUE, bc->usePrintColors);
-  
+
   GdkGC *gc = gdk_gc_new(window);
-  
+
   /* Make the dashes of the partial-boundary lines very short and closely
    * packed (i.e. dash length of 2 pixels and gaps of 1 pixel) */
   int listLen = 2;
@@ -1385,9 +1386,9 @@ static void rendererDrawMsps(SequenceCellRenderer *renderer,
     detailViewProperties->exonBoundaryLineStylePartial,
     bc->flags[BLXFLAG_LIMIT_UNALIGNED_BASES],
     detailViewProperties->numUnalignedBases
-  };  
-  
-  /* If a range is selected highlight it now in case we don't come to process it (in 
+  };
+
+  /* If a range is selected highlight it now in case we don't come to process it (in
    * which case this will get drawn over). */
   if (data.selectionRange)
     {
@@ -1403,11 +1404,11 @@ static void rendererDrawMsps(SequenceCellRenderer *renderer,
   GList *mspListItem = renderer->mspGList;
   MSP *savedMsp = NULL;
   MSP *prevMsp = NULL;
-  
+
   for ( ; mspListItem; mspListItem = mspListItem->next)
     {
       MSP *msp = (MSP*)(mspListItem->data);
-      
+
       if (mspIsBlastMatch(msp))
         {
           gboolean selected = blxWindowIsSeqSelected(detailViewProperties->blxWindow(), msp->sSequence);
@@ -1420,10 +1421,10 @@ static void rendererDrawMsps(SequenceCellRenderer *renderer,
                * must be identical (i.e. duplicate) matches and we only need to draw one of them.
                * This is an important optimisation for BAM data, where we can have hundreds of
                * identical reads on the same row.
-               * gb10 2014: Ideally we should add optimisation for the case where we have both 
+               * gb10 2014: Ideally we should add optimisation for the case where we have both
                * linked features and identical matches in the same row, but this isn't used at the
                * moment. */
-              
+
               /* If any of the MSPs is selected, we want to draw the row as selected, so loop through
                * checking if any are selected. If a selected one is found then draw it; otherwise,
                * save the first MSP so we can go back and draw that. */
@@ -1450,10 +1451,10 @@ static void rendererDrawMsps(SequenceCellRenderer *renderer,
         {
           drawBoxFeature(renderer, msp, tree, &data);
         }
-      
+
       prevMsp = msp;
     }
-  
+
   /* Draw colinearity lines for the last msp. Passing curMsp as null indicates it's the last msp
    * so we search for adjacent msps in different rows. */
   if (prevMsp)
@@ -1461,9 +1462,9 @@ static void rendererDrawMsps(SequenceCellRenderer *renderer,
 
   if (savedMsp)
     drawMsp(renderer, savedMsp, tree, &data);
-  
+
   drawAllVisibleExonBoundaries(tree, &data);
-  
+
   g_object_unref(gc);
 
   if (data.selectionRange)
@@ -1493,7 +1494,7 @@ static GtkStateType getState(GtkWidget *widget, GtkCellRendererState flags)
     {
       state = GTK_STATE_NORMAL;
     }
-  
+
   return state;
 }
 
@@ -1504,34 +1505,34 @@ static gboolean mspListContainsSelectedMsp(GList *mspList, const BlxContext* con
 {
   gboolean isSelected = FALSE;
   GList *mspItem = mspList;
-  
+
   for ( ; mspItem && !isSelected; mspItem = mspItem->next)
     {
       const MSP* const msp = (const MSP*)(mspItem->data);
       isSelected = bc->isSeqSelected(msp->sSequence);
     }
-  
+
   return isSelected;
 }
 
 
 /* Utility to determine if any MSP in the given list is in a group and, if so
- * to return that group.  Returns the first group found and ignores any 
+ * to return that group.  Returns the first group found and ignores any
  * subsequent MSPs in the list that also have groups. Returns null if no group
  * was found. */
 static SequenceGroup* mspListContainsGroupedMsp(GList *mspList, const BlxContext* const bc)
 {
   SequenceGroup *group = NULL;
   GList *mspItem = mspList;
-  
+
   for ( ; mspItem && !group; mspItem = mspItem->next)
     {
       const MSP* const msp = (const MSP*)(mspItem->data);
       group = bc->getFirstSequenceGroup(msp->sSequence);
     }
-  
+
   return group;
-  
+
 }
 
 
@@ -1539,17 +1540,17 @@ static SequenceGroup* mspListContainsGroupedMsp(GList *mspList, const BlxContext
 static void rendererSetBackgroundColor(GtkCellRenderer *cell, GtkWidget *tree, GdkWindow *window, GdkRectangle *background_area)
 {
   SequenceCellRenderer *renderer = SEQUENCE_CELL_RENDERER(cell);
-  
+
   if (renderer->data)
     {
-      /* Find out whether the MSP(s) that this cell is displaying are in 
+      /* Find out whether the MSP(s) that this cell is displaying are in
        * a grouped sequence or are selected. */
       const BlxContext* const bc = blxWindowGetContext(treeGetBlxWindow(tree));
       GList *mspList = renderer->data;
-      
+
       const gboolean isSelected = mspListContainsSelectedMsp(mspList, bc);
       const SequenceGroup* const group = mspListContainsGroupedMsp(mspList, bc);
-      
+
       GdkGC *gc = gdk_gc_new(window);
 
       if (isSelected || (group && group->highlighted))
@@ -1580,7 +1581,7 @@ static void rendererSetBackgroundColor(GtkCellRenderer *cell, GtkWidget *tree, G
         }
 
       drawRectangle2(window, widgetGetDrawable(tree), gc, TRUE, background_area->x, background_area->y, background_area->width, background_area->height);
-      
+
       g_object_unref(gc);
     }
 }
@@ -1597,7 +1598,7 @@ static void rendererDrawGridLines(GtkWidget *tree, GdkWindow *window, GdkRectang
   /* Set the line color */
   GdkColor *color = getGdkColor(BLXCOLOR_TREE_GRID_LINES, bc->defaultColors, FALSE, bc->usePrintColors);
   gdk_gc_set_foreground(gc, color);
-  
+
   /* We want dashed lines */
   const int lineWidth = 1;
   gdk_gc_set_line_attributes(gc, lineWidth, GDK_LINE_ON_OFF_DASH, GDK_CAP_BUTT, GDK_JOIN_MITER);
@@ -1607,12 +1608,12 @@ static void rendererDrawGridLines(GtkWidget *tree, GdkWindow *window, GdkRectang
   gint8 dashList[listLen];
   dashList[0] = 1;
   gdk_gc_set_dashes(gc, 0, dashList, listLen);
-  
+
   /* Draw vertical lines. Draw the right edge of each cell (because we don't really want a
    * line at the leftmost edge of the first cell.) */
   const int x = cell_area->x + cell_area->width - lineWidth;
   drawLine2(window, drawable, gc, x, cell_area->y, x, cell_area->y + cell_area->height);
-  
+
   g_object_unref(gc);
 }
 
@@ -1635,7 +1636,7 @@ sequence_cell_renderer_get_size (GtkCellRenderer *cell,
                                         gint            *width,
                                         gint            *height)
 {
-  get_size(cell, widget, cell_area, x_offset, y_offset, width, height);  
+  get_size(cell, widget, cell_area, x_offset, y_offset, width, height);
 }
 
 
@@ -1655,11 +1656,11 @@ sequence_cell_renderer_render (GtkCellRenderer *cell,
 			       GtkCellRendererState flags)
 {
   rendererSetBackgroundColor(cell, tree, window, background_area);
-  
+
   SequenceCellRenderer *renderer = SEQUENCE_CELL_RENDERER(cell);
-  
+
   MSP *msp = renderer->mspGList ? (MSP*)(renderer->mspGList->data) : NULL;
-  
+
   if (msp)
     {
       rendererDrawMsps(renderer, tree, window, getState(tree, flags), cell_area);
@@ -1668,9 +1669,6 @@ sequence_cell_renderer_render (GtkCellRenderer *cell,
     {
       rendererDrawSimpleText(renderer, tree, window, getState(tree, flags), cell_area);
     }
-  
+
   rendererDrawGridLines(tree, window, background_area);
 }
-
-
-
diff --git a/src/blixemApp/sequencecellrenderer.hpp b/src/blixemApp/sequencecellrenderer.hpp
index b46494acb458026a93f07a4e5a2e7e18a3df05f4..594f9137de152b555daad95d2015f7c9b3eacd98 100644
--- a/src/blixemApp/sequencecellrenderer.hpp
+++ b/src/blixemApp/sequencecellrenderer.hpp
@@ -1,5 +1,6 @@
 /*  File: sequencecellrenderer.h
  *  Author: Gemma Barson, 2009-10-15
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -29,11 +30,11 @@
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
  * Description: A custom renderer to render cells in the detail-view trees.
- *              Each row in the tree contains a match sequence, and the 
+ *              Each row in the tree contains a match sequence, and the
  *              renderer draws the portion of that sequence that is within the
  *              current display range.
  *
- *              Each base is colored to indicate whether it is a match, 
+ *              Each base is colored to indicate whether it is a match,
  *              mismatch or conserved (similar) match.
  *              Markers are drawn to indicate deletions or insertions.
  *
@@ -77,12 +78,12 @@
 typedef struct _SequenceCellRenderer
 {
   GtkCellRenderer   parent;
-  
+
   /* The cell renderer can be used to render a match sequence or plain text */
   char *text;       /* generic text property */
   GList *mspGList;  /* property for the sequence column. Contains the MSP(s) to be displayed in this row */
   GList *data;      /* property for data that is set for every column */
-  
+
 } SequenceCellRenderer;
 
 
diff --git a/src/dotterApp/alignmenttool.cpp b/src/dotterApp/alignmenttool.cpp
index a08e5b98f81fc306a352767f4c6018a82f4aac31..502e11a9e227dfd282398cf6fdf093e317b3eda8 100644
--- a/src/dotterApp/alignmenttool.cpp
+++ b/src/dotterApp/alignmenttool.cpp
@@ -1,5 +1,6 @@
 /*  File: alignmenttool.c
  *  Author: Gemma Barson, 2010-09-02
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -64,7 +65,7 @@ NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
 NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
 NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
 NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
-NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA 
+NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
 };
 
 
@@ -111,7 +112,7 @@ public:
 
   GtkWidget *selectionWidget;       /* text in this widget should be highlighted (null if none) */
   IntRange selectionRange;
-  
+
   DotterWindowContext *dotterWinCtx;
 
   gboolean spliceSitesOn;
@@ -157,7 +158,7 @@ static SequenceProperties* sequenceGetProperties(GtkWidget *widget)
 static void onDestroySequenceWidget(GtkWidget *widget)
 {
   SequenceProperties *properties = sequenceGetProperties(widget);
-  
+
   if (properties)
     {
       g_object_set_data(G_OBJECT(widget), "SequenceProperties", NULL);
@@ -166,7 +167,7 @@ static void onDestroySequenceWidget(GtkWidget *widget)
     }
 }
 
-static void sequenceCreateProperties(GtkWidget *widget, 
+static void sequenceCreateProperties(GtkWidget *widget,
                                      DotterContext *dc,
                                      const char *seqName,
                                      const char *sequence,
@@ -197,9 +198,9 @@ static void sequenceCreateProperties(GtkWidget *widget,
 
       properties->fullRangeDisplayCoords.set(getSequenceStart(properties, dc, TRUE),
                                              getSequenceEnd(properties, dc, TRUE));
-      
+
       g_object_set_data(G_OBJECT(widget), "SequenceProperties", properties);
-      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroySequenceWidget), NULL); 
+      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroySequenceWidget), NULL);
     }
 }
 
@@ -212,7 +213,7 @@ static AlignmentToolProperties* alignmentToolGetProperties(GtkWidget *widget)
 static void onDestroyAlignmentTool(GtkWidget *widget)
 {
   AlignmentToolProperties *properties = alignmentToolGetProperties(widget);
-  
+
   if (properties)
     {
       g_object_set_data(G_OBJECT(widget), "AlignmentToolProperties", NULL);
@@ -222,13 +223,13 @@ static void onDestroyAlignmentTool(GtkWidget *widget)
 }
 
 static void alignmentToolCreateProperties(GtkWidget *widget,
-                                          GtkWidget *alignmentWindow, 
+                                          GtkWidget *alignmentWindow,
                                           DotterWindowContext *dotterWinCtx)
 {
   if (widget)
     {
       AlignmentToolProperties *properties = new AlignmentToolProperties;
-    
+
       properties->widget = widget;
       properties->alignmentWindow = alignmentWindow;
       properties->dotterWinCtx = dotterWinCtx;
@@ -239,11 +240,11 @@ static void alignmentToolCreateProperties(GtkWidget *widget,
       properties->dragging = FALSE;
       properties->dragStart = 0;
       properties->selectionWidget = NULL;
-      
+
       properties->spliceSitesOn = TRUE;
 
       g_object_set_data(G_OBJECT(widget), "AlignmentToolProperties", properties);
-      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyAlignmentTool), NULL); 
+      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyAlignmentTool), NULL);
     }
 }
 
@@ -272,20 +273,20 @@ static gboolean onExposeSequence(GtkWidget *widget, GdkEventExpose *event, gpoin
 {
   GtkWidget *alignmentTool = GTK_WIDGET(data);
   GdkWindow *drawable = widgetGetDrawable(widget);
-  
+
   if (!drawable)
     {
       drawable = createBlankPixmap(widget);
       drawSequence(drawable, widget, alignmentTool);
     }
-  
+
   if (drawable)
     {
       GdkGC *gc = gdk_gc_new(widget->window);
       gdk_draw_drawable(widget->window, gc, drawable, 0, 0, 0, 0, -1, -1);
       g_object_unref(gc);
     }
-  
+
   return TRUE;
 }
 
@@ -301,14 +302,14 @@ static gboolean onExposeRefSequenceHeader(GtkWidget *widget, GdkEventExpose *eve
       drawable = createBlankPixmap(widget);
       drawSequenceHeader(widget, alignmentTool, drawable, TRUE);
     }
-  
+
   if (drawable)
     {
       GdkGC *gc = gdk_gc_new(widget->window);
       gdk_draw_drawable(widget->window, gc, drawable, 0, 0, 0, 0, -1, -1);
       g_object_unref(gc);
     }
-  
+
   return TRUE;
 }
 
@@ -318,20 +319,20 @@ static gboolean onExposeMatchSequenceHeader(GtkWidget *widget, GdkEventExpose *e
 {
   GtkWidget *alignmentTool = GTK_WIDGET(data);
   GdkDrawable *drawable = widgetGetDrawable(widget);
-  
+
   if (!drawable)
     {
       drawable = createBlankPixmap(widget);
       drawSequenceHeader(widget, alignmentTool, drawable, FALSE);
     }
-  
+
   if (drawable)
     {
       GdkGC *gc = gdk_gc_new(widget->window);
       gdk_draw_drawable(widget->window, gc, drawable, 0, 0, 0, 0, -1, -1);
       g_object_unref(gc);
     }
-  
+
   return TRUE;
 }
 
@@ -347,7 +348,7 @@ static void onAlignmentToolRangeChanged(GtkWidget *alignmentTool)
 static gboolean onButtonPressSequence(GtkWidget *sequenceWidget, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->type == GDK_BUTTON_PRESS && event->button == 1) /* left click */
     {
       GtkWidget *alignmentTool = GTK_WIDGET(data);
@@ -376,7 +377,7 @@ static gboolean onButtonReleaseSequence(GtkWidget *sequenceWidget, GdkEventButto
       sequenceFinishDragging(sequenceWidget, alignmentTool, event->x);
       handled = TRUE;
     }
-    
+
   return handled;
 }
 
@@ -389,21 +390,21 @@ static gboolean onMouseMoveSequence(GtkWidget *sequenceWidget, GdkEventMotion *e
     {
       /* Update the current selection range */
       GtkWidget *alignmentTool = GTK_WIDGET(data);
-      
+
       AlignmentToolProperties *atProperties = alignmentToolGetProperties(alignmentTool);
 
       if (atProperties)
         {
           const int newCoord = getCoordAtPos(event->x, sequenceWidget, alignmentTool);
-      
+
           atProperties->selectionRange.set(atProperties->dragStart, newCoord);
           widgetClearCachedDrawable(sequenceWidget, NULL);
           gtk_widget_queue_draw(sequenceWidget);
-      
+
           handled = TRUE;
         }
     }
-  
+
   return handled;
 }
 
@@ -413,7 +414,7 @@ void alignmentToolSetSpliceSitesOn(GtkWidget *alignmentTool, const gboolean spli
   if (alignmentTool)
     {
       AlignmentToolProperties *properties = alignmentToolGetProperties(alignmentTool);
-      
+
       if (properties)
         {
           properties->spliceSitesOn = spliceSitesOn;
@@ -451,7 +452,7 @@ void updateAlignmentRange(GtkWidget *alignmentTool, DotterWindowContext *dwc)
     {
       DotterContext *dc = dwc->dotterCtx;
 
-      /* Re-create the range, centred on the set coordinate and with the alignment tool's alignment 
+      /* Re-create the range, centred on the set coordinate and with the alignment tool's alignment
        * length. Note that the length is the number of display chars but the reference sequence is
        * in nucleotide coords so needs converting. (The match sequence is always in display coords so
        * will be correct whether we're displaying nucleotides or peptides.) */
@@ -490,28 +491,28 @@ static void createRefSeqWidget(GtkWidget *alignmentTool,
   g_return_if_fail(properties->dotterWinCtx && properties->dotterWinCtx->dotterCtx) ;
 
   DotterContext *dc = properties->dotterWinCtx->dotterCtx;
-  
+
   /* Create a label containing the name */
   char *text = g_strdup_printf("%s (%c%d):", dc->refSeqName, strandChar, frame);
   GtkWidget *label = createLabel(text, 0.0, 0.0, FALSE, TRUE, TRUE);
   labelSetFont(label, dc->fontDesc);
   g_free(text);
   gtk_table_attach(table, label, 1, 2, *row, *row + 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
-  
+
   /* Find which sequence is applicable (fwd or rev strand or translated peptide seq) */
   char *sequence = dc->refSeq;
-  
+
   if (dc->displaySeqType == BLXSEQ_DNA && strand == BLXSTRAND_REVERSE)
     sequence = dc->refSeqRev;
   else if (dc->blastMode == BLXMODE_BLASTX)
     sequence = dc->peptideSeqs[frame - 1];
-  
+
   /* Create the widget that will render the sequence data. */
   GtkWidget *refSeqWidget = gtk_drawing_area_new();
   gtk_widget_set_size_request(refSeqWidget, -1, roundNearest(dc->charHeight));
   *refSeqList = g_slist_append(*refSeqList, refSeqWidget);
-  
-  sequenceCreateProperties(refSeqWidget, dc, dc->refSeqName, sequence, dc->refSeqType, strand, 
+
+  sequenceCreateProperties(refSeqWidget, dc, dc->refSeqName, sequence, dc->refSeqType, strand,
                            frame, &properties->refDisplayRange, &dc->refSeqFullRange,
                            dc->hozScaleRev, matchSeqList, TRUE);
 
@@ -519,7 +520,7 @@ static void createRefSeqWidget(GtkWidget *alignmentTool,
   gtk_widget_add_events(refSeqWidget, GDK_EXPOSURE_MASK);
 
   connectSequenceSignals(refSeqWidget, alignmentTool);
-  
+
   *row += 1;
 }
 
@@ -562,7 +563,7 @@ static GtkWidget* createAlignmentToolSection(BlxStrand strand,
   const int xpad = 2;
   const int ypad = 0;
   const char strandChar = (strand == BLXSTRAND_FORWARD ? '+' : '-');
-  
+
   GtkTable *table = GTK_TABLE(gtk_table_new(numRows, numCols, FALSE));
   int row = 0;
 
@@ -570,58 +571,58 @@ static GtkWidget* createAlignmentToolSection(BlxStrand strand,
    * it as data to the ref sequence widgets. */
   GtkWidget *matchSeqWidget = gtk_drawing_area_new();
   gtk_widget_set_size_request(matchSeqWidget, -1, roundNearest(dc->charHeight));
-  
+
   /* We need to create a list of match seqs (just one entry) and ref seqs to pass as data to the
    * ref seq and match seq respectively. */
   GSList *matchSeqList = NULL;
   matchSeqList = g_slist_append(matchSeqList, matchSeqWidget);
-  
+
   GSList *refSeqList = NULL;
-  
+
   /* Create a header line for this strand of the reference sequence. This widget will display
    * the currently-selected ref seq coord. */
   createDrawingAreaWidget(dc, G_CALLBACK(onExposeRefSequenceHeader), alignmentTool,
                           roundNearest(dc->charHeight) + SELECTED_COORD_MARKER_HEIGHT,
                           table, xpad, ypad, &row);
-    
+
   /* Add a line for each frame of the reference sequence */
   int frame = 1;
   for (frame = 1; frame <= dc->numFrames; ++frame)
     {
       createRefSeqWidget(alignmentTool, properties, frame, strand, strandChar, matchSeqList, table, xpad, ypad, &row, &refSeqList);
     }
-  
+
   /* Add a label for the match sequence */
   char *text = g_strdup_printf("%s:", dc->matchSeqName);
   GtkWidget *label = createLabel(text, 0.0, 0.0, FALSE, TRUE, TRUE);
   labelSetFont(label, dc->fontDesc);
   g_free(text);
   gtk_table_attach(table, label, 1, 2, row, row + 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
-  
+
   /* Now add the data to the match-sequence widget and add it to the bottom row of the table */
   char *matchSequence = dc->matchSeqStrand == BLXSTRAND_REVERSE ? dc->matchSeqRev : dc->matchSeq;
-  
+
   sequenceCreateProperties(matchSeqWidget, dc, dc->matchSeqName, matchSequence, dc->matchSeqType, dc->matchSeqStrand,
                            1, &properties->matchDisplayRange, &dc->matchSeqFullRange, dc->vertScaleRev, refSeqList, FALSE);
-  
+
   gtk_table_attach(table, matchSeqWidget, 2, 3, row, row + 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
   gtk_widget_add_events(matchSeqWidget, GDK_EXPOSURE_MASK);
 
   connectSequenceSignals(matchSeqWidget, alignmentTool);
-    
+
   ++row;
-  
+
   /* Create the bottom label. This will display the currently-selected match seq coord.  */
   createDrawingAreaWidget(dc, G_CALLBACK(onExposeMatchSequenceHeader), alignmentTool,
                           roundNearest(dc->charHeight) + SELECTED_COORD_MARKER_HEIGHT + roundNearest(dc->charHeight), /* extra charheight for spacing */
                           table, xpad, ypad, &row);
- 
-  
+
+
   /* Make sure neither header is focused at the start because if it is
    * then its text will be selected and we will inadvertently overwrite the
    * contents of the primary clipboard. */
   gtk_container_set_focus_child(GTK_CONTAINER(table), matchSeqWidget);
- 
+
   return GTK_WIDGET(table);
 }
 
@@ -652,15 +653,15 @@ GtkWidget* createAlignmentTool(DotterWindowContext *dotterWinCtx, GtkWidget **al
 
   DEBUG_ENTER("createAlignmentTool");
 
-  /* We'll put everything in a vbox, inside a frame */  
+  /* We'll put everything in a vbox, inside a frame */
   GtkWidget *alignmentTool = gtk_frame_new(NULL);
   gtk_frame_set_shadow_type(GTK_FRAME(alignmentTool), GTK_SHADOW_ETCHED_IN);
-  
+
   GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(alignmentTool), vbox);
 
   GtkWidget *alignmentWindow = createAlignmentToolWindow(dotterWinCtx, alignmentTool);
-    
+
   /* Remember the headers so we can store them in the properties. We'll need to update them
    * when the range updates since they contain the centre coord of the current display range. */
   alignmentToolCreateProperties(alignmentTool, alignmentWindow, dotterWinCtx);
@@ -682,13 +683,13 @@ GtkWidget* createAlignmentTool(DotterWindowContext *dotterWinCtx, GtkWidget **al
           GtkWidget *section2 = createAlignmentToolSection(qStrand, alignmentTool, properties);
           gtk_box_pack_start(GTK_BOX(vbox), section2, FALSE, FALSE, 0);
         }
-  
+
       gtk_widget_add_events(alignmentTool, GDK_BUTTON_PRESS_MASK);
       gtk_widget_add_events(alignmentTool, GDK_KEY_PRESS_MASK);
 
       g_signal_connect(G_OBJECT(alignmentTool), "size-allocate", G_CALLBACK(onSizeAllocateAlignmentTool), NULL);
       gtk_widget_show_all(alignmentTool);
-  
+
       onAlignmentToolRangeChanged(alignmentTool);
 
       if (alignmentWindow_out)
@@ -706,8 +707,8 @@ GtkWidget* createAlignmentTool(DotterWindowContext *dotterWinCtx, GtkWidget **al
 
 /* Highlight splice site dinucleotides for known HSPs */
 static void drawSequenceSpliceSites(GdkDrawable *drawable,
-                                    GtkWidget *widget, 
-                                    GtkWidget *alignmentTool, 
+                                    GtkWidget *widget,
+                                    GtkWidget *alignmentTool,
                                     SequenceProperties *seq1,
                                     GdkGC *gc)
 {
@@ -730,14 +731,14 @@ static void drawSequenceSpliceSites(GdkDrawable *drawable,
   /* Loop through each MSP looking for one that has the relevant sequence name, and has start/end
    * within the current visible range */
   MSP *msp = dc->mspList;
-  
+
   for ( ; msp; msp = msp->next)
     {
       const char *mspName = msp->sname;
 
-      if (!mspName || 
-          msp->type != BLXMSP_MATCH || 
-          msp->qStrand != seq1->strand || 
+      if (!mspName ||
+          msp->type != BLXMSP_MATCH ||
+          msp->qStrand != seq1->strand ||
           strcmp(mspName, dc->matchSeqName))
         {
           /* Not an MSP from our match sequence */
@@ -745,7 +746,7 @@ static void drawSequenceSpliceSites(GdkDrawable *drawable,
         }
 
       /* If the splice site adjacent to the start coord is within range then highlight it */
-      if (valueWithinRange(msp->qRange.min() - 1, seq1->displayRange) || 
+      if (valueWithinRange(msp->qRange.min() - 1, seq1->displayRange) ||
           valueWithinRange(msp->qRange.min() - 2, seq1->displayRange))
         {
           /* Get the leftmost coord (for rev strand this is the max of the two coords) */
@@ -755,7 +756,7 @@ static void drawSequenceSpliceSites(GdkDrawable *drawable,
         }
 
       /* If the splice site adjacent to the end coord is within range then highlight it */
-      if (valueWithinRange(msp->qRange.max() + 1, seq1->displayRange) || 
+      if (valueWithinRange(msp->qRange.max() + 1, seq1->displayRange) ||
           valueWithinRange(msp->qRange.max() + 2, seq1->displayRange))
         {
           /* Get the leftmost coord (for rev strand this is the max of the two coords) */
@@ -809,7 +810,7 @@ static void drawSequence(GdkDrawable *drawable, GtkWidget *widget, GtkWidget *al
   GdkGC *gc = gdk_gc_new(drawable);
 
   const int seq1Len = strlen(seq1->sequence);
-  
+
   /* If text on this widget is selected, then we'll highlight any bases within
    * the selection range. */
   const gboolean highlight = (atProperties->selectionWidget == widget);
@@ -817,7 +818,7 @@ static void drawSequence(GdkDrawable *drawable, GtkWidget *widget, GtkWidget *al
   /* Get the sequence coord at the start of the display (leftmost edge) */
   int seq1Start = getDisplayStart(seq1, dc);
   const int seq1Offset = getSequenceOffset(seq1, dc);
-  
+
   /* Loop through each display coord (0-based from left edge of display) */
   int displayIdx = 0;
   char seq1Text[atProperties->alignmentLen + 1];
@@ -825,33 +826,33 @@ static void drawSequence(GdkDrawable *drawable, GtkWidget *widget, GtkWidget *al
   for ( ; displayIdx <= atProperties->alignmentLen; ++displayIdx)
     {
       seq1Text[displayIdx] = ' ';
-    
+
       /* Get the 0-based index into sequence 1 and extract the character at this index */
       const int seq1Idx = displayIdx - seq1Offset;
-      
+
       if (seq1Idx >= 0 && seq1Idx < seq1Len)
         {
           seq1Text[displayIdx] = seq1->sequence[seq1Idx];
           highlightSequenceBase(seq1, atProperties, dwc, displayIdx, seq1Idx, seq1Start, highlight, gc, drawable);
         }
     }
-  
+
   /* terminate the display text string */
   seq1Text[displayIdx] = '\0';
-  
+
   /* Highlight splice sites */
   drawSequenceSpliceSites(drawable, widget, alignmentTool, seq1, gc);
 
   /* Draw the sequence text over the top of any highlighting */
   PangoLayout *layout = gtk_widget_create_pango_layout(widget, seq1Text);
   pango_layout_set_font_description(layout, dc->fontDesc);
-  
+
   if (layout)
     {
       gtk_paint_layout(widget->style, drawable, GTK_STATE_NORMAL, TRUE, NULL, widget, NULL, 0, 0, layout);
       g_object_unref(layout);
     }
-  
+
   g_object_unref(gc);
 }
 
@@ -863,7 +864,7 @@ static void drawSequenceHeaderMarker(GdkDrawable *drawable, const int x, const i
 
   /* Draw a marker line below where the text will go */
   const int x1 = x + roundNearest((charWidth / 2.0));
-  
+
   GdkGC *gc = gdk_gc_new(drawable);
   gdk_draw_line(drawable, gc, x1, y, x1, y +  + SELECTED_COORD_MARKER_HEIGHT);
   g_object_unref(gc);
@@ -871,11 +872,11 @@ static void drawSequenceHeaderMarker(GdkDrawable *drawable, const int x, const i
 
 
 /* Utility called by drawSequenceHeader to draw the header text at the given coords */
-static void drawSequenceHeaderText(GtkWidget *widget, 
-                                   GdkDrawable *drawable, 
-                                   const int x, 
-                                   const int y, 
-                                   const int coordIn, 
+static void drawSequenceHeaderText(GtkWidget *widget,
+                                   GdkDrawable *drawable,
+                                   const int x,
+                                   const int y,
+                                   const int coordIn,
                                    DotterContext *dc,
                                    const gboolean horizontal)
 {
@@ -883,36 +884,36 @@ static void drawSequenceHeaderText(GtkWidget *widget,
 
   int coord = getDisplayCoord(coordIn, dc, horizontal);
   char *displayText = convertIntToString(coord);
-  
+
   PangoLayout *layout = gtk_widget_create_pango_layout(widget, displayText);
   pango_layout_set_font_description(layout, dc->fontDesc);
-  
+
   if (layout)
     {
       /* Offset the text so that the middle of the text is lined up with the coord of interest */
       const int offset = ceil((((gdouble)numDigitsInInt(coord) / 2.0) - 1) * dc->charWidth);
-    
+
       gtk_paint_layout(widget->style, drawable, GTK_STATE_NORMAL, TRUE, NULL, widget, NULL, x - offset, y, layout);
       g_object_unref(layout);
     }
-  
+
   g_free(displayText);
-  
+
 }
 
 
 /* Draw a sequence header that displays the centre coord of the given display range. If
  * markerFirst is true the marker is drawn above the text, otherwise below. */
-static void drawSequenceHeader(GtkWidget *widget, 
+static void drawSequenceHeader(GtkWidget *widget,
                                GtkWidget *alignmentTool,
-                               GdkDrawable *drawable, 
+                               GdkDrawable *drawable,
                                const gboolean horizontal)
 {
   AlignmentToolProperties *properties = alignmentToolGetProperties(alignmentTool);
   DotterWindowContext *dwc = properties->dotterWinCtx;
 
   g_return_if_fail(widget && properties && dwc && dwc->dotterCtx) ;
-  
+
   DotterContext *dc = dwc->dotterCtx;
 
   /* Make sure the alignment length is up to date */
@@ -922,7 +923,7 @@ static void drawSequenceHeader(GtkWidget *widget,
   const int coord = horizontal ? dwc->refCoord : dwc->matchCoord;
 
   const IntRange* const displayRange = horizontal ? &properties->refDisplayRange : &properties->matchDisplayRange;
-  
+
   /* Find the position to display at. Find the position of the char at this coord */
   const int displayIdx = convertToDisplayIdx(coord - displayRange->min(), horizontal, dc, 1, NULL) - 1;
   int x = (int)((gdouble)displayIdx * dc->charWidth);
@@ -991,7 +992,7 @@ static int getDisplayEnd(SequenceProperties *properties, DotterContext *dc)
 }
 
 
-/* Get the start coord of the bit of sequence displayed by a given 
+/* Get the start coord of the bit of sequence displayed by a given
  * sequence widget. Adjusts the start so that we have the correct
  * coord for the relevant frame/strand. Converts to display coords
  * if requested, otherwise returns the nucleotide coord. */
@@ -1003,12 +1004,12 @@ static int getSequenceStart(SequenceProperties *properties, DotterContext *dc, c
 
   /* Get the start coord of the sequence data */
   int seqStart = forward ? properties->fullRange->min() : properties->fullRange->max();
-  
+
   /* Offset this coord so that we have the first coord that starts our reading frame */
   int reqdFrame = properties->frame;
   int frame = UNSET_INT;
   convertToDisplayIdx(seqStart, properties->horizontal, dc, 1, &frame);
-  
+
   int offset = reqdFrame - frame;
   if (offset < 0)
     {
@@ -1024,7 +1025,7 @@ static int getSequenceStart(SequenceProperties *properties, DotterContext *dc, c
 }
 
 
-/* Get the end coord of the bit of sequence displayed by a given 
+/* Get the end coord of the bit of sequence displayed by a given
  * sequence widget. Adjusts the end so that we have the correct
  * coord for the relevant frame/strand. Converts to display coords
  * if requested, otherwise returns the nucleotide coord. */
@@ -1036,12 +1037,12 @@ static int getSequenceEnd(SequenceProperties *properties, DotterContext *dc, con
 
   /* Get the end coord of the sequence data */
   int seqEnd = forward ? properties->fullRange->max() : properties->fullRange->min();
-  
+
   /* Offset this coord so that we have the last coord that ends our reading frame */
   int reqdFrame = properties->frame;
   int frame = UNSET_INT;
   convertToDisplayIdx(seqEnd, properties->horizontal, dc, dc->numFrames, &frame);
-  
+
   int offset = reqdFrame - frame;
   seqEnd = forward ? seqEnd + offset : seqEnd - offset;
 
@@ -1052,16 +1053,16 @@ static int getSequenceEnd(SequenceProperties *properties, DotterContext *dc, con
 }
 
 
-/* Calculate how many bases into the alignment tool's display range the 
+/* Calculate how many bases into the alignment tool's display range the
  * given sequence starts. */
 static int getSequenceOffset(SequenceProperties *properties, DotterContext *dc)
 {
   int result = 0;
-  
+
   g_return_val_if_fail(properties && dc, result) ;
 
   const int seqStart = getSequenceStart(properties, dc, TRUE);
-  
+
   /* Calculate the offset. Note that this may be positive or negative because it
    * can be in either direction. */
   const int displayStart = getDisplayStart(properties, dc);
@@ -1101,7 +1102,7 @@ static int getCoordAtPos(const int x, GtkWidget *sequenceWidget, GtkWidget *alig
 
   /* Bounds-limit the result */
   boundsLimitValue(&coord, &properties->fullRangeDisplayCoords);
-  
+
   return coord;
 }
 
@@ -1115,7 +1116,7 @@ static void connectSequenceSignals(GtkWidget *widget, GtkWidget *alignmentTool)
   gtk_widget_add_events(widget, GDK_BUTTON_PRESS_MASK);
   gtk_widget_add_events(widget, GDK_BUTTON_RELEASE_MASK);
   gtk_widget_add_events(widget, GDK_BUTTON_MOTION_MASK);
-  
+
   g_signal_connect(G_OBJECT(widget), "expose-event", G_CALLBACK(onExposeSequence), alignmentTool);
   g_signal_connect(G_OBJECT(widget), "button-press-event", G_CALLBACK(onButtonPressSequence), alignmentTool);
   g_signal_connect(G_OBJECT(widget), "button-release-event", G_CALLBACK(onButtonReleaseSequence), alignmentTool);
@@ -1141,15 +1142,15 @@ static char *getSequenceBetweenCoords(GtkWidget *sequenceWidget,
   /* Get the 0-based index into the bit of sequence for this frame/strand */
   int startIdx = 0;
   const int seqStart = getSequenceStart(properties, dc, TRUE);
-  
+
   if (properties->strand == BLXSTRAND_REVERSE)
     startIdx = seqStart - endCoord;
   else
     startIdx = startCoord - seqStart;
-  
+
   /* Get the length of sequence we want to show */
   int numChars = endCoord - startCoord + 1;
-  
+
   /* Sanity check that we're not going to try to index out of range */
   if (startIdx + numChars > (int)strlen(properties->sequence))
     {
@@ -1157,7 +1158,7 @@ static char *getSequenceBetweenCoords(GtkWidget *sequenceWidget,
        * it to the string length should give something sensible */
       numChars = strlen(properties->sequence) - startIdx;
     }
-  
+
   result = g_strndup(properties->sequence + startIdx, numChars + 1);
   result[numChars] = '\0';
 
@@ -1169,7 +1170,7 @@ static char *getSequenceBetweenCoords(GtkWidget *sequenceWidget,
 static void setSelectionWidget(AlignmentToolProperties *atProperties, GtkWidget *selectionWidget)
 {
   g_return_if_fail(atProperties) ;
-  
+
   atProperties->selectionWidget = selectionWidget;
   dotterEnableSelectionMenus(atProperties->dotterWinCtx, selectionWidget != NULL);
 }
@@ -1197,7 +1198,7 @@ void alignmentToolCopySeln(GtkWidget* alignmentTool)
   AlignmentToolProperties *atProperties = alignmentToolGetProperties(alignmentTool);
 
   g_return_if_fail(atProperties) ;
-  
+
   if (atProperties->selectionWidget)
     {
       /* copy the selection to the clipboard */
@@ -1208,7 +1209,7 @@ void alignmentToolCopySeln(GtkWidget* alignmentTool)
 
       setDefaultClipboardText(text);
       setPrimaryClipboardText(text);
-      
+
       g_free(text);
     }
 }
@@ -1222,7 +1223,7 @@ void alignmentToolCopySelnCoords(GtkWidget *alignmentTool)
   if (atProperties->selectionWidget)
     {
       SequenceProperties *properties = sequenceGetProperties(atProperties->selectionWidget);
-      
+
       if (properties)
         {
           DotterContext *dc = atProperties->dotterWinCtx->dotterCtx;
@@ -1241,13 +1242,13 @@ void alignmentToolCopySelnCoords(GtkWidget *alignmentTool)
               int tmp = start;
               start = end;
               end = tmp;
-            }    
+            }
 
           char *text = g_strdup_printf("%d, %d", start, end);
-          
+
           setDefaultClipboardText(text);
           setPrimaryClipboardText(text);
-      
+
           g_free(text);
         }
     }
@@ -1258,7 +1259,7 @@ static void sequenceInitiateDragging(GtkWidget *sequenceWidget, GtkWidget *align
 {
   AlignmentToolProperties *atProperties = alignmentToolGetProperties(alignmentTool);
 
-  g_return_if_fail(atProperties) ;  
+  g_return_if_fail(atProperties) ;
 
   /* flag that we're dragging */
   atProperties->dragging = TRUE;
@@ -1266,7 +1267,7 @@ static void sequenceInitiateDragging(GtkWidget *sequenceWidget, GtkWidget *align
 
   /* flag that we should highlight the selected sequence (clear any current selection first) */
   alignmentToolClearSequenceSelection(alignmentTool);
-  
+
   atProperties->selectionRange.set(atProperties->dragStart, atProperties->dragStart);
 
   setSelectionWidget(atProperties, sequenceWidget);
@@ -1285,7 +1286,7 @@ static void sequenceFinishDragging(GtkWidget *sequenceWidget, GtkWidget *alignme
     {
       /* cancel the dragging and highlighting flags */
       atProperties->dragging = FALSE;
-  
+
       /* get the range of coords that the user dragged over */
       int minCoord = atProperties->dragStart;
       int maxCoord = getCoordAtPos(x, sequenceWidget, alignmentTool);
@@ -1296,11 +1297,11 @@ static void sequenceFinishDragging(GtkWidget *sequenceWidget, GtkWidget *alignme
           minCoord = maxCoord;
           maxCoord = tmp;
         }
-      
+
       /* Get the sequence between these coords and place it on the clipboard */
       char *result = getSequenceBetweenCoords(sequenceWidget, minCoord, maxCoord, dwc);
       setPrimaryClipboardText(result);
-      
+
       g_free(result);
     }
 }
@@ -1315,7 +1316,7 @@ static void selectVisibleSequence(GtkWidget *sequenceWidget, GtkWidget *alignmen
   g_return_if_fail(properties && atProperties && atProperties->dotterWinCtx && atProperties->dotterWinCtx->dotterCtx) ;
 
   DotterContext *dc = atProperties->dotterWinCtx->dotterCtx;
-  
+
   /* cancel any dragging operation */
   atProperties->dragging = FALSE;
 
@@ -1331,10 +1332,10 @@ static void selectVisibleSequence(GtkWidget *sequenceWidget, GtkWidget *alignmen
       ++start;
       ++end;
     }
-  
+
   boundsLimitValue(&start, &properties->fullRangeDisplayCoords);
   boundsLimitValue(&end, &properties->fullRangeDisplayCoords);
-  
+
   atProperties->selectionRange.set(start, end);
   setSelectionWidget(atProperties, sequenceWidget);
 
@@ -1343,7 +1344,7 @@ static void selectVisibleSequence(GtkWidget *sequenceWidget, GtkWidget *alignmen
                                           atProperties->selectionRange.min(),
                                           atProperties->selectionRange.max(),
                                           atProperties->dotterWinCtx);
-  
+
   setPrimaryClipboardText(result);
   g_free(result);
 }
@@ -1365,9 +1366,9 @@ static DotterColorId getBaseHighlightColor(SequenceProperties *seq1,
    * any match. Exact matches take precedence over conserved matches.
    * If none match, just use the background colour (i.e. no highlighting). */
   DotterColorId colorId = DOTCOLOR_BACKGROUND;
- 
+
   GSList *item = seq1->compSeqs;
- 
+
   for ( ; item; item = item->next)
     {
       /* Get info about the other sequence */
@@ -1380,10 +1381,10 @@ static DotterColorId getBaseHighlightColor(SequenceProperties *seq1,
 
           /* Get the sequence coord at the start of the display (leftmost edge) */
           const int seq2Offset = getSequenceOffset(seq2, dc);
-    
+
           /* Get the zero-based index into the sequence and compare the bases to determine the highlight color */
           const int seq2Idx = displayIdx - seq2Offset;
-      
+
           if (seq2Idx >= 0 && seq2Idx < seq2Len)
             {
               if (seq1->sequence[seq1Idx] == seq2->sequence[seq2Idx])
@@ -1391,7 +1392,7 @@ static DotterColorId getBaseHighlightColor(SequenceProperties *seq1,
                   colorId = DOTCOLOR_MATCH;
                   break;
                 }
-              else if (dc->blastMode != BLXMODE_BLASTN && 
+              else if (dc->blastMode != BLXMODE_BLASTN &&
                        dc->matrix[atob[(unsigned int)seq1->sequence[seq1Idx]] - 1 ][atob[(unsigned int)seq2->sequence[seq2Idx]] - 1 ] > 0)
                 {
                   colorId = DOTCOLOR_CONS;
@@ -1413,7 +1414,7 @@ static void highlightSpliceSite(SequenceProperties *seq1,
                                 GdkDrawable *drawable)
 {
   g_return_if_fail(seq1 && atProperties && dwc && dwc->dotterCtx && gc && drawable) ;
-  
+
   DotterContext *dc = dwc->dotterCtx;
 
   /* check if it's canonical (green if yes, red if not) */
@@ -1425,7 +1426,7 @@ static void highlightSpliceSite(SequenceProperties *seq1,
     colorId = DOTCOLOR_CANONICAL;
   else if (!isStart && strncasecmp(&seq1->sequence[seqIdx], "gt", 2) == 0)
     colorId = DOTCOLOR_CANONICAL;
- 
+
   GdkColor *color = getGdkColor(colorId, dc->defaultColors, FALSE, dwc->usePrintColors);
   gdk_gc_set_foreground(gc, color);
 
@@ -1454,7 +1455,7 @@ static void highlightSequenceBase(SequenceProperties *seq1,
   int seq1Coord = (seq1->strand == BLXSTRAND_REVERSE ? seq1Start - displayIdx : seq1Start + displayIdx + 1);
 
   const gboolean selected = highlight && valueWithinRange(seq1Coord, &atProperties->selectionRange);
-  
+
   /* We don't need to bother drawing the background if it's the standard
    * (non-selected) background color */
   if (colorId != DOTCOLOR_BACKGROUND || selected)
@@ -1466,4 +1467,3 @@ static void highlightSequenceBase(SequenceProperties *seq1,
       gdk_draw_rectangle(drawable, gc, TRUE, x, 0, ceil(dc->charWidth), roundNearest(dc->charHeight));
     }
 }
-
diff --git a/src/dotterApp/dotplot.cpp b/src/dotterApp/dotplot.cpp
index 470156d2e8fa0cd2a788993849ff83456de6ea37..d1b5b0e82b62b506b540309f1ea34733588441ae 100644
--- a/src/dotterApp/dotplot.cpp
+++ b/src/dotterApp/dotplot.cpp
@@ -1,5 +1,6 @@
 /*  File: dotplot.c
  *  Author: Gemma Barson, 2010-09-08
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -48,13 +49,13 @@ using namespace std;
 
 #define PIXELS_PER_MARK_X                           100   /* number of pixels between each major tick mark on the x scale */
 #define PIXELS_PER_MARK_Y                           50    /* number of pixels between each major tick mark on the y scale */
-#define CROSSHAIR_TEXT_PADDING                      5     /* padding between the crosshair and the coord display text */ 
+#define CROSSHAIR_TEXT_PADDING                      5     /* padding between the crosshair and the coord display text */
 #define ANNOTATION_LABEL_PADDING		    5	  /* padding around annotation labels, if shown */
 
-/* max width / height to allow for a gdk image. Guesstimate based on the fact that 
+/* max width / height to allow for a gdk image. Guesstimate based on the fact that
  * it blacks out the lower part of the plot (overdraws on it?) if we allow more than this.
  * gb10: this was 16000 but reducing it because some users are seeing crashing with long, skinny plots. */
-#define MAX_IMAGE_DIMENSION                         12000 
+#define MAX_IMAGE_DIMENSION                         12000
 
 
 int atob_0[]	/* NEW (starting at 0) ASCII-to-binary translation table */
@@ -75,7 +76,7 @@ NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,
 NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,
 NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,
 NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,
-NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR 
+NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR
 };
 
 //static int atob[]	/* OLD (starting at 1) ASCII-to-binary translation table  (Inherited from blast) */
@@ -96,7 +97,7 @@ NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR,NR
 //NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
 //NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
 //NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
-//NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA 
+//NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
 //};
 
 char aa_btoa[]	/* binary-to-ASCII translation table */
@@ -195,7 +196,7 @@ DotplotProperties* dotplotGetProperties(GtkWidget *widget)
 static void onDestroyDotplot(GtkWidget *widget)
 {
   DotplotProperties *properties = dotplotGetProperties(widget);
-  
+
   if (properties)
     {
       if (properties->pixelmap)
@@ -215,7 +216,7 @@ static void onDestroyDotplot(GtkWidget *widget)
         gdk_image_unref(properties->image);
         properties->image = NULL;
       }
-    
+
       delete properties;
       properties = NULL;
       g_object_set_data(G_OBJECT(widget), "DotplotProperties", NULL);
@@ -239,18 +240,18 @@ static DotplotProperties* dotplotCreateProperties(GtkWidget *widget,
   properties->hozExons2 = NULL;
   properties->vertExons1 = NULL;
   properties->vertExons2 = NULL;
-  
+
   properties->plotRect.x = 0;
   properties->plotRect.y = 0;
   properties->plotRect.width = 0;
   properties->plotRect.height = 0;
-  
+
   if (widget) /* only create colormap if we have a widget (i.e. we're not in batch/non-graphical mode) */
     {
       properties->colorMap = insertGreyRamp(properties);
       gtk_widget_set_default_colormap(properties->colorMap);
     }
-  
+
   properties->image = NULL;
 
   properties->pixelmap = NULL;
@@ -262,7 +263,7 @@ static DotplotProperties* dotplotCreateProperties(GtkWidget *widget,
 
   properties->pixelmapOn = !hspsOn;
   properties->hspMode = hspsOn ? DOTTER_HSPS_LINE : DOTTER_HSPS_OFF;
-  
+
   properties->gridlinesOn = FALSE;
   properties->breaklinesOn = breaklinesOn;
   properties->hozLabelsOn = TRUE;
@@ -272,15 +273,15 @@ static DotplotProperties* dotplotCreateProperties(GtkWidget *widget,
   properties->dragStart.y = UNSET_INT;
   properties->dragEnd.x = UNSET_INT;
   properties->dragEnd.y = UNSET_INT;
-      
+
   properties->exportFileName = exportFileName;
 
   if (widget)
     {
       g_object_set_data(G_OBJECT(widget), "DotplotProperties", properties);
-      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyDotplot), NULL); 
+      g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyDotplot), NULL);
     }
-  
+
   properties->hozScale.basesPerMark = 0;
   properties->hozScale.basesPerSubmark = 0;
   properties->hozScale.numMarks = 0;
@@ -310,7 +311,7 @@ DotterHspMode dotplotGetHspMode(GtkWidget *dotplot)
   DEBUG_ENTER("dotplotGetHspMode");
 
   DotplotProperties *properties = dotplotGetProperties(dotplot);
-  
+
   DEBUG_EXIT("dotplotGetHspMode returning ");
   return properties->hspMode;
 }
@@ -325,7 +326,7 @@ gboolean dotplotSetSlidingWinSize(GtkWidget *dotplot, const int newValue, GError
 {
   gboolean changed = FALSE;
   DotplotProperties *properties = dotplotGetProperties(dotplot);
-  
+
   if (newValue <= 0)
     {
       g_set_error(error, DOTTER_ERROR, DOTTER_ERROR_INVALID_WIN_SIZE, "Sliding window size must be greater than 0.\n");
@@ -335,7 +336,7 @@ gboolean dotplotSetSlidingWinSize(GtkWidget *dotplot, const int newValue, GError
       properties->slidingWinSize = newValue;
       changed = TRUE;
     }
-  
+
   return changed;
 }
 
@@ -416,16 +417,16 @@ static void initPixmap(unsigned char **pixmap, const int width, const int height
 
   if (*pixmap)
     g_free(*pixmap);
-  
+
   const int pixelmapLen = width  * height;
   *pixmap = (unsigned char *)g_malloc(sizeof(unsigned char*) * pixelmapLen);
-  
+
   int i = 0;
   for (i=0; i < pixelmapLen; i++)
     {
       (*pixmap)[i] = 0;
     }
-  
+
   DEBUG_EXIT("initPixmap returning ");
 }
 
@@ -434,9 +435,9 @@ static void initPixmap(unsigned char **pixmap, const int width, const int height
 static void resetPixmapBackground(unsigned char *pixmap, DotplotProperties *properties)
 {
   const int pixelmapLen = properties->image->width * properties->image->height;
-  
+
   int i = 0;
-  for (i = 0; i < pixelmapLen; i++) 
+  for (i = 0; i < pixelmapLen; i++)
     {
       pixmap[i] = 0;
     }
@@ -448,9 +449,9 @@ void setHspMode(GtkWidget *dotplot, DotterHspMode hspMode)
 {
   DotplotProperties *properties = dotplotGetProperties(dotplot);
   DotterContext *dc = properties->dotterWinCtx->dotterCtx;
-  
+
   properties->hspMode = hspMode;
-  
+
   if (properties->hspMode)
     {
       if (!properties->hspPixmap)
@@ -458,13 +459,13 @@ void setHspMode(GtkWidget *dotplot, DotterHspMode hspMode)
           /* The HSP pixelmap doesn't exist yet so create it */
           initPixmap(&properties->hspPixmap, properties->image->width, properties->image->height);
         }
-      
+
       /* For greyscale mode, loop through all match MSPs and set the pixel strength */
-      if (properties->hspMode == DOTTER_HSPS_GREYSCALE) 
+      if (properties->hspMode == DOTTER_HSPS_GREYSCALE)
         {
           resetPixmapBackground(properties->hspPixmap, properties);
           MSP *msp = dc->mspList;
-          
+
           for ( ; msp; msp = msp->next)
             {
               const char *mspName = getShortMspName(msp);
@@ -473,15 +474,15 @@ void setHspMode(GtkWidget *dotplot, DotterHspMode hspMode)
                   /* Not an MSP from our match sequence */
                   continue;
                 }
-              
+
               int sx, ex, sy, ey;
               getMspScreenCoords(msp, properties, &sx, &ex, &sy, &ey);
-              
+
               /* Draw as greyscale pixmap */
               const int strength = (int)msp->score;
               calculateImageHsps(strength, sx, sy, ex, ey, properties);
             }
-          
+
           /* Overwrite the image with the HSP pixmap */
           transformGreyRampImage(properties->image, properties->hspPixmap, properties);
         }
@@ -491,17 +492,17 @@ void setHspMode(GtkWidget *dotplot, DotterHspMode hspMode)
     {
       /* Make sure the dot-plot pixmap is set (we may have overwritten it if the previous mode
        * was HSP_GREYSCALE). */
-      
+
       if (!properties->pixelmap)
         {
           /* The dot-plot pixelmap doesn't exist yet so create it */
           initPixmap(&properties->pixelmap, properties->image->width, properties->image->height);
           calculateImage(properties);
         }
-      
+
       transformGreyRampImage(properties->image, properties->pixelmap, properties);
     }
-  
+
   widgetClearCachedDrawable(dotplot, NULL);
   gtk_widget_queue_draw(dotplot);
 }
@@ -523,21 +524,21 @@ void dotplotTogglePixelmap(GtkWidget *dotplot)
 {
   DotplotProperties *properties = dotplotGetProperties(dotplot);
   properties->pixelmapOn = !properties->pixelmapOn;
-  
+
   if (!properties->pixelmap)
     {
       /* The dot-plot pixelmap doesn't exist yet so create it */
       initPixmap(&properties->pixelmap, properties->image->width, properties->image->height);
       calculateImage(properties);
     }
-  
+
   if (properties->hspMode != DOTTER_HSPS_GREYSCALE)
     {
       /* Make sure the image has the dot-plot pixels, not the HSP pixels, which might previously
        * have overwritten it */
       transformGreyRampImage(properties->image, properties->pixelmap, properties);
     }
-  
+
   widgetClearCachedDrawable(dotplot, NULL);
   gtk_widget_queue_draw(dotplot);
 }
@@ -548,12 +549,12 @@ void toggleCrosshairOn(GtkWidget *dotplot)
 {
   DotplotProperties *properties = dotplotGetProperties(dotplot);
   properties->crosshairOn = !properties->crosshairOn;
-  
+
   exonViewSetShowCrosshair(properties->hozExons1, properties->crosshairOn && properties->crosshairFullscreen);
   exonViewSetShowCrosshair(properties->hozExons2, properties->crosshairOn && properties->crosshairFullscreen);
   exonViewSetShowCrosshair(properties->vertExons1, properties->crosshairOn && properties->crosshairFullscreen);
   exonViewSetShowCrosshair(properties->vertExons2, properties->crosshairOn && properties->crosshairFullscreen);
-  
+
   refreshDotplot(dotplot);
 }
 
@@ -568,7 +569,7 @@ void toggleCrosshairFullscreen(GtkWidget *dotplot)
 {
   DotplotProperties *properties = dotplotGetProperties(dotplot);
   properties->crosshairFullscreen = !properties->crosshairFullscreen;
-  
+
   exonViewSetShowCrosshair(properties->hozExons1, properties->crosshairOn && properties->crosshairFullscreen);
   exonViewSetShowCrosshair(properties->hozExons2, properties->crosshairOn && properties->crosshairFullscreen);
   exonViewSetShowCrosshair(properties->vertExons1, properties->crosshairOn && properties->crosshairFullscreen);
@@ -603,14 +604,14 @@ static gboolean onExposeDotplot(GtkWidget *dotplot, GdkEventExpose *event, gpoin
           bitmap = createBlankPixmap(dotplot);
           drawDotplot(dotplot, bitmap);
         }
-      
+
       if (bitmap)
         {
           /* Push the bitmap onto the window */
           GdkGC *gc = gdk_gc_new(window);
           gdk_draw_drawable(window, gc, bitmap, 0, 0, 0, 0, -1, -1);
           g_object_unref(gc);
-          
+
           /* Draw anything else that needs to be refreshed on each expose */
           dotplotDrawCrosshair(dotplot, window);
           drawRubberBand(dotplot, window);
@@ -619,14 +620,14 @@ static gboolean onExposeDotplot(GtkWidget *dotplot, GdkEventExpose *event, gpoin
 
   if (properties->exportFileName)
     {
-      /* We're in batch mode and have been asked to export the plot to pdf; print it, 
+      /* We're in batch mode and have been asked to export the plot to pdf; print it,
       * and then quit */
       GError *error = NULL;
       exportPlot(dotplot, GTK_WINDOW(gtk_widget_get_toplevel(dotplot)), properties->exportFileName, &error);
       gtk_main_quit();
     }
 
-  
+
   return TRUE;
 }
 
@@ -634,7 +635,7 @@ static gboolean onExposeDotplot(GtkWidget *dotplot, GdkEventExpose *event, gpoin
 static gboolean onButtonPressDotplot(GtkWidget *dotplot, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->type == GDK_BUTTON_PRESS && event->button == 1) /* left click */
     {
       setCoordsFromPos(dotplot, event->x, event->y);
@@ -647,7 +648,7 @@ static gboolean onButtonPressDotplot(GtkWidget *dotplot, GdkEventButton *event,
       setPoint(&properties->dragStart, event->x, event->y, &properties->plotRect);
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -656,18 +657,18 @@ static gboolean onButtonPressDotplot(GtkWidget *dotplot, GdkEventButton *event,
 static gboolean onButtonReleaseDotplot(GtkWidget *dotplot, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->type == GDK_BUTTON_RELEASE && event->button == 2) /* middle click */
     {
       /* Call dotter on the selected region */
       DotplotProperties *properties = dotplotGetProperties(dotplot);
       DotterContext *dc = properties->dotterWinCtx->dotterCtx;
-      
+
       if (properties->dragStart.x != UNSET_INT && properties->dragEnd.x != UNSET_INT)
         {
           /* Get the sequence coords for the start and end of the drag rectangle. */
-	  const gdouble zoomFactor = 0; 
-	
+	  const gdouble zoomFactor = 0;
+
 	  int qStart, qEnd, sStart, sEnd;
 	  getCoordsFromPos(dotplot, properties->dragStart.x, properties->dragStart.y, &qStart, &sStart);
 	  getCoordsFromPos(dotplot, properties->dragEnd.x, properties->dragEnd.y, &qEnd, &sEnd);
@@ -675,7 +676,7 @@ static gboolean onButtonReleaseDotplot(GtkWidget *dotplot, GdkEventButton *event
 	  IntRange qRange, sRange;
 	  qRange.set(qStart, qEnd);
 	  sRange.set(sStart, sEnd);
-	
+
           /* Ignore small mouse moves as they are likely to be accidental or cancelled clicks */
           if (qRange.max() - qRange.min() > 10 && sRange.max() - sRange.min() > 10)
             {
@@ -683,15 +684,15 @@ static gboolean onButtonReleaseDotplot(GtkWidget *dotplot, GdkEventButton *event
               callDotterInternal(dc, &qRange, &sRange, zoomFactor, properties->breaklinesOn) ;
             }
         }
-      
+
       /* Clear drag */
       setPoint(&properties->dragStart, UNSET_INT, UNSET_INT, NULL);
       setPoint(&properties->dragEnd, UNSET_INT, UNSET_INT, NULL);
-      
+
       gtk_widget_queue_draw(dotplot);
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -700,7 +701,7 @@ static gboolean onButtonReleaseDotplot(GtkWidget *dotplot, GdkEventButton *event
 static gboolean onMouseMoveDotplot(GtkWidget *dotplot, GdkEventMotion *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->state & GDK_BUTTON1_MASK)  /* left-drag */
     {
       setCoordsFromPos(dotplot, event->x, event->y);
@@ -713,7 +714,7 @@ static gboolean onMouseMoveDotplot(GtkWidget *dotplot, GdkEventMotion *event, gp
       gtk_widget_queue_draw(dotplot);
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -729,11 +730,11 @@ static int getImageDimension(DotplotProperties *properties, const gboolean horiz
 
   DotterWindowContext *dwc = properties->dotterWinCtx;
   DotterContext *dc = properties->dotterWinCtx->dotterCtx;
-  
+
   const IntRange* const seqRange = horizontal ? &dwc->refSeqRange : &dwc->matchSeqRange;
   const int seqLen = seqRange->length();
   DEBUG_OUT("Sequence length = %d\n", seqLen);
-  
+
   int imageLen = (int)ceil((double)seqLen / getScaleFactor(properties, horizontal));
   DEBUG_OUT("Image length = %d\n", imageLen);
 
@@ -741,10 +742,10 @@ static int getImageDimension(DotplotProperties *properties, const gboolean horiz
     {
       g_critical("seqLen/resfac > imageLen * zoom (%d > %d (%d*%f))", seqLen / dc->numFrames, (int)(imageLen * dwc->zoomFactor), imageLen, dwc->zoomFactor);
     }
-  
+
   DEBUG_EXIT("getImageDimension returning ");
   return imageLen;
-}  
+}
 
 
 /* Set the coords for the initial crosshair position. Use the given coords if in range, or
@@ -759,7 +760,7 @@ static void initCrosshairCoords(const int qcenter, const int scenter, DotterWind
     {
       dwc->refCoord = dwc->refSeqRange.centre();
     }
-  
+
   if (valueWithinRange(qcenter, &dwc->matchSeqRange))
     {
       dwc->matchCoord = qcenter;
@@ -786,11 +787,11 @@ static GdkImage* createImage(DotplotProperties *properties)
       dwc->zoomFactor = ceil((double)origLen / (double)properties->imageWidth); /* adjust zoom so we can still show the original range */
 
       properties->imageWidth = getImageDimension(properties, TRUE);   /* rounds the new value to the nearest 4 etc. */
-      properties->imageHeight = getImageDimension(properties, FALSE); 
+      properties->imageHeight = getImageDimension(properties, FALSE);
 
       g_warning("Image too wide - setting zoom to %d\n", (int)dwc->zoomFactor);
     }
-  
+
   if (properties->imageHeight > MAX_IMAGE_DIMENSION)
     {
       int origLen = properties->imageHeight * dwc->zoomFactor;
@@ -812,7 +813,7 @@ static GdkImage* createImage(DotplotProperties *properties)
 
 
 /* Create the actual drawing area for the dotplot */
-static GtkWidget* createDotplotDrawingArea(DotterWindowContext *dwc, 
+static GtkWidget* createDotplotDrawingArea(DotterWindowContext *dwc,
                                            const char *loadFileName,
                                            const char *saveFileName,
                                            const DotterSaveFormatType saveFormat,
@@ -833,26 +834,26 @@ static GtkWidget* createDotplotDrawingArea(DotterWindowContext *dwc,
   gboolean showPlot = (exportFileName || !batch);
 
   GtkWidget *dotplot = (showPlot ? gtk_layout_new(NULL, NULL) : NULL);
-  
+
   DotplotProperties *properties = dotplotCreateProperties(dotplot, dwc, hspsOn, breaklinesOn, exportFileName);
-  
+
   if (loadFileName)
     {
       /* Load existing dotplot file (initialises and populates the pixmap) */
       GError *error = NULL;
       loadPlot(dotplot, loadFileName, &error);
-      
+
       prefixError(error, "Error loading dot plot. ");
       reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
     }
-  else 
+  else
     {
       initWindow(initWinsize, properties);
-      
-      /* Set pixelFac so that expResScore is at 1/5 of the range. 
+
+      /* Set pixelFac so that expResScore is at 1/5 of the range.
        * This positions expResScore at 51.2 */
       properties->pixelFac = pixelFacIn ? pixelFacIn : 0.2 * NUM_COLORS / properties->expResScore;
-      
+
       /* Calculate the image size */
       properties->imageWidth = getImageDimension(properties, TRUE);
       properties->imageHeight = getImageDimension(properties, FALSE);
@@ -862,9 +863,9 @@ static GtkWidget* createDotplotDrawingArea(DotterWindowContext *dwc,
         properties->image = createImage(properties);
 
       DEBUG_OUT("Set image w=%d, h=%d\n", properties->imageWidth, properties->imageHeight);
-      
+
       unsigned char **pixmap = NULL; /* which pixelmap we're displaying at the start */
-      
+
       if (properties->hspMode == DOTTER_HSPS_GREYSCALE)
         {
           pixmap = &properties->hspPixmap;
@@ -876,19 +877,19 @@ static GtkWidget* createDotplotDrawingArea(DotterWindowContext *dwc,
           initPixmap(pixmap, properties->imageWidth, properties->imageHeight);
           calculateImage(properties);
         }
-      
+
       /* Push the pixelmap to the GdkImage */
       if (showPlot && pixmap)
         transformGreyRampImage(properties->image, *pixmap, properties);
     }
-  
+
   if (saveFileName)
     {
       /* Batch mode: save the dot matrix;  */
       GError *error = NULL;
 
       savePlot(dotplot, properties, saveFileName, saveFormat, &error);
-      
+
       prefixError(error, "Error saving dot plot. ");
       reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
     }
@@ -902,7 +903,7 @@ static GtkWidget* createDotplotDrawingArea(DotterWindowContext *dwc,
       /* Calculate the size of the dot-plot */
       calculateDotplotBorders(dotplot, properties);
     }
-  
+
   DEBUG_EXIT("createDotplotDrawingArea returning ");
   return dotplot;
 }
@@ -910,7 +911,7 @@ static GtkWidget* createDotplotDrawingArea(DotterWindowContext *dwc,
 
 /* Put all the dotplot and exon widgets in a table. The table gets put in a
  * scrolled window and the scrolled window is returned. */
-static GtkWidget* createDotplotTable(GtkWidget *dotplotCont, 
+static GtkWidget* createDotplotTable(GtkWidget *dotplotCont,
                                      GtkWidget *hozExons1,
                                      GtkWidget *hozExons2,
                                      GtkWidget *vertExons1,
@@ -920,20 +921,20 @@ static GtkWidget* createDotplotTable(GtkWidget *dotplotCont,
   const int ypad = 0;
   const int numRows = 4;
   const int numCols = 4;
-  
+
   GtkTable *table = GTK_TABLE(gtk_table_new(numRows, numCols, FALSE));
-  
+
   gtk_table_attach(table, dotplotCont, 1, 2, 1, 2, GTK_FILL, GTK_FILL, xpad, ypad);
   gtk_table_attach(table, vertExons1, 2, 3, 1, 2, GTK_FILL, GTK_FILL, xpad, ypad);
   gtk_table_attach(table, vertExons2, 3, 4, 1, 2, GTK_FILL, GTK_FILL, xpad, ypad);
   gtk_table_attach(table, hozExons1, 1, 2, 2, 3, GTK_FILL, GTK_FILL, xpad, ypad);
   gtk_table_attach(table, hozExons2, 1, 2, 3, 4, GTK_FILL, GTK_FILL, xpad, ypad);
-  
+
   /* Put the table in a scrolled window with a horizontal scrollbar */
   GtkWidget *scrollWin = gtk_scrolled_window_new(NULL, NULL);
   gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollWin), GTK_WIDGET(table));
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollWin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-  
+
   return GTK_WIDGET(scrollWin);
 }
 
@@ -946,8 +947,8 @@ static BlxStrand getOppositeStrand(BlxStrand strand)
 
 
 /* Create the exons view widgets for dotter */
-static void createDotterExonViews(GtkWidget *dotplot, 
-                                  DotterWindowContext *dwc, 
+static void createDotterExonViews(GtkWidget *dotplot,
+                                  DotterWindowContext *dwc,
                                   GtkWidget **hozExons1,
                                   GtkWidget **hozExons2,
                                   GtkWidget **vertExons1,
@@ -958,47 +959,47 @@ static void createDotterExonViews(GtkWidget *dotplot,
   const gboolean showCrosshair = properties->crosshairOn && properties->crosshairFullscreen;
 
   /* The strand that was passed to dotter is the main strand, so show that first */
-  *hozExons1 = createDotterExonView(dotplot, 
+  *hozExons1 = createDotterExonView(dotplot,
                                     NULL,
                                     TRUE,
-                                    dc->refSeqStrand, 
-                                    dwc, 
+                                    dc->refSeqStrand,
+                                    dwc,
                                     properties->imageWidth,
                                     properties->imageHeight,
-                                    &dwc->refSeqRange, 
+                                    &dwc->refSeqRange,
                                     showCrosshair,
                                     &properties->hozExons1);
-  
-  *hozExons2 = createDotterExonView(dotplot, 
+
+  *hozExons2 = createDotterExonView(dotplot,
                                     NULL,
                                     TRUE,
-                                    getOppositeStrand(dc->refSeqStrand), 
-                                    dwc, 
-                                    properties->imageWidth, 
+                                    getOppositeStrand(dc->refSeqStrand),
+                                    dwc,
+                                    properties->imageWidth,
                                     properties->imageHeight,
-                                    &dwc->refSeqRange, 
-                                    showCrosshair, 
+                                    &dwc->refSeqRange,
+                                    showCrosshair,
                                     &properties->hozExons2);
-  
-  *vertExons1 = createDotterExonView(dotplot, 
-                                     NULL, 
+
+  *vertExons1 = createDotterExonView(dotplot,
+                                     NULL,
                                      FALSE,
-                                     dc->matchSeqStrand, 
-                                     dwc, 
+                                     dc->matchSeqStrand,
+                                     dwc,
                                      properties->imageWidth,
                                      properties->imageHeight,
                                      &dwc->matchSeqRange,
                                      showCrosshair,
                                      &properties->vertExons1);
 
-  *vertExons2 = createDotterExonView(dotplot, 
-                                     NULL, 
+  *vertExons2 = createDotterExonView(dotplot,
+                                     NULL,
                                      FALSE,
                                      getOppositeStrand(dc->matchSeqStrand),
-                                     dwc, 
-                                     properties->imageWidth, 
+                                     dwc,
+                                     properties->imageWidth,
                                      properties->imageHeight,
-                                     &dwc->matchSeqRange, 
+                                     &dwc->matchSeqRange,
                                      showCrosshair,
                                      &properties->vertExons2);
 }
@@ -1006,9 +1007,9 @@ static void createDotterExonViews(GtkWidget *dotplot,
 
 /* Create the drawing area for the dot plot. The 'dotplot' output arg is populated with the
  * actual drawing area; the return arg is the overall container widget for the dot plot that will
- * be packed into the dotter window UNLESS we're running in batch mode, in which case the return 
+ * be packed into the dotter window UNLESS we're running in batch mode, in which case the return
  * will be no widgets displayed to the user. */
-GtkWidget* createDotplot(DotterWindowContext *dwc, 
+GtkWidget* createDotplot(DotterWindowContext *dwc,
                          const char *loadFileName,
                          const char *saveFileName,
                          const DotterSaveFormatType saveFormat,
@@ -1046,7 +1047,7 @@ GtkWidget* createDotplot(DotterWindowContext *dwc,
 
   /* Put everything in a table */
   GtkWidget *parent = createDotplotTable(*dotplot, hozExons1, hozExons2, vertExons1, vertExons2);
-  
+
   gtk_widget_add_events(*dotplot, GDK_BUTTON_PRESS_MASK);
   gtk_widget_add_events(*dotplot, GDK_BUTTON_RELEASE_MASK);
   gtk_widget_add_events(*dotplot, GDK_POINTER_MOTION_MASK);
@@ -1068,13 +1069,13 @@ static void clearPixmaps(DotplotProperties *properties)
       gdk_image_unref(properties->image);
       properties->image = NULL;
     }
-  
+
   if (properties->pixelmap)
     {
       g_free(properties->pixelmap);
       properties->pixelmap = NULL;
     }
-  
+
   if (properties->hspPixmap)
     {
       g_free(properties->hspPixmap);
@@ -1094,16 +1095,16 @@ static int getAlphabetSize(const BlxSeqType seqType)
 static void initWindow(const char *winsizeIn, DotplotProperties *properties)
 {
   DotterContext *dc = properties->dotterWinCtx->dotterCtx;
-  
+
   double exp1, exp2, exp3, lambda;
   int win1, win2, win3;
-  
+
   const int alphabetSize = getAlphabetSize(dc->displaySeqType);
-  
+
   /* Call winsizeFromlambdak even if we don't want to set the window
    size in order to get the other parameters (properties->expResScore) */
-  
-  if (dc->blastMode == BLXMODE_BLASTX) 
+
+  if (dc->blastMode == BLXMODE_BLASTX)
     {
       win1 = winsizeFromlambdak(dc->matrix, atob_0, alphabetSize, dc->peptideSeqs[0], dc->matchSeq, &exp1, &lambda);
       win2 = winsizeFromlambdak(dc->matrix, atob_0, alphabetSize, dc->peptideSeqs[1], dc->matchSeq, &exp2, &lambda);
@@ -1119,16 +1120,16 @@ static void initWindow(const char *winsizeIn, DotplotProperties *properties)
     {
       properties->slidingWinSize = winsizeFromlambdak(dc->matrix, atob_0, alphabetSize, dc->refSeq, dc->matchSeq, &properties->expResScore, &lambda);
     }
-  
-  if (!winsizeIn || toupper(*winsizeIn) == 'K') 
+
+  if (!winsizeIn || toupper(*winsizeIn) == 'K')
     {
-      if (properties->slidingWinSize < 3) 
+      if (properties->slidingWinSize < 3)
         {
           g_critical("Karlin/Altschul estimate of window size = %d ignored. Using 10 instead.\n", properties->slidingWinSize);
           properties->slidingWinSize = 10;
         }
-      
-      if (properties->slidingWinSize > 50) 
+
+      if (properties->slidingWinSize > 50)
         {
           g_critical("Karlin/Altschul estimate of window size = %d ignored. Using 50 instead.\n", properties->slidingWinSize);
           properties->slidingWinSize = 50;
@@ -1140,7 +1141,7 @@ static void initWindow(const char *winsizeIn, DotplotProperties *properties)
         {
           g_error("Bad window size specification: %s\n", winsizeIn);
         }
-      
+
       properties->slidingWinSize = atoi(winsizeIn);
     }
 }
@@ -1162,13 +1163,13 @@ static char getHozSeqBase(DotterWindowContext *dwc, const int idx, const int fra
     {
       /* Reverse the sequence if the scale is reversed */
       const int coord = dc->hozScaleRev ? dwc->refSeqRange.max() - idx : dwc->refSeqRange.min() + idx;
-      
+
       /* Complement the sequence if it's the reverse strand */
       const gboolean complement = (dc->refSeqStrand == BLXSTRAND_REVERSE && dc->refSeqType == BLXSEQ_DNA && dc->hozScaleRev);
 
       result = getSequenceIndex(dc->refSeq, coord, complement, &dc->refSeqFullRange, dc->refSeqType);
     }
-  
+
   return result;
 }
 
@@ -1183,7 +1184,7 @@ static char getVertSeqBase(DotterWindowContext *dwc, const int idx)
   const int coord = dc->vertScaleRev ? dwc->matchSeqRange.max() - idx : dwc->matchSeqRange.min() + idx;
 
   const gboolean complement = (dc->matchSeqStrand == BLXSTRAND_REVERSE && dc->refSeqType == BLXSEQ_DNA && dc->vertScaleRev);
-  
+
   return getSequenceIndex(dc->matchSeq, coord, complement, &dc->matchSeqFullRange, dc->matchSeqType);
 }
 
@@ -1192,8 +1193,8 @@ static char getVertSeqBase(DotterWindowContext *dwc, const int idx)
 static void populateMatchSeqBinaryVals(DotterWindowContext *dwc, const int slen, const int translationTable[], int *sIndex)
 {
   int sIdx = 0;
-  
-  for ( ; sIdx < slen; ++sIdx) 
+
+  for ( ; sIdx < slen; ++sIdx)
     {
       const char sBase = getVertSeqBase(dwc, sIdx);
       const int asciiVal = (int)sBase;
@@ -1208,7 +1209,7 @@ static void populateMatchSeqBinaryVals(DotterWindowContext *dwc, const int slen,
 static void createScoreVec(DotterWindowContext *dwc, const int vecLen, const int qlen, BlxHandle *handle, gint32 ***scoreVecPtr)
 {
   DotterContext *dc = dwc->dotterCtx;
-  
+
   *scoreVecPtr = (gint32**)handleAlloc(handle, vecLen * sizeof(int*));
   gint32 **scoreVec = *scoreVecPtr;
 
@@ -1223,7 +1224,7 @@ static void createScoreVec(DotterWindowContext *dwc, const int vecLen, const int
     {
       /* Populate non-protein symbols in scorevector */
       int qIdx = 0;
-      for (qIdx = 0; qIdx < qlen; ++qIdx) 
+      for (qIdx = 0; qIdx < qlen; ++qIdx)
         {
           scoreVec[vecLen - 1][qIdx] = dc->matrix[vecLen - 2][vecLen - 2];
         }
@@ -1234,7 +1235,7 @@ static void createScoreVec(DotterWindowContext *dwc, const int vecLen, const int
 static void populateScoreVec(DotterWindowContext *dwc, const int vecLen, const int qlen, const int frame, const int offset, const int translationTable[], int **scoreVec)
 {
   DotterContext *dc = dwc->dotterCtx;
-  
+
   /* Loop through each row */
   int rowIdx = 0;
   for (rowIdx = 0; rowIdx < vecLen - 1; ++rowIdx)
@@ -1247,7 +1248,7 @@ static void populateScoreVec(DotterWindowContext *dwc, const int vecLen, const i
           const int asciiVal = (int)qBase;
           const int aminoAcidId = translationTable[asciiVal];
           const gint32 score = dc->matrix[rowIdx][aminoAcidId]; /* score of this base in the q seq wrt the current amino acid ID 'i' */
-          
+
           scoreVec[rowIdx][qIdx] = score;
         }
     }
@@ -1258,7 +1259,7 @@ static void populateScoreVec(DotterWindowContext *dwc, const int vecLen, const i
 static int* getTranslationTable(const BlxSeqType seqType, const BlxStrand strand)
 {
   int *result = NULL;
-  
+
   if (seqType == BLXSEQ_PEPTIDE)
     {
       result = atob_0;
@@ -1267,7 +1268,7 @@ static int* getTranslationTable(const BlxSeqType seqType, const BlxStrand strand
     {
       result = (strand == BLXSTRAND_REVERSE ? ntob_compl : ntob);
     }
-     
+
   return result;
 }
 
@@ -1275,10 +1276,10 @@ static int* getTranslationTable(const BlxSeqType seqType, const BlxStrand strand
 static int* getRowToDelete(const int sIdx, const int slen, const int *sIndex, int **scoreVec, int *zero, const int slidingWinSize, const BlxStrand strand)
 {
   int *delrow = NULL;
-  
+
   if (strand == BLXSTRAND_REVERSE)
     {
-      if (sIdx < slen - slidingWinSize) 
+      if (sIdx < slen - slidingWinSize)
         {
           delrow = scoreVec[sIndex[sIdx + slidingWinSize]];
         }
@@ -1289,7 +1290,7 @@ static int* getRowToDelete(const int sIdx, const int slen, const int *sIndex, in
     }
   else
     {
-      if (sIdx >= slidingWinSize) 
+      if (sIdx >= slidingWinSize)
         {
           delrow = scoreVec[sIndex[sIdx - slidingWinSize]];
         }
@@ -1297,16 +1298,16 @@ static int* getRowToDelete(const int sIdx, const int slen, const int *sIndex, in
         {
           delrow = zero;
         }
-    } 
-  
+    }
+
   return delrow;
 }
 
 
 /* This does the work for calculateImage, for a particular strand and reading frame of the reference sequence */
-static void doCalculateImage(const BlxStrand qStrand, 
-                             const int incrementVal, 
-                             const int sStart, 
+static void doCalculateImage(const BlxStrand qStrand,
+                             const int incrementVal,
+                             const int sStart,
                              const int frame,
                              DotterWindowContext *dwc,
                              DotplotProperties *properties,
@@ -1326,46 +1327,46 @@ static void doCalculateImage(const BlxStrand qStrand,
   const int pixelmapLen = properties->imageWidth * properties->imageHeight;
 
   int qIdx, sIdx, qmax, dotpos, dotposq, dotposs;
-  
+
   int *newsum;	/* The current row of scores being calculated */
   int *oldsum;	/* Remembers the previous row of calculated scores */
   int *delrow;	/* Pointer to the row in scoreVec to subtract */
   int *addrow;	/* Pointer to the row in scoreVec to add */
-  
+
   /* Reset the sum vectors */
   int idx = 0;
-  for ( ; idx < pepQSeqLen; ++idx) 
+  for ( ; idx < pepQSeqLen; ++idx)
     {
       sum1[idx] = 0;
       sum2[idx] = 0;
     }
-  
-  /* Get the range of valid calculations (excluding the initial sliding window size, where we don't have enough 
+
+  /* Get the range of valid calculations (excluding the initial sliding window size, where we don't have enough
    * info to calculate the average properly - exclude the winsize at the start if fwd or the end if reverse) */
   IntRange validRange;
   validRange.set(qStrand == BLXSTRAND_REVERSE ? 0 : properties->slidingWinSize,
                  qStrand == BLXSTRAND_REVERSE ? slen - properties->slidingWinSize : slen);
-  
+
   /* Re-populate the score vector for this reading frame */
   populateScoreVec(dwc, vecLen, pepQSeqLen, frame, pepQSeqOffset, getTranslationTable(dc->displaySeqType, qStrand), scoreVec);
-  
+
   /* Loop through each base in the match sequence */
   for (sIdx = sStart ; sIdx >= 0 && sIdx < slen; sIdx += incrementVal)
-    {   
+    {
       /* Set oldsum to the previous row. (newsum will be overwritten, but we re-use the
        * same two vectors (sum1 and sum2) here to save having to keep allocating memory) */
       oldsum = (sIdx & 1) ? sum2 : sum1;
       newsum = (sIdx & 1) ? sum1 : sum2;
-      
+
       delrow = getRowToDelete(sIdx, slen, sIndex, scoreVec, zero, properties->slidingWinSize, qStrand);
-      
+
       /* We add the pre-calculated value from the score vector for the current amino acid */
       addrow = scoreVec[sIndex[sIdx]];
       *newsum = *addrow;
       ++addrow;
-      
+
       qmax = min(properties->slidingWinSize, pepQSeqLen);
-      
+
       for (qIdx = 1; qIdx < qmax ; ++qIdx)
         {
           ++newsum;
@@ -1373,39 +1374,39 @@ static void doCalculateImage(const BlxStrand qStrand,
           ++oldsum;
           ++addrow;
         }
-      
+
       qmax = (dc->blastMode != BLXMODE_BLASTX && dwc->selfComp ? sIdx + 1 : pepQSeqLen);
       qmax = min(qmax, pepQSeqLen);
-      
-      for ( ; qIdx < qmax ; ++qIdx) 
+
+      for ( ; qIdx < qmax ; ++qIdx)
         {
           ++newsum;
           *newsum = *oldsum + *addrow - *delrow;
           ++oldsum;
           ++addrow;
           ++delrow;
-          
-          if (*newsum > 0 && valueWithinRange(sIdx, &validRange)) 
+
+          if (*newsum > 0 && valueWithinRange(sIdx, &validRange))
             {
               dotposq = (qIdx - win2)/dwc->zoomFactor;
               dotposs = (sIdx - (incrementVal * win2))/dwc->zoomFactor;
-              
+
               /* Only fill half the submatrix */
               const int qPosLocal = qIdx - win2 - (dotposq * dwc->zoomFactor);  /* query position in local submatrix (of one pixel) */
               int sPosLocal = sIdx - (incrementVal * win2) - (dotposs * dwc->zoomFactor);  /* subject position in local submatrix (of one pixel) */
-              
+
               if (qStrand == BLXSTRAND_REVERSE)
                 {
                   /* Set the origin (0,0) to the bottom left corner of submatrix
                    Ugly but correct. Zoom = pixels/submatrix */
                   sPosLocal = dwc->zoomFactor - 1 - sPosLocal;
                 }
-              
+
               if (sPosLocal >= qPosLocal)
                 {
                   dotpos = properties->imageWidth*dotposs + dotposq;
-                  
-                  if (dotpos < 0 || dotpos >= pixelmapLen) 
+
+                  if (dotpos < 0 || dotpos >= pixelmapLen)
                     {
                       g_critical ( "Pixel %d out of bounds. Pixelmap len=%d, mode =%d, ref sequqnece strand=%s\n", dotpos, pixelmapLen, dc->blastMode, (qStrand == BLXSTRAND_REVERSE ? "reverse" : "forward"));
                     }
@@ -1415,7 +1416,7 @@ static void doCalculateImage(const BlxStrand qStrand,
                       const int val = *newsum * properties->pixelFac / properties->slidingWinSize;
                       unsigned char dotValue = (val > 255 ? 255 : (unsigned char)val);
                       unsigned char *curDot = &properties->pixelmap[dotpos];
-                      
+
                       if (dotValue > *curDot)
                         {
                           *curDot = dotValue;
@@ -1423,7 +1424,7 @@ static void doCalculateImage(const BlxStrand qStrand,
                     }
                 }
             }
-        } 
+        }
     }
 }
 
@@ -1432,39 +1433,39 @@ static void doCalculateImage(const BlxStrand qStrand,
 static void printCalculateImageStats(DotterWindowContext *dwc, const int qlen, const int slen)
 {
   DotterContext *dc = dwc->dotterCtx;
-  
+
   double speed = 17.2;  /* Speed in Mdots/seconds. SGI MIPS R10000 (clobber) */
   /* speed = 5.7;  DEC Alpha AXP 3000/700 */
   /* speed = 3.7;  SGI R4400: */
-  
+
   double numDots = qlen/1e6*slen; /* total number of dots (millions) */
-  
-  if (dwc->selfComp) 
+
+  if (dwc->selfComp)
     numDots /= 2;
-  
-  if (dc->blastMode == BLXMODE_BLASTN && !(dc->watsonOnly || dc->crickOnly)) 
+
+  if (dc->blastMode == BLXMODE_BLASTN && !(dc->watsonOnly || dc->crickOnly))
     numDots *= 2;
-  
-  if (dc->blastMode == BLXMODE_BLASTX) 
+
+  if (dc->blastMode == BLXMODE_BLASTX)
     numDots *= 3;
-  
+
   int min = (int)(numDots/speed/60);
   int sec = (int)(numDots/speed) - min*60;
-  
+
   g_message("%d vs. %d residues => %.2f million dots. ", qlen, slen, numDots);
-  
-  if (min+sec >= 2) 
+
+  if (min+sec >= 2)
     {
       g_message("(Takes ");
-      
+
       if (min)
         g_message("%d:%.2d minutes", min, sec);
-      else 
+      else
         g_message("%d seconds", sec);
-      
+
       g_message(" on an SGI MIPS R10000)");
     }
-  
+
   g_message("\n");
   fflush(stdout);
 }
@@ -1477,12 +1478,12 @@ static void calculateImage(DotplotProperties *properties)
   DEBUG_ENTER("calculateImage");
 
   g_assert(properties->slidingWinSize > 0);
-  
+
   int qIdx, sIdx;     /* Loop variables */
   int dotpos;
-  
+
   BlxHandle handle = handleCreate();
-  
+
   /* Extract some often-used data */
   DotterWindowContext *dwc = properties->dotterWinCtx;
   DotterContext *dc = properties->dotterWinCtx->dotterCtx;
@@ -1492,27 +1493,27 @@ static void calculateImage(DotplotProperties *properties)
 
   /* Print some statistics about what we're about to do */
   printCalculateImageStats(dwc, qlen, slen);
-  
+
   /* Find the offset of the current display range within the full range of the bit of reference sequence we have */
-  const int qOffset = dc->refSeqStrand == BLXSTRAND_REVERSE 
+  const int qOffset = dc->refSeqStrand == BLXSTRAND_REVERSE
     ? dc->refSeqFullRange.max() - dwc->refSeqRange.max()
     : dwc->refSeqRange.min() - dc->refSeqFullRange.min();
-  
+
   /* Convert from nucleotides to peptides, if applicable */
   const int resFactor = (dc->blastMode == BLXMODE_BLASTX ? dc->numFrames : 1);
   const int pepQSeqLen = qlen / resFactor;
   const int pepQSeqOffset = qOffset / resFactor;
   const int vecLen = (dc->displaySeqType == BLXSEQ_DNA ? 6 : 25);
 
-  /* Initialize lookup tables for faster execution. scoreVec is an array of precalculated 
-   * scores for qseq residues. sIndex contains the match sequence forward strand bases as 
+  /* Initialize lookup tables for faster execution. scoreVec is an array of precalculated
+   * scores for qseq residues. sIndex contains the match sequence forward strand bases as
    * binary values (i.e. amino-acid IDs 0 -> 23) */
   gint32 **scoreVec = NULL;
   createScoreVec(dwc, vecLen, pepQSeqLen, &handle, &scoreVec);
 
   gint32 *sIndex = (gint32*)handleAlloc(&handle, slen * sizeof(gint32));
   populateMatchSeqBinaryVals(dwc, slen, getTranslationTable(dc->matchSeqType, BLXSTRAND_FORWARD), sIndex);
-  
+
   /* Allocate some vectors for use in averaging the values for whole rows at a time. Initialise the
    * 'zero' array now but leave the sum arrays because these will be reset in doCalculateWindow. */
   gint32 *zero = (gint32*)handleAlloc(&handle, pepQSeqLen * sizeof(gint32));
@@ -1520,7 +1521,7 @@ static void calculateImage(DotplotProperties *properties)
   gint32 *sum2 = (gint32*)handleAlloc(&handle, pepQSeqLen * sizeof(gint32));
 
   int idx = 0;
-  for (idx = 0; idx < pepQSeqLen; ++idx) 
+  for (idx = 0; idx < pepQSeqLen; ++idx)
     {
       zero[idx] = 0;
     }
@@ -1538,7 +1539,7 @@ static void calculateImage(DotplotProperties *properties)
 
         }
     }
-  else if (dc->blastMode == BLXMODE_BLASTP) 
+  else if (dc->blastMode == BLXMODE_BLASTP)
     {
       /* Protein -> Protein matches. Straightforward comparison of the two sequences. */
       doCalculateImage(BLXSTRAND_FORWARD, 1, 0, 0,
@@ -1549,7 +1550,7 @@ static void calculateImage(DotplotProperties *properties)
     {
       /* Nucleotide -> Nucleotide matches. Calculate the result for each strand of the reference
        * sequence, and use the overall max values. */
-      
+
       if (!dc->crickOnly)
         {
           doCalculateImage(BLXSTRAND_FORWARD, 1, 0, 0,
@@ -1565,15 +1566,15 @@ static void calculateImage(DotplotProperties *properties)
         }
     }
 
-  if (dwc->selfComp && dc->displayMirror) 
+  if (dwc->selfComp && dc->displayMirror)
     {
       /* Copy mirror image */
-      
+
       int dotposCopy;
-      
-      for (sIdx = 0; sIdx < properties->imageHeight; ++sIdx) 
-        { 
-          for (qIdx = 0; qIdx < sIdx ; ++qIdx) 
+
+      for (sIdx = 0; sIdx < properties->imageHeight; ++sIdx)
+        {
+          for (qIdx = 0; qIdx < sIdx ; ++qIdx)
             {
               dotpos = properties->imageWidth * sIdx + qIdx;
               dotposCopy = properties->imageWidth * qIdx + sIdx;
@@ -1590,9 +1591,9 @@ static void calculateImage(DotplotProperties *properties)
             }
         }
     }
-  
+
   handleDestroy(&handle);
-  
+
   DEBUG_EXIT("calculateImage returning ");
 }
 
@@ -1602,10 +1603,10 @@ void loadPlot(GtkWidget *dotplot, const char *loadFileName, GError **error)
   DotplotProperties *properties = dotplotGetProperties(dotplot);
   DotterWindowContext *dwc = properties->dotterWinCtx;
   DotterContext *dc = properties->dotterWinCtx->dotterCtx;
-  
+
   /* Open the file */
   FILE *loadFile = fopen (loadFileName, "rb");
-  
+
   if (!loadFile)
     {
       g_set_error(error, DOTTER_ERROR, DOTTER_ERROR_OPENING_FILE, "Could not open file '%s'", loadFileName);
@@ -1622,12 +1623,12 @@ void loadPlot(GtkWidget *dotplot, const char *loadFileName, GError **error)
   gboolean ok = fread(&format, 1, sizeof(unsigned char), loadFile) == sizeof(unsigned char);
   dotstart += sizeof(unsigned char);
 
-  if (format != 1 && format != 2 && format != 3) 
+  if (format != 1 && format != 2 && format != 3)
     {
       g_set_error(error, DOTTER_ERROR, DOTTER_ERROR_READING_FILE, "Unknown dotter file format version: %d", format);
       return;
     }
-  
+
   /* Read in the zoom factor (an int in formats 1 and 2, or gdouble in later formats) */
   if (format == 1 || format == 2)
     {
@@ -1639,33 +1640,33 @@ void loadPlot(GtkWidget *dotplot, const char *loadFileName, GError **error)
       ok &= fread(&dwc->zoomFactor, 1, sizeof(gdouble), loadFile) == sizeof(gdouble);
       dotstart += sizeof(gdouble);
     }
-  
+
   /* Read in the image size */
   ok &= fread(&properties->imageWidth, 1, sizeof(gint32), loadFile) == sizeof(gint32);
   dotstart += sizeof(gint32);
 
   ok &= fread(&properties->imageHeight, 1, sizeof(gint32), loadFile) == sizeof(gint32);
   dotstart += sizeof(gint32);
-  
+
   if (!ok)
     {
       g_set_error(error, DOTTER_ERROR, DOTTER_ERROR_READING_FILE, "Error reading file '%s'", loadFileName);
       return;
     }
-  
+
 #ifdef ALPHA
   reversebytes(&dwc->zoomFactor, sizeof(gdouble));
   reversebytes(&properties->imageWidth, sizeof(gint32));
   reversebytes(&properties->imageHeight, sizeof(gint32));
 #endif
-  
-  if (format == 1) 
+
+  if (format == 1)
     {
       /* Don't actually know these variables for sure - guess the most common */
       properties->pixelFac = 50;
       properties->slidingWinSize = 25;
     }
-  else 
+  else
     {
       ok &= fread(&properties->pixelFac, 1, sizeof(gint32), loadFile) == sizeof(gint32);
       dotstart += sizeof(gint32);
@@ -1699,17 +1700,17 @@ void loadPlot(GtkWidget *dotplot, const char *loadFileName, GError **error)
           matrixName[matrixNameLen] = 0;
           g_free(dc->matrixName);
           dc->matrixName = g_strdup(matrixName);
-      
+
           /* Read in the matrix data */
           int i = 0;
           int j = 0;
-          
+
           for (i = 0; i < CONS_MATRIX_SIZE; i++)
             {
-              for (j = 0; j < CONS_MATRIX_SIZE; j++) 
+              for (j = 0; j < CONS_MATRIX_SIZE; j++)
                 {
                   gint32 matrixVal;
-                  ok &= fread(&matrixVal, 1, sizeof(gint32), loadFile) == sizeof(gint32); 
+                  ok &= fread(&matrixVal, 1, sizeof(gint32), loadFile) == sizeof(gint32);
                   dotstart += sizeof(gint32);
 #ifdef ALPHA
                   reversebytes(&matrixVal, sizeof(gint32));
@@ -1719,13 +1720,13 @@ void loadPlot(GtkWidget *dotplot, const char *loadFileName, GError **error)
             }
         }
     }
-  
+
   if (!ok)
     {
       g_set_error(error, DOTTER_ERROR, DOTTER_ERROR_READING_FILE, "Error reading file '%s'", loadFileName);
       return;
     }
-  
+
   fseek(loadFile, 0, SEEK_END);
   int n = ftell(loadFile);
 
@@ -1733,40 +1734,40 @@ void loadPlot(GtkWidget *dotplot, const char *loadFileName, GError **error)
 
   if (n - dotstart != pixelmapLen)
     {
-      g_set_error(error, DOTTER_ERROR, DOTTER_ERROR_READING_FILE, "Wrong number of pixels in %s: %d. Expected %d * %d = %d\n", 
+      g_set_error(error, DOTTER_ERROR, DOTTER_ERROR_READING_FILE, "Wrong number of pixels in %s: %d. Expected %d * %d = %d\n",
             loadFileName, n - dotstart, properties->imageWidth, properties->imageHeight, pixelmapLen);
       return;
     }
-  
+
   /* Allocate memory for the pixmap */
   initPixmap(&properties->pixelmap, properties->imageWidth, properties->imageHeight);
-  
+
   fseek(loadFile, dotstart, SEEK_SET);
-  
+
   int i = 0;
   for (i = 0; i < pixelmapLen; i++)
     {
       unsigned char pixelVal;
-      ok &= fread(&pixelVal, 1, sizeof(unsigned char), loadFile) == sizeof(unsigned char); 
+      ok &= fread(&pixelVal, 1, sizeof(unsigned char), loadFile) == sizeof(unsigned char);
 #ifdef ALPHA
       reversebytes(&pixelVal, sizeof(unsigned char));
 #endif
       properties->pixelmap[i] = pixelVal;
     }
-  
-  
+
+
 //  if ((n = fread(properties->pixelmap, sizeof(unsigned char), pixelmapLen, loadFile)) != pixelmapLen)
 //    {
-//      g_set_error(error, DOTTER_ERROR, DOTTER_ERROR_READING_FILE, "Read wrong number of pixels from %s: %d. Expected %d * %-d = %d\n", 
+//      g_set_error(error, DOTTER_ERROR, DOTTER_ERROR_READING_FILE, "Read wrong number of pixels from %s: %d. Expected %d * %-d = %d\n",
 //              loadFileName, n, properties->imageWidth, properties->imageHeight, pixelmapLen);
 //      return;
 //    }
-  
+
   fclose(loadFile);
 
   g_message("Dotplot file '%s' was loaded successfully.\n", loadFileName);
 
-  if (format == 1) 
+  if (format == 1)
     {
       g_message("Old dotplot file format '1' was used, so the windowsize and pixel factor are estimates.\n");
     }
@@ -1785,7 +1786,7 @@ void loadPlot(GtkWidget *dotplot, const char *loadFileName, GError **error)
  *
  * 1 byte unsigned-char at the start of the file to indicate the file format.
  *
- * It then writes various parameters (as determined by that format, see below) 
+ * It then writes various parameters (as determined by that format, see below)
  *
  * and then the dot-matrix itself.
  *
@@ -1794,17 +1795,17 @@ void loadPlot(GtkWidget *dotplot, const char *loadFileName, GError **error)
  *
  * The format char is one of the following:
  *
- *   '1'  The original format, with the following fields: 
- *             format (uchar), zoom (int), image width (int), image height (int) 
+ *   '1'  The original format, with the following fields:
+ *             format (uchar), zoom (int), image width (int), image height (int)
  *
- *   '2'  In addition to the format '1' fields: 
- *             pixelFac (int), win size (int), matrix name len (int), matrix name (MNlen chars) 
+ *   '2'  In addition to the format '1' fields:
+ *             pixelFac (int), win size (int), matrix name len (int), matrix name (MNlen chars)
  *
- *   '3'  as format 2 but changed zoom from int to gdouble 
+ *   '3'  as format 2 but changed zoom from int to gdouble
  *
  * Note that formats 1 and 2 used to assume that the 'int' date type was always 4 bytes. We now make
  * sure this is the case by using the gint32 data type, which is guaranteed to be 32 bits (4 bytes)
- * on any system.  The standard for chars/uchars (1 byte) and doubles/gdoubles (8 bytes) should be 
+ * on any system.  The standard for chars/uchars (1 byte) and doubles/gdoubles (8 bytes) should be
  * consistent for all systems so we don't need to worry about those.
  */
 void savePlot(GtkWidget *dotplot, DotplotProperties *propertiesIn,
@@ -1816,12 +1817,12 @@ void savePlot(GtkWidget *dotplot, DotplotProperties *propertiesIn,
   bool ok ;
 
   g_assert(properties);
-  
+
 
   gboolean batch = (saveFileName ? TRUE : FALSE); /* whether this is part of a batch process */
 
-  
-  /* Open the file. Use the given file name (i.e. if we're in batch mode) or ask the user to 
+
+  /* Open the file. Use the given file name (i.e. if we're in batch mode) or ask the user to
    * select a file. */
   static const char *fileName = NULL;
 
@@ -1829,15 +1830,15 @@ void savePlot(GtkWidget *dotplot, DotplotProperties *propertiesIn,
     fileName = saveFileName;
   else if (dotplot)
     fileName = getSaveFileName(dotplot, fileName, NULL, ".dotter", "Save dot-plot in dotter format");
-  
+
   g_message("Saving dot-matrix to '%s'.\n", fileName);
 
   FILE *saveFile = NULL;
-  
-  if (fileName) 
+
+  if (fileName)
     {
       saveFile = fopen (fileName, "wb");
-      
+
       if (!saveFile)
         {
           g_set_error(error, DOTTER_ERROR, DOTTER_ERROR_OPENING_FILE, "Failed to open file '%s'.\n", fileName);
@@ -1857,13 +1858,13 @@ void savePlot(GtkWidget *dotplot, DotplotProperties *propertiesIn,
     ok = saveAsAscii(saveFile, properties, error) ;
 
 
-  
-  
+
+
   if (!ok)
     {
       g_set_error(error, DOTTER_ERROR, DOTTER_ERROR_SAVING_FILE, "Error writing data to file '%s'.\n", fileName);
     }
-  
+
   fclose(saveFile);
   saveFile = 0;
 
@@ -1873,14 +1874,14 @@ void savePlot(GtkWidget *dotplot, DotplotProperties *propertiesIn,
 
 /* Export the plot to a graphical format (currently only PDF is supported by GTK).
  * the drawable can be NULL. */
-void exportPlot(GtkWidget *dotplot, 
+void exportPlot(GtkWidget *dotplot,
                 GtkWindow *window,
                 const char *exportFileName,
                 GError **error)
 {
   gboolean batch = (exportFileName ? TRUE : FALSE); /* whether this is part of a batch process */
-  
-  /* Open the file. Use the given file name (i.e. if we're in batch mode) or ask the user to 
+
+  /* Open the file. Use the given file name (i.e. if we're in batch mode) or ask the user to
    * select a file. */
   static const char *fileName = NULL;
 
@@ -1888,10 +1889,10 @@ void exportPlot(GtkWidget *dotplot,
     fileName = exportFileName;
   else if (dotplot)
     fileName = getSaveFileName(dotplot, fileName, NULL, ".pdf", "Export dot-plot");
-  
+
   GtkPrintSettings *printSettings = gtk_print_settings_new();
   GtkPageSetup *pageSetup = gtk_page_setup_new();
-  
+
   gtk_page_setup_set_orientation(pageSetup, GTK_PAGE_ORIENTATION_LANDSCAPE);
   gtk_print_settings_set_orientation(printSettings, GTK_PAGE_ORIENTATION_LANDSCAPE);
   gtk_print_settings_set_quality(printSettings, GTK_PRINT_QUALITY_HIGH);
@@ -1912,13 +1913,13 @@ static void recalculateDotplotBorders(GtkWidget *dotplot, DotplotProperties *pro
   /* Recalculate the image size */
   properties->imageWidth = getImageDimension(properties, TRUE);
   properties->imageHeight = getImageDimension(properties, FALSE);
-  
+
   DEBUG_OUT("Set image w=%d, h=%d\n", properties->imageWidth, properties->imageHeight);
 
   /* Create the image */
   if (properties->image)
     gdk_image_unref(properties->image);
-    
+
   properties->image = createImage(properties);
 
   /* Create the new pixmap */
@@ -1933,9 +1934,9 @@ static void recalculateDotplotBorders(GtkWidget *dotplot, DotplotProperties *pro
       calculateImage(properties);
       transformGreyRampImage(properties->image, properties->pixelmap, properties);
     }
-  
+
   calculateDotplotBorders(dotplot, properties);
-  
+
   DEBUG_EXIT("recalculateDotplotBorders");
 }
 
@@ -1944,10 +1945,10 @@ static void findScaleUnit (gdouble cutoff, int *u, int *sub)
 {
   gdouble unit = *u ;
   gdouble subunit = *u ;
-  
+
   if (cutoff < 0)
     cutoff = -cutoff ;
-  
+
   while (unit < cutoff)
     { unit *= 2 ;
       subunit *= 5 ;
@@ -1967,28 +1968,28 @@ static void findScaleUnit (gdouble cutoff, int *u, int *sub)
 
 
 /* Note [Scale Labels] -- gb10
- * 
+ *
  * We use GtkLabel child widgets to draw the scale labels on the dotplot.
  * Originally the labels were drawn directly on the dotplot drawing area
  * using pango/cairo. However, there were some bugs with this where some
- * of the labels were sometimes not getting drawn, and sometimes dotter 
- * would crash (with the crash happening in the pango or cairo function 
+ * of the labels were sometimes not getting drawn, and sometimes dotter
+ * would crash (with the crash happening in the pango or cairo function
  * that was drawing the text).
  *
  * I could not find the cause for these bugs so I have used another
- * approach using GtkLabel widgets to draw the labels instead. This 
+ * approach using GtkLabel widgets to draw the labels instead. This
  * appears to fix these problems.
  *
  * Note that we create the labels outside of the expose function
  * and add them to an array so that we can keep track of them (we
  * don't want to create loads of new labels every time we redraw).
  * However, the text and position of the labels is set in the expose
- * function, because this is where the scale markers are drawn, which 
+ * function, because this is where the scale markers are drawn, which
  * defines the position for the labels. We also don't know the exact
  * font (and hence text size) until the widgets are realised, and again
- * this affects the position of the labels, so it's easiest to do it 
+ * this affects the position of the labels, so it's easiest to do it
  * all in the expose function.
- * 
+ *
  */
 
 /* Create the label widgets for the scale. See note [Scale Labels]
@@ -2012,14 +2013,14 @@ static void createScaleLabels(GtkWidget *dotplot,
     {
       GtkWidget *eventBox = gtk_event_box_new();
       GtkWidget *label = gtk_label_new(NULL);
-      
+
       gtk_container_add(GTK_CONTAINER(eventBox), label);
       gtk_layout_put(GTK_LAYOUT(dotplot), eventBox, 0, 0);
-      
+
       g_array_append_val(scale->labels, eventBox);
     }
 
-  /* If we have too many labels, hide the extra ones. (Note that 
+  /* If we have too many labels, hide the extra ones. (Note that
    * drawTickmarkLabels will take care of re-showing any that are
    * required later.) */
   i = scale->numMarks;
@@ -2051,15 +2052,15 @@ static void calculateScaleProperties(GtkWidget *dotplot,
   scale->basesPerSubmark = 1;
   gdouble cutoff = horizontal ? PIXELS_PER_MARK_X : PIXELS_PER_MARK_Y;
   cutoff *= scaleFactor;
-  
+
   findScaleUnit(cutoff, &scale->basesPerMark, &scale->basesPerSubmark);
-  
+
   /* Round up the start coord to find the coord and position of the first submark */
   scale->startCoord = UNSET_INT;
   scale->endCoord = UNSET_INT;
-  scale->firstSubmarkCoord = UNSET_INT; 
+  scale->firstSubmarkCoord = UNSET_INT;
   int firstMarkCoord = UNSET_INT;
-  
+
   if (reversedScale)
     {
       /* Horizontal scale is reversed. 	Round the max coord down to the nearest basesPerSubmark */
@@ -2096,7 +2097,7 @@ int getMaxBreakpointLabelSize(GtkWidget *dotplot, DotterContext *dc)
   int max_len = 0;
 
   cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 500, 500);
-  cairo_t *cr = cairo_create (surface);  
+  cairo_t *cr = cairo_create (surface);
 
   PangoLayout *layout = pango_cairo_create_layout(cr);
   pango_layout_set_font_description(layout, dotplot->style->font_desc);
@@ -2126,7 +2127,7 @@ int getDotplotHeight(GtkWidget *dotplot, DotplotProperties *properties)
 {
   /* Make sure the plot is tall enough to fit the vertical label */
   cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 500, 500);
-  cairo_t *cr = cairo_create (surface);  
+  cairo_t *cr = cairo_create (surface);
 
   PangoLayout *layout = pango_cairo_create_layout(cr);
   pango_layout_set_text(layout, properties->dotterWinCtx->dotterCtx->matchSeqName, -1);
@@ -2139,22 +2140,22 @@ int getDotplotHeight(GtkWidget *dotplot, DotplotProperties *properties)
   g_object_unref(layout);
   cairo_destroy(cr);
   cairo_surface_destroy(surface);
-      
+
   const int dotplotHeight = max(height, properties->plotRect.height);
 
   /* The basic height is the height of the dotplot plus padding and scale */
-  int result = properties->plotRect.y + 
+  int result = properties->plotRect.y +
                dotplotHeight +
-               DEFAULT_Y_PADDING + 
+               DEFAULT_Y_PADDING +
                SCALE_LINE_WIDTH;
-    
+
   if (properties->breaklinesOn && properties->hozLabelsOn)
     {
-      /* Add space for breakline labels. They are rotated 90 degrees so we need to 
+      /* Add space for breakline labels. They are rotated 90 degrees so we need to
        * add enough height for the full label length */
       const int labelSize = getMaxBreakpointLabelSize(dotplot, properties->dotterWinCtx->dotterCtx) ;
       result += labelSize + ANNOTATION_LABEL_PADDING;
-    }      
+    }
 
   return result;
 }
@@ -2163,17 +2164,17 @@ int getDotplotHeight(GtkWidget *dotplot, DotplotProperties *properties)
 int getDotplotWidth(GtkWidget *dotplot, DotplotProperties *properties)
 {
   int result = properties->plotRect.x +
-               properties->plotRect.width + 
-               DEFAULT_X_PADDING + 
+               properties->plotRect.width +
+               DEFAULT_X_PADDING +
                SCALE_LINE_WIDTH;
-  
+
   if (properties->breaklinesOn && properties->vertLabelsOn)
     {
       /* Add space for breakline labels */
       const int labelSize = getMaxBreakpointLabelSize(dotplot, properties->dotterWinCtx->dotterCtx) ;
       result += labelSize + ANNOTATION_LABEL_PADDING;
     }
-  
+
   return result;
 }
 
@@ -2188,10 +2189,10 @@ static void calculateDotplotBorders(GtkWidget *dotplot, DotplotProperties *prope
   properties->plotRect.y = DEFAULT_Y_PADDING + dc->scaleHeight + dc->charHeight;
   properties->plotRect.width = properties->imageWidth;
   properties->plotRect.height = properties->imageHeight;
-  
+
   const int totalWidth = getDotplotWidth(dotplot, properties);
   const int totalHeight = getDotplotHeight(dotplot, properties);
-  
+
   if (dotplot)
     {
       gtk_widget_set_size_request(dotplot, totalWidth, totalHeight);
@@ -2199,7 +2200,7 @@ static void calculateDotplotBorders(GtkWidget *dotplot, DotplotProperties *prope
       widgetClearCachedDrawable(dotplot, NULL);
       gtk_widget_queue_draw(dotplot);
     }
-  
+
   calculateScaleProperties(dotplot, properties, TRUE);
   calculateScaleProperties(dotplot, properties, FALSE);
 
@@ -2242,14 +2243,14 @@ void redrawDotplot(GtkWidget *dotplot)
 void recalcDotplot(GtkWidget *dotplot)
 {
   DotplotProperties *properties = dotplotGetProperties(dotplot);
-  
+
   recalculateDotplotBorders(dotplot, properties);
-  
+
   calculateDotterExonViewBorders(properties->hozExons1, properties->imageWidth, properties->imageHeight);
   calculateDotterExonViewBorders(properties->hozExons2, properties->imageWidth, properties->imageHeight);
   calculateDotterExonViewBorders(properties->vertExons1, properties->imageWidth, properties->imageHeight);
   calculateDotterExonViewBorders(properties->vertExons2, properties->imageWidth, properties->imageHeight);
-  
+
   redrawDotplot(dotplot);
 }
 
@@ -2267,23 +2268,23 @@ static void drawDotplot(GtkWidget *dotplot, GdkDrawable *drawable)
 
 /* This prepares the dotplot for printing. It draws the crosshair onto the
  * cached pixmap, because it is this pixmap that will be used in the print.
- * (Normally the crosshair does not get drawn to the pixmap - it just gets 
+ * (Normally the crosshair does not get drawn to the pixmap - it just gets
  * drawn to the screen by the expose function). */
 void dotplotPrepareForPrinting(GtkWidget *dotplot)
 {
   GdkDrawable *drawable = widgetGetDrawable(dotplot);
-  
+
   if (!drawable)
     {
       drawable = createBlankPixmap(dotplot);
       drawDotplot(dotplot, drawable);
     }
-  
+
   if (drawable)
     {
       dotplotDrawCrosshair(dotplot, drawable);
     }
-  
+
   /* Do the same for each exon view */
   DotplotProperties *properties = dotplotGetProperties(dotplot);
   exonViewPrepareForPrinting(properties->hozExons1);
@@ -2302,23 +2303,23 @@ static void drawGridline(GdkDrawable *drawable, DotplotProperties *properties, c
 
       DotterWindowContext *dwc = properties->dotterWinCtx;
       DotterContext *dc = properties->dotterWinCtx->dotterCtx;
-      
+
       GdkColor *gridColor = getGdkColor(DOTCOLOR_GRID, dc->defaultColors, FALSE, dwc->usePrintColors);
       gdk_gc_set_foreground(gc, gridColor);
-      
+
       int xEnd = horizontal ? xStart : xStart + properties->plotRect.width;
       int yEnd = horizontal ? yStart + properties->plotRect.height : yStart;
-    
+
       gdk_draw_line(drawable, gc, xStart, yStart, xEnd, yEnd);
-      
+
       g_object_unref(gc);
-    }  
+    }
 }
 
 
 /* Utility used by drawScaleMarkers to draw the labels for the tick marks */
-static void drawTickmarkLabel(GtkWidget *dotplot, 
-                              DotterContext *dc, 
+static void drawTickmarkLabel(GtkWidget *dotplot,
+                              DotterContext *dc,
                               GdkDrawable *drawable,
                               GtkWidget *labelParent,
                               const int coordIn,
@@ -2334,7 +2335,7 @@ static void drawTickmarkLabel(GtkWidget *dotplot,
   PangoLayout *layout = pango_cairo_create_layout(cr);
   pango_layout_set_text(layout, displayText, -1);
 
-  /* We'll centre the text at half the text width for the horizontal 
+  /* We'll centre the text at half the text width for the horizontal
    * axis, or half the height for the vertical. */
   int width = UNSET_INT, height = UNSET_INT;
   pango_layout_get_pixel_size(layout, &width, &height);
@@ -2351,21 +2352,21 @@ static void drawTickmarkLabel(GtkWidget *dotplot,
 
   gtk_widget_show_all(labelParent);
   gtk_layout_move(GTK_LAYOUT(dotplot), labelParent, x, y);
-  
-  g_object_unref(layout);  
+
+  g_object_unref(layout);
   cairo_destroy(cr);
   g_free(displayText);
 }
 
 
-static void drawScaleMarkers(GtkWidget *dotplot, 
-                             GdkDrawable *drawable, 
-                             GdkGC *gc, 
+static void drawScaleMarkers(GtkWidget *dotplot,
+                             GdkDrawable *drawable,
+                             GdkGC *gc,
                              const IntRange* const displayRange,
                              DotplotProperties *properties,
                              const gboolean horizontal)
 {
-  /* We scale down by the zoom factor, and also divide by the number 
+  /* We scale down by the zoom factor, and also divide by the number
    * of frames so that one dot represents one peptide */
   DotterContext *dc = properties->dotterWinCtx->dotterCtx;
   DotplotScaleProperties *scale = horizontal ? &properties->hozScale : &properties->vertScale;
@@ -2373,8 +2374,8 @@ static void drawScaleMarkers(GtkWidget *dotplot,
   const gdouble scaleFactor = getScaleFactor(properties, horizontal);
   const gboolean reversedScale = ((horizontal && dc->hozScaleRev) || (!horizontal && dc->vertScaleRev));
   const int direction = reversedScale ? -1 : 1;
-    
-  const int staticBorder = horizontal 
+
+  const int staticBorder = horizontal
     ? properties->plotRect.y - SCALE_LINE_WIDTH
     : properties->plotRect.x - SCALE_LINE_WIDTH;
 
@@ -2389,7 +2390,7 @@ static void drawScaleMarkers(GtkWidget *dotplot,
 
       const int currentPos = scale->firstSubmarkPos + (basesFromFirstMark / scaleFactor);
       const int tickHeight = isMajorTick ? DEFAULT_MAJOR_TICK_HEIGHT : DEFAULT_MINOR_TICK_HEIGHT;
-      
+
       /* Draw the marker line */
       int x1 = horizontal ? currentPos : staticBorder - tickHeight;
       int x2 = horizontal ? currentPos : staticBorder;
@@ -2397,10 +2398,10 @@ static void drawScaleMarkers(GtkWidget *dotplot,
       int y2 = horizontal ? staticBorder : currentPos;
 
       gdk_draw_line(drawable, gc, x1, y1, x2, y2);
-      
+
       /* Draw a grid line, if applicable */
       drawGridline(drawable, properties, x2, y2, horizontal);
-          
+
       /* Draw a lable on major tick marks */
       if (isMajorTick)
         {
@@ -2409,7 +2410,7 @@ static void drawScaleMarkers(GtkWidget *dotplot,
               GtkWidget *label = g_array_index(scale->labels, GtkWidget*, majorTickIdx);
               drawTickmarkLabel(dotplot, dc, drawable, label, coord, x1, y1, &properties->plotRect, horizontal);
             }
-          
+
           ++majorTickIdx;
         }
     }
@@ -2424,7 +2425,7 @@ static void drawLabel(GtkWidget *dotplot, GdkDrawable *drawable, GdkGC *gc)
   int textHeight = UNSET_INT;
 
   cairo_t *cr = gdk_cairo_create(drawable);
-  
+
   PangoLayout *layout = pango_cairo_create_layout(cr);
   pango_layout_set_font_description(layout, dotplot->style->font_desc);
   pango_layout_set_text(layout, dc->refSeqName, -1);
@@ -2443,10 +2444,10 @@ static void drawLabel(GtkWidget *dotplot, GdkDrawable *drawable, GdkGC *gc)
   pango_layout_set_font_description(layout, dotplot->style->font_desc);
   pango_layout_set_text(layout, dc->matchSeqName, -1);
   pango_layout_get_pixel_size(layout, &textWidth, &textHeight);
- 
+
   x = properties->plotRect.x - (dc->scaleWidth + dc->charHeight);
   y = properties->plotRect.y + (properties->plotRect.height / 2) + (textWidth / 2);
-  
+
   cairo_move_to (cr, x, y);
   cairo_rotate(cr, 270.0 * G_PI / 180.0);
   pango_cairo_show_layout(cr, layout);
@@ -2462,19 +2463,19 @@ static void drawDotterScale(GtkWidget *dotplot, GdkDrawable *drawable)
   GdkGC *gc = gdk_gc_new(drawable);
 
   DotplotProperties *properties = dotplotGetProperties(dotplot);
-  
+
   /* Draw the outline rectangle of the dot plot */
   gdk_gc_set_line_attributes(gc, SCALE_LINE_WIDTH, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
-  
-  gdk_draw_rectangle(drawable, gc, FALSE, 
-                     properties->plotRect.x - SCALE_LINE_WIDTH, properties->plotRect.y - SCALE_LINE_WIDTH, 
+
+  gdk_draw_rectangle(drawable, gc, FALSE,
+                     properties->plotRect.x - SCALE_LINE_WIDTH, properties->plotRect.y - SCALE_LINE_WIDTH,
                      properties->plotRect.width + SCALE_LINE_WIDTH, properties->plotRect.height + SCALE_LINE_WIDTH);
 
   drawLabel(dotplot, drawable, gc);
-  
+
   drawScaleMarkers(dotplot, drawable, gc, &properties->dotterWinCtx->refSeqRange, properties, TRUE);
   drawScaleMarkers(dotplot, drawable, gc, &properties->dotterWinCtx->matchSeqRange, properties, FALSE);
-  
+
   g_object_unref(gc);
 }
 
@@ -2490,13 +2491,13 @@ static void drawBreakline(const MSP* const msp, GtkWidget *dotplot, DotplotPrope
   if (msp->qRange.min() != msp->qRange.max())
     g_warning("Breakline coords should be the same but min=%d and max=%d\n", msp->qRange.min(), msp->qRange.max());
 
-  /* See if this msp is the vertical or horizontal sequence. It could be both for a self comparison. 
+  /* See if this msp is the vertical or horizontal sequence. It could be both for a self comparison.
    * We check if the name matches the sequence name or the values @1 or @2 for hoz and vert resp. */
   gboolean horizontal = (msp->qname && strcmp(msp->qname, dc->refSeqName) == 0);
   gboolean vertical = (msp->qname && strcmp(msp->qname, dc->matchSeqName) == 0);
-  
+
   vertical |= (msp->qname && strcmp(msp->qname, "@2") == 0);
-  
+
   if(msp->qname && strcmp(msp->qname, "@1") == 0)
     {
       horizontal = TRUE;
@@ -2514,11 +2515,11 @@ static void drawBreakline(const MSP* const msp, GtkWidget *dotplot, DotplotPrope
       /* Find the x position of this coord and draw a vertical line here */
       int sy = properties->plotRect.y;
       int ey = properties->plotRect.y + properties->plotRect.height + ANNOTATION_LABEL_PADDING;
-    
+
       int sx, ex; /* start/end coordinates [0..n] */
       getMspScreenCoords(msp, properties, &sx, &ex, NULL, NULL);
       gdk_draw_line(drawable, gc, sx, sy, ex, ey);
-    
+
       /* Draw a label at the bottom (if labels enabled) */
       if (properties->hozLabelsOn && msp->desc)
 	{
@@ -2535,7 +2536,7 @@ static void drawBreakline(const MSP* const msp, GtkWidget *dotplot, DotplotPrope
           cairo_destroy(cr);
 	}
     }
-  
+
   if (vertical)
     {
       /* Find the y position of this coord and draw a horizontal line here */
@@ -2545,14 +2546,14 @@ static void drawBreakline(const MSP* const msp, GtkWidget *dotplot, DotplotPrope
       int sy, ey; /* start/end coordinates [0..n]. Note that breakline coords are always
 		   * stored in the q coords even for the vertical sequence. */
       getMspScreenCoords(msp, properties, &sy, &ey, NULL, NULL);
-    
+
       /* hack the coords because they've been based at the x coord. Really we should store them
        * properly in the s range but for historic reasons they're in the q range. */
       sy += properties->plotRect.y - properties->plotRect.x;
       ey += properties->plotRect.y - properties->plotRect.x;
-    
+
       gdk_draw_line(drawable, gc, sx, sy, ex, ey);
-    
+
       /* Draw a label at the RHS (if labels enabled) */
       if (properties->vertLabelsOn && msp->desc)
 	{
@@ -2580,19 +2581,19 @@ static void drawBreaklines(GtkWidget *dotplot, GdkDrawable *drawable)
   DotplotProperties *properties = dotplotGetProperties(dotplot);
   DotterWindowContext *dwc = properties->dotterWinCtx;
   DotterContext *dc = dwc->dotterCtx;
-  
+
   if (properties->breaklinesOn)
     {
       const MSP* msp = dc->mspList;
-    
+
       for ( ; msp; msp = msp->next)
 	{
 	  if (msp->type == BLXMSP_FS_SEG)
 	    {
 	      drawBreakline(msp, dotplot, properties, drawable);
 	    }
-	}      
-    }  
+	}
+    }
 }
 
 
@@ -2600,7 +2601,7 @@ static void drawBreaklines(GtkWidget *dotplot, GdkDrawable *drawable)
 static void dotplotDrawCrosshair(GtkWidget *dotplot, GdkDrawable *drawable)
 {
   DotplotProperties *properties = dotplotGetProperties(dotplot);
-  
+
   if (properties->crosshairOn)
     {
       GdkGC *gc = gdk_gc_new(drawable);
@@ -2611,7 +2612,7 @@ static void dotplotDrawCrosshair(GtkWidget *dotplot, GdkDrawable *drawable)
       /* Set the line color for the crosshair */
       GdkColor *lineColor = getGdkColor(DOTCOLOR_CROSSHAIR, dc->defaultColors, FALSE, dwc->usePrintColors);
       gdk_gc_set_foreground(gc, lineColor);
-      
+
       int x = UNSET_INT, y = UNSET_INT;
       getPosFromSelectedCoords(dotplot, &x, &y);
 
@@ -2625,21 +2626,21 @@ static void dotplotDrawCrosshair(GtkWidget *dotplot, GdkDrawable *drawable)
       int y1 = properties->crosshairFullscreen ? dc->scaleHeight : properties->plotRect.y;
       int height = properties->crosshairFullscreen ? dotplot->allocation.height : properties->plotRect.height;
       gdk_draw_line(drawable, gc, x, y1, x, y1 + height);
-      
+
       if (properties->crosshairCoordsOn)
         {
           /* Draw the coord text */
-          char *displayText = g_strdup_printf("%d, %d", 
-                                              getDisplayCoord(dwc->refCoord, dc, TRUE), 
+          char *displayText = g_strdup_printf("%d, %d",
+                                              getDisplayCoord(dwc->refCoord, dc, TRUE),
                                               getDisplayCoord(dwc->matchCoord, dc, FALSE));
-          
+
           if (displayText && strlen(displayText) > 0)
             {
               cairo_t *cr = gdk_cairo_create(drawable);
               PangoLayout *layout = pango_cairo_create_layout(cr);
               pango_layout_set_font_description(layout, dotplot->style->font_desc);
               pango_layout_set_text(layout, displayText, -1);
-              
+
               int textWidth = UNSET_INT, textHeight = UNSET_INT;
               pango_layout_get_pixel_size(layout, &textWidth, &textHeight);
 
@@ -2655,7 +2656,7 @@ static void dotplotDrawCrosshair(GtkWidget *dotplot, GdkDrawable *drawable)
                 {
                   x += CROSSHAIR_TEXT_PADDING;
                 }
-              
+
               if (y + CROSSHAIR_TEXT_PADDING + textHeight > totalHeight)
                 {
                   y -= CROSSHAIR_TEXT_PADDING + textHeight;
@@ -2675,7 +2676,7 @@ static void dotplotDrawCrosshair(GtkWidget *dotplot, GdkDrawable *drawable)
 
           g_free(displayText);
         }
-      
+
       g_object_unref(gc);
     }
 }
@@ -2685,16 +2686,16 @@ static void dotplotDrawCrosshair(GtkWidget *dotplot, GdkDrawable *drawable)
 static void drawImage(GtkWidget *dotplot, GdkDrawable *drawable)
 {
   DEBUG_ENTER("drawImage");
-  
+
   DotplotProperties *properties = dotplotGetProperties(dotplot);
- 
+
   if (showImage(properties))
-    {  
+    {
       GdkGC *gc = gdk_gc_new(drawable);
-      
+
       gdk_draw_image(drawable, gc, properties->image,
                      0, 0, properties->plotRect.x, properties->plotRect.y,
-                     properties->image->width, properties->image->height); 
+                     properties->image->width, properties->image->height);
 
       /* We cannot calculate the image in the sliding-window size border,
        * so shade that in to indicate it is not part of the plot */
@@ -2712,29 +2713,29 @@ static void drawImage(GtkWidget *dotplot, GdkDrawable *drawable)
       drawRect(drawable, color, r->x, r->y, vBorder, r->height, alpha, op);
       drawRect(drawable, color, r->x + r->width - vBorder, r->y, vBorder, r->height, alpha, op);
       drawRect(drawable, color, r->x, r->y, r->width, hBorder, alpha, op);
-      drawRect(drawable, color, r->x, r->y + r->height - hBorder, r->width, hBorder, alpha, op);      
+      drawRect(drawable, color, r->x, r->y + r->height - hBorder, r->width, hBorder, alpha, op);
 
       g_object_unref(gc);
     }
-  
+
   DEBUG_EXIT("drawImage returning ");
 }
 
 
-/* Utility to cut off anything before the ':' in an MSP name. Returns the full name if 
- * there is no colon. Returns a pointer into the original name, so the result should not 
+/* Utility to cut off anything before the ':' in an MSP name. Returns the full name if
+ * there is no colon. Returns a pointer into the original name, so the result should not
  * be free'd */
 static const char* getShortMspName(const MSP* const msp)
 {
   const char *result = NULL;
   const char *sName = mspGetSName(msp);
-  
+
   if (sName)
     {
-      const char *mspName = strchr(sName, ':');  
+      const char *mspName = strchr(sName, ':');
       result = mspName ? ++mspName : sName;
     }
-  
+
   return result;
 }
 
@@ -2746,35 +2747,35 @@ static void calculateImageHsps(int strength, int sx, int sy, int ex, int ey, Dot
   ex -= properties->plotRect.x;
   sy -= properties->plotRect.y;
   ey -= properties->plotRect.y;
-  
+
   const int xInc = (sx < ex) ? 1 : -1;
   const int xLen = (ex - sx) * xInc + 1;
   const int yInc = (sy < ey) ? 1 : -1;
   const int yLen = (ey - sy) * yInc + 1;
-  
+
   const int width = properties->image->width;
   const int height = properties->image->height;
   const int pixelmapLen = width * height;
-  
+
   unsigned char dotValue;
-  
+
   if (strength < NUM_COLORS)
     dotValue = (unsigned char)strength;
-  else 
+  else
     dotValue = NUM_COLORS - 1;
-  
+
   int i = 0;
   for (i = 0; i < xLen && i < yLen; ++i)
     {
       const int x = sx + i * xInc;
       const int y = sy + i * yInc;
-      
-      if (x >= 0 && x < width && y >= 0 && y < height) 
+
+      if (x >= 0 && x < width && y >= 0 && y < height)
 	{
           const int dotpos = width * (y) + x;
 
           /* Use the new value if greater than the existing value. Ignore pixels out of range. */
-          if (dotpos >= 0 && dotpos < pixelmapLen && dotValue > properties->hspPixmap[dotpos]) 
+          if (dotpos >= 0 && dotpos < pixelmapLen && dotValue > properties->hspPixmap[dotpos])
             {
               properties->hspPixmap[dotpos] = dotValue;
             }
@@ -2796,7 +2797,7 @@ static void getMspScreenCoords(const MSP* const msp, DotplotProperties *properti
   getPosFromCoords(properties, qStart, sStart, sx, sy);
   getPosFromCoords(properties, qEnd, sEnd, ex, ey);
 }
-  
+
 
 static void drawHsps(GtkWidget *dotplot, GdkDrawable *drawable)
 {
@@ -2811,27 +2812,27 @@ static void drawHsps(GtkWidget *dotplot, GdkDrawable *drawable)
   GdkGC *gc = gdk_gc_new(drawable);
 
   DotterContext *dc = properties->dotterWinCtx->dotterCtx;
-  
+
   /* we'll clip the hsp lines to the dotplot drawing area */
   gdk_gc_set_clip_origin(gc, 0, 0);
   gdk_gc_set_clip_rectangle(gc, &properties->plotRect);
-  
+
   /* Loop through all MSPs */
   MSP *msp = dc->mspList;
   int sx, ex, sy, ey; /* start/end coordinates [0..n] */
-  
+
   for (msp = dc->mspList; msp;  msp = msp->next)
-    {    
+    {
       const char *mspName = getShortMspName(msp);
       if (!mspName || strcmp(mspName, dc->matchSeqName) != 0)
         {
           /* Not an MSP from our sequence */
           continue;
         }
-        
+
       getMspScreenCoords(msp, properties, &sx, &ex, &sy, &ey);
-      
-      if (properties->hspMode == DOTTER_HSPS_LINE) 
+
+      if (properties->hspMode == DOTTER_HSPS_LINE)
         {
           /* Draw in red */
           GdkColor hspLineColor;
@@ -2845,12 +2846,12 @@ static void drawHsps(GtkWidget *dotplot, GdkDrawable *drawable)
         {
           /* Get color based on score: */
           GdkColor scoreColor;
-          
+
           if (msp->score < 75.0)
             {
               gdk_color_parse("dark red", &scoreColor);
             }
-          if (msp->score < 100.0) 
+          if (msp->score < 100.0)
             {
               gdk_color_parse("magenta", &scoreColor);
             }
@@ -2858,14 +2859,14 @@ static void drawHsps(GtkWidget *dotplot, GdkDrawable *drawable)
             {
               gdk_color_parse("red", &scoreColor);
             }
-          
+
           gdk_colormap_alloc_color(gdk_colormap_get_system(), &scoreColor, TRUE, TRUE);
           gdk_gc_set_foreground(gc, &scoreColor);
-          
+
           gdk_draw_line(drawable, gc, sx, sy, ex, ey);
         }
     }
-  
+
   g_object_unref(gc);
 }
 
@@ -2874,18 +2875,18 @@ static void drawHsps(GtkWidget *dotplot, GdkDrawable *drawable)
 static void drawRubberBand(GtkWidget *dotplot, GdkDrawable *drawable)
 {
   DotplotProperties *properties = dotplotGetProperties(dotplot);
-  
+
   if (properties->dragStart.x != UNSET_INT && properties->dragEnd.x != UNSET_INT)
     {
       GdkGC *gc = gdk_gc_new(drawable);
-      
+
       gdk_gc_set_function(gc, GDK_INVERT);
-      
+
       gdk_draw_line(drawable, gc, properties->dragStart.x, properties->dragStart.y, properties->dragEnd.x, properties->dragStart.y);
       gdk_draw_line(drawable, gc, properties->dragStart.x, properties->dragStart.y, properties->dragStart.x, properties->dragEnd.y);
       gdk_draw_line(drawable, gc, properties->dragStart.x, properties->dragEnd.y, properties->dragEnd.x, properties->dragEnd.y);
       gdk_draw_line(drawable, gc, properties->dragEnd.x, properties->dragStart.y, properties->dragEnd.x, properties->dragEnd.y);
-      
+
       g_object_unref(gc);
     }
 }
@@ -2901,24 +2902,24 @@ static GdkColormap *insertGreyRamp (DotplotProperties *properties)
 
   GdkVisual *visual = gdk_visual_get_system();
   GdkColormap *cmap = gdk_colormap_get_system();
-  
-  if (visual->type == GDK_VISUAL_PSEUDO_COLOR) 
+
+  if (visual->type == GDK_VISUAL_PSEUDO_COLOR)
     {
       g_critical("Pseudo-color display not supported.\n");
     }
-  
+
   /* true color display */
   int i = 0;
-  
+
   for (i = 0; i < NUM_COLORS; i++)
     {
       properties->greyRamp[i].red = i<<8;
       properties->greyRamp[i].green =  i<<8;
       properties->greyRamp[i].blue = i<<8;
     }
-  
+
   gdk_colormap_alloc_colors(cmap, properties->greyRamp, NUM_COLORS, FALSE, TRUE, success);
-  
+
   return cmap;
 }
 
@@ -2932,18 +2933,18 @@ static void transformGreyRampImage(GdkImage *image, unsigned char *pixmap, Dotpl
       g_warning("Pixelmap is NULL; image will not be drawn.\n");
       return;
     }
-    
+
   /* Note1 : here we stick to client byte-order, and rely on Xlib to swap
    if the server is different */
-  
+
   /* Note2: The exact function of this routine depends on the visual. If it's
-   a pseudo color visual, we're just getting the pixel values for the 
+   a pseudo color visual, we're just getting the pixel values for the
    greyramp colormap entries. These values don't change, but the colors
-   they represent do. If it's a true-colour visual, the map entries 
-   are changed to give the correct values. It so happens that the 
-   transformation here is the same in both cases, this is not true 
+   they represent do. If it's a true-colour visual, the map entries
+   are changed to give the correct values. It so happens that the
+   transformation here is the same in both cases, this is not true
    for changing the grey-ramp. */
-  
+
   int row, col;
 #if G_BYTE_ORDER == G_BIG_ENDIAN
   DEBUG_OUT("G_BYTE_ORDER == G_BIG_ENDIAN\n");
@@ -2953,29 +2954,29 @@ static void transformGreyRampImage(GdkImage *image, unsigned char *pixmap, Dotpl
   gboolean byterev = (image->byte_order == GDK_MSB_FIRST);
 #endif
 
-  DEBUG_OUT("width=%d, height=%d, byterev=%d, image->bpp=%d, image->bpl=%d\n", 
+  DEBUG_OUT("width=%d, height=%d, byterev=%d, image->bpp=%d, image->bpl=%d\n",
             image->width, image->height, byterev, image->bpp, image->bpl);
-  
+
   /* Switch on the number of bytes per pixel */
   switch (image->bpp)
-  { 
+  {
     case 1:
       for (row = 0; row < image->height; row++)
-	{ 
+	{
 	  guint8 *ptr = ((guint8 *)image->mem) + row * image->bpl;
-	  guint8 *sptr = ((guint8 *)pixmap) + row * image->width; 
+	  guint8 *sptr = ((guint8 *)pixmap) + row * image->width;
 	  for (col = 0 ; col < image->width; col++)
 	    *ptr++ = (guint8) properties->greyMap[*sptr++];
 	}
       break;
     case 2:
       for (row = 0; row < image->height; row++)
-	{ 
+	{
 	  guint16 *ptr = (guint16 *)(((guint8 *)(image->mem))+row*image->bpl);
 	  guint8 *sptr = ((guint8 *)pixmap) +row * image->width;
 	  if (byterev)
 	    for (col = 0 ; col < image->width; col++)
-	      { 
+	      {
 		guint32 pixel = properties->greyMap[*sptr++];
 		*ptr++ = ((pixel & 0xff00) >> 8) | ((pixel & 0xff) << 8);
 	      }
@@ -2986,28 +2987,28 @@ static void transformGreyRampImage(GdkImage *image, unsigned char *pixmap, Dotpl
       break;
     case 3:
       for (row = 0; row < image->height; row++)
-	{ 
+	{
 	  guint8 *ptr = ((guint8 *)image->mem) + row*image->bpl;
 	  guint8 *sptr = ((guint8 *)pixmap) +row * image->width;
 	  for (col = 0 ; col < image->width; col++)
 	    {
-	      guint32 pixel = properties->greyMap[*sptr++]; 
+	      guint32 pixel = properties->greyMap[*sptr++];
 	      *ptr++ = (guint8)pixel;
 	      *ptr++ = (guint8)(pixel>>8);
-	      *ptr++ = (guint8)(pixel>>16); 
+	      *ptr++ = (guint8)(pixel>>16);
 	    }
 	}
       break;
     case 4:
       for (row = 0; row < image->height; row++)
-	{ 
+	{
 	  guint32 *ptr = (guint32 *)(((guint8 *)image->mem) + row*image->bpl);
 	  guint8 *sptr = ((guint8 *)pixmap) +row * image->width;
 	  if (byterev)
 	    for (col = 0 ; col < image->width; col++)
-	      { 
+	      {
 		guint32 pixel = properties->greyMap[*sptr++];
-		*ptr++ = 
+		*ptr++ =
                 ((pixel & 0xff000000) >> 24) |
                 ((pixel & 0xff0000) >> 8) |
                 ((pixel & 0xff00) << 8) |
@@ -3038,7 +3039,7 @@ void dotplotUpdateGreymap(GtkWidget *dotplot, gpointer data)
 
   DotplotProperties *properties = dotplotGetProperties(dotplot);
   unsigned char *ramp = (unsigned char*)data;
-  
+
   /* First calculate the new mapping from weight to pixels */
   int i = 0;
   for (i = 0; i < NUM_COLORS; i++)
@@ -3046,9 +3047,9 @@ void dotplotUpdateGreymap(GtkWidget *dotplot, gpointer data)
       GdkColor *color = &properties->greyRamp[ramp[i]];
       properties->greyMap[i] = color->pixel;
     }
-  
+
   /* Now recreate the image from the pixmap. Use the HSP pixmap if enabled, otherwise
-   * use the standard pixelmap. */ 
+   * use the standard pixelmap. */
   if (properties->hspMode == DOTTER_HSPS_GREYSCALE)
     {
       transformGreyRampImage(properties->image, properties->hspPixmap, properties);
@@ -3057,26 +3058,26 @@ void dotplotUpdateGreymap(GtkWidget *dotplot, gpointer data)
     {
       transformGreyRampImage(properties->image, properties->pixelmap, properties);
     }
-  
+
   widgetClearCachedDrawable(dotplot, NULL);
   gtk_widget_queue_draw(dotplot);
-  
+
   DEBUG_EXIT("dotplotUpdateGreymap returning ");
 }
 
 
 /* Get the reference/match sequence coords at the given x/y position */
-static void getCoordsFromPos(GtkWidget *dotplot, const int x, const int y, 
+static void getCoordsFromPos(GtkWidget *dotplot, const int x, const int y,
 			     int *refCoord, int *matchCoord)
 {
   DotplotProperties *properties = dotplotGetProperties(dotplot);
   DotterWindowContext *dwc = properties->dotterWinCtx;
   DotterContext *dc = properties->dotterWinCtx->dotterCtx;
-  
+
   /* For ref seq, convert to number of nucleotides */
   gdouble scaleFactor = getScaleFactor(properties, TRUE);
   const int numBasesHoz = (x - properties->plotRect.x) * scaleFactor;
-  
+
   if (dc->hozScaleRev)
     {
       *refCoord = dwc->refSeqRange.max() - numBasesHoz;
@@ -3091,8 +3092,8 @@ static void getCoordsFromPos(GtkWidget *dotplot, const int x, const int y,
   boundsLimitValue(refCoord, &dwc->refSeqRange);
 
   scaleFactor = getScaleFactor(properties, FALSE);
-  const int numBasesVert = (y - properties->plotRect.y) * scaleFactor;  
-  
+  const int numBasesVert = (y - properties->plotRect.y) * scaleFactor;
+
   if (dc->vertScaleRev)
     {
       *matchCoord = dwc->matchSeqRange.max() - numBasesVert;
@@ -3101,7 +3102,7 @@ static void getCoordsFromPos(GtkWidget *dotplot, const int x, const int y,
     {
       *matchCoord = dwc->matchSeqRange.min() + numBasesVert;
     }
-  
+
   /* Round to nearest whole pixel and limit to valid range */
   *matchCoord = roundToValue(*matchCoord, getResFactor(dc, FALSE));
   boundsLimitValue(matchCoord, &dwc->matchSeqRange);
@@ -3115,9 +3116,9 @@ static void setCoordsFromPos(GtkWidget *dotplot, const int x, const int y)
   DotterWindowContext *dwc = properties->dotterWinCtx;
 
   getCoordsFromPos(dotplot, x, y, &dwc->refCoord, &dwc->matchCoord);
-  
+
   refreshDotplot(dotplot);
-}  
+}
 
 
 /* Get the x,y position of the given coords */
@@ -3125,7 +3126,7 @@ static void getPosFromCoords(DotplotProperties *properties, int qCoord, int sCoo
 {
   DotterWindowContext *dwc = properties->dotterWinCtx;
   DotterContext *dc = properties->dotterWinCtx->dotterCtx;
-  
+
   const gdouble hScaleFactor = getScaleFactor(properties, TRUE);
   const gdouble vScaleFactor = getScaleFactor(properties, FALSE);
 
@@ -3136,7 +3137,7 @@ static void getPosFromCoords(DotplotProperties *properties, int qCoord, int sCoo
       else
 	*x = properties->plotRect.x + (qCoord - dwc->refSeqRange.min()) / hScaleFactor;
     }
-  
+
   if (y)
     {
       if (dc->vertScaleRev)
@@ -3162,16 +3163,16 @@ static void boundsLimitPoint(GdkPoint *point, GdkRectangle *rect)
 {
   if (point->x < rect->x)
     point->x = rect->x;
-  
+
   if (point->x > rect->x + rect->width)
     point->x = rect->x + rect->width;
-  
+
   if (point->y < rect->y)
     point->y = rect->y;
-  
+
   if (point->y > rect->y + rect->height)
     point->y = rect->y + rect->height;
-  
+
 }
 
 
@@ -3180,7 +3181,7 @@ static void setPoint(GdkPoint *point, const int x, const int y, GdkRectangle *re
 {
   point->x = x;
   point->y = y;
-  
+
   if (rect)
     boundsLimitPoint(point, rect);
 }
@@ -3200,13 +3201,13 @@ static gdouble getScaleFactor(DotplotProperties *properties, const gboolean hori
  */
 #ifdef ALPHA
 static void reversebytes(void *ptr, int n)
-{ 
+{
   static char copy[256], *cp;
   int  i;
-  
+
   cp = ptr;
   memcpy(copy, ptr, n);  /* Note: strcpy doesn't work - stops at \0 */
-  
+
   for(i=0; i<n; i++) *cp++ = copy[n-i-1];
 }
 #endif
@@ -3229,7 +3230,7 @@ static bool saveAsBinaray(FILE *saveFile, DotplotProperties *properties, GError
   /* Get the length of the matrix name */
   const gint32 MNlen = strlen(dc->matrixName);
   gint32 MNlenSave = MNlen;
-  
+
 #ifdef ALPHA
   reversebytes(&dwc->zoomFactor, sizeof(gdouble));
   reversebytes(&properties->imageWidth, sizeof(gint32));
@@ -3238,7 +3239,7 @@ static bool saveAsBinaray(FILE *saveFile, DotplotProperties *properties, GError
   reversebytes(&slidingWinSize, sizeof(gint32));
   reversebytes(&MNlenSave, sizeof(gint32));
 #endif
-  
+
   ok = fwrite(&format, 1, sizeof(unsigned char), saveFile) == sizeof(unsigned char);
   ok &= fwrite(&dwc->zoomFactor, 1, sizeof(gdouble), saveFile) == sizeof(gdouble);
   ok &= fwrite(&properties->imageWidth, 1, sizeof(gint32), saveFile) == sizeof(gint32);
@@ -3247,13 +3248,13 @@ static bool saveAsBinaray(FILE *saveFile, DotplotProperties *properties, GError
   ok &= fwrite(&properties->slidingWinSize, 1, sizeof(gint32), saveFile) == sizeof(gint32); /* New feature of format 2  */
   ok &= fwrite(&MNlenSave, 1, sizeof(gint32), saveFile) == sizeof(gint32); /* New feature of format 2  */
   ok &= fwrite(dc->matrixName, sizeof(char), MNlen, saveFile) == sizeof(char) * MNlen; /* New feature of format 2  */
-  
-  
+
+
   /* Loop through the matrix and write the values to the file */
   int i = 0;
   int j = 0;
   gint32 mtx = 0;
-  
+
   for (i = 0; i < CONS_MATRIX_SIZE; i++)
     {
       for (j = 0; j < CONS_MATRIX_SIZE; j++)
@@ -3265,7 +3266,7 @@ static bool saveAsBinaray(FILE *saveFile, DotplotProperties *properties, GError
           ok &= fwrite(&mtx, 1, sizeof(gint32), saveFile) == sizeof(gint32); /* New feature of format 2  */
         }
     }
-  
+
 #ifdef ALPHA
   reversebytes(&dwc->zoomFactor, sizeof(gdouble));
   reversebytes(&properties->imageWidth, sizeof(gint32));
@@ -3273,23 +3274,23 @@ static bool saveAsBinaray(FILE *saveFile, DotplotProperties *properties, GError
   reversebytes(&pixelFac, sizeof(gint32));
   reversebytes(&slidingWinSize, sizeof(gint32));
 #endif
-  
-  
+
+
   /* Loop through the dotplot values and write them to file */
   const int imgSize = properties->imageWidth * properties->imageHeight;
-  
+
   for (i = 0; i < imgSize; i++)
     {
       unsigned char pixelVal = properties->pixelmap[i];
 #ifdef ALPHA
       reversebytes(&pixelVal, sizeof(unsigned char));
 #endif
-      ok &= fwrite(&pixelVal, 1, sizeof(unsigned char), saveFile) == sizeof(unsigned char); 
+      ok &= fwrite(&pixelVal, 1, sizeof(unsigned char), saveFile) == sizeof(unsigned char);
     }
-  
-  
+
+
 //  ok &= fwrite(properties->pixelmap, sizeof(unsigned char), imgSize, saveFile) == imgSize;
-  
+
   return ok ;
 }
 
@@ -3305,7 +3306,7 @@ static bool saveAsAscii(FILE *saveFile, DotplotProperties *properties, GError **
    * compatibility with the current format. */
   unsigned int format = 3;
 
-  int index ;  
+  int index ;
   int i;
   int j;
   gint32 mtx;
@@ -3325,16 +3326,16 @@ static bool saveAsAscii(FILE *saveFile, DotplotProperties *properties, GError **
     goto failure ;
   if (!(result = (fprintf(saveFile, "MatrixName\t%s\n", dc->matrixName) != 0)))
     goto failure ;
-  
-  
+
+
   /* Loop through the matrix and write the values to the file */
   i = 0;
   j = 0;
   mtx = 0;
-  
+
   if (!(result = (fprintf(saveFile, "%s %d %d\n", "ScoreMatrix", CONS_MATRIX_SIZE, CONS_MATRIX_SIZE) != 0)))
     goto failure ;
-  
+
   for (i = 0; i < CONS_MATRIX_SIZE; i++)
     {
       for (j = 0; j < CONS_MATRIX_SIZE; j++)
@@ -3349,12 +3350,12 @@ static bool saveAsAscii(FILE *saveFile, DotplotProperties *properties, GError **
         goto failure ;
 
     }
-  
+
   /* Loop through the dotplot values and write them to file */
   if (!(result = (fprintf(saveFile, "%s %d %d\n",
                           "PlotValues", properties->imageWidth, properties->imageHeight) != 0)))
     goto failure ;
-  
+
   for (index = 0, i = 0; i < properties->imageHeight; i++)
     {
       for (j = 0; j < properties->imageWidth; j++)
@@ -3371,14 +3372,11 @@ static bool saveAsAscii(FILE *saveFile, DotplotProperties *properties, GError **
         goto failure ;
 
     }
-  
+
 
   // May jump to here on failure.
  failure:
 
-  
+
   return result ;
 }
-
-
-
diff --git a/src/dotterApp/dotter.cpp b/src/dotterApp/dotter.cpp
index 8fdd535eca0dfec61358c047b76018a64a682a54..514a26c735240e20ee7e1abe9db533ca9e6dd0e6 100644
--- a/src/dotterApp/dotter.cpp
+++ b/src/dotterApp/dotter.cpp
@@ -1,5 +1,6 @@
 /*  File: dotplot.c
  *  Author: Erik Sonnhammer, 1993-09-04
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -29,7 +30,7 @@
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
  * Description: This file contains functions that initialise Dotter and create
- *              the main Dotter window. 
+ *              the main Dotter window.
  *----------------------------------------------------------------------------
  */
 
@@ -88,14 +89,14 @@ using namespace std;
 //#define TINT_WHITE      0x00
 //#define TINT_HIGHLIGHT1 0x01  /* highest priority, dna highlighting */
 //#define TINT_HIGHLIGHT2 0x02  /* highlight friends */
-//#define TINT_RED        0x04 
-//#define TINT_LIGHTGRAY  0x08 
-//#define TINT_MAGENTA    0x10 
-//#define TINT_CYAN       0x20 
-//#define TINT_LIGHTGREEN 0x40 
-//#define TINT_YELLOW     0x80 
-
-//static int tints[8] = { LIGHTRED, MIDBLUE, RED, LIGHTGRAY, 
+//#define TINT_RED        0x04
+//#define TINT_LIGHTGRAY  0x08
+//#define TINT_MAGENTA    0x10
+//#define TINT_CYAN       0x20
+//#define TINT_LIGHTGREEN 0x40
+//#define TINT_YELLOW     0x80
+
+//static int tints[8] = { LIGHTRED, MIDBLUE, RED, LIGHTGRAY,
 //                      MAGENTA, CYAN, LIGHTGREEN, YELLOW } ;
 
 #define MAX_WINDOW_WIDTH_FRACTION             0.8 /* max init width of dotter window as fraction of screen size */
@@ -108,7 +109,7 @@ using namespace std;
 //class GeneDataStruct
 //{
 //public:
-//  GeneDataStruct() : name(NULL), start(0), end(0), strand(0), 
+//  GeneDataStruct() : name(NULL), start(0), end(0), strand(0),
 //                     msp_start(NULL), msp_end(NULL), y_pos(0.0) {};
 //
 //  const char *name ;
@@ -141,7 +142,7 @@ public:
   GtkWidget *alignmentWindow;               /* the window containing the alignment tool when undocked */
   GtkWidget *alignmentContainer;            /* the container containing the alignment tool when docked */
   GtkWidget *dotplot;                       /* the dotplot drawing area */
-  
+
   gboolean windowsDocked;                   /* if true, all tools are docked into a single window */
   DotterWindowContext *dotterWinCtx;
   const char *exportFileName;
@@ -400,7 +401,7 @@ static int    MATRIX[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE];
 
 /*  BLOSUM62 930809
 
-     A   R   N   D   C   Q   E   G   H   I   L   K   M   F   P   S   T   W   Y   V   B   Z   X  \* */ 
+     A   R   N   D   C   Q   E   G   H   I   L   K   M   F   P   S   T   W   Y   V   B   Z   X  \* */
 int BLOSUM62[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE] = {
   {  4, -1, -2, -2,  0, -1, -1,  0, -2, -1, -1, -1, -1, -2, -1,  1,  0, -3, -2,  0, -2, -1,  0, -4 },
   { -1,  5,  0, -2, -3,  1,  0, -2,  0, -3, -2,  2, -1, -3, -2, -1, -1, -3, -2, -3, -1,  0, -1, -4 },
@@ -451,7 +452,7 @@ static void destroyDotterColors(DotterContext *dc)
     return;
 
   int i = DOTCOLOR_MIN + 1;
-  
+
   for ( ; i < DOTCOLOR_NUM_COLORS; ++i)
     {
       BlxColor *blxColor = &g_array_index(dc->defaultColors, BlxColor, i);
@@ -469,7 +470,7 @@ static void createDotterColors(DotterContext *dc)
   /* Initialise the array with empty BlxColor structs */
   dc->defaultColors = g_array_sized_new(FALSE, FALSE, sizeof(BlxColor), DOTCOLOR_NUM_COLORS);
   int i = DOTCOLOR_MIN + 1;
-  
+
   for ( ; i < DOTCOLOR_NUM_COLORS; ++i)
     {
       BlxColor *blxColor = new BlxColor;
@@ -485,12 +486,12 @@ static void createDotterColors(DotterContext *dc)
   createBlxColor(dc->defaultColors, DOTCOLOR_BACKGROUND, "Background", "Background color", defaultBgColorStr, BLX_WHITE, "#bdbdbd", NULL);
   g_free(defaultBgColorStr);
   gtk_widget_destroy(tmp);
-  
+
   /* matches */
   createBlxColor(dc->defaultColors, DOTCOLOR_MATCH, "Exact match", "Exact match", BLX_LIGHT_CYAN, BLX_LIGHT_CYAN, BLX_CYAN, BLX_CYAN);
   createBlxColor(dc->defaultColors, DOTCOLOR_CONS, "Conserved match", "Conserved match", BLX_VIOLET, BLX_VIOLET, BLX_DARK_VIOLET, BLX_DARK_VIOLET);
   createBlxColor(dc->defaultColors, DOTCOLOR_MISMATCH, "Mismatch", "Mismatch", "#cacaca", BLX_WHITE, "#cacaca", BLX_WHITE);
-  
+
   /* exons */
   createBlxColor(dc->defaultColors, DOTCOLOR_EXON_FILL, "Exon fill color", "Exon fill color", BLX_YELLOW, BLX_YELLOW, NULL, NULL);
   createBlxColor(dc->defaultColors, DOTCOLOR_EXON_LINE, "Exon line color", "Exon outline color", BLX_BLUE, BLX_BLUE, NULL, NULL);
@@ -522,7 +523,7 @@ static gdouble getInitZoomFactor(DotterContext *dc, const gdouble zoomFacIn, con
   DEBUG_ENTER("getInitZoomFactor");
 
   gdouble result = zoomFacIn;
-  
+
   if (result <= 0)
     {
       if (dc->memoryLimit)
@@ -534,14 +535,14 @@ static gdouble getInitZoomFactor(DotterContext *dc, const gdouble zoomFacIn, con
           g_error("Cannot calculate zoom; division by 0 (memory limit is 0).\n");
         }
     }
-  
+
   DEBUG_EXIT("getInitZoomFactor returning %f", result);
   return result;
 }
 
 
 static DotterContext* createDotterContext(DotterOptions *options,
-                                          BlxBlastMode blastMode, 
+                                          BlxBlastMode blastMode,
                                           const gboolean showWindow,
                                           const BlxStrand refSeqStrand,
                                           const BlxStrand matchSeqStrand,
@@ -553,7 +554,7 @@ static DotterContext* createDotterContext(DotterOptions *options,
   DEBUG_ENTER("createDotterContext");
 
   DotterContext *result = new DotterContext;
-  
+
   result->blastMode = blastMode;
   result->displaySeqType = (blastMode == BLXMODE_BLASTN) ? BLXSEQ_DNA : BLXSEQ_PEPTIDE;
   result->numFrames = (blastMode == BLXMODE_BLASTX) ? 3 : 1;
@@ -564,10 +565,10 @@ static DotterContext* createDotterContext(DotterOptions *options,
   result->seqList = seqList;
   result->windowList = NULL;
   result->abbrevTitle = options->abbrevTitle;
-  
+
   result->watsonOnly = options->watsonOnly;
   result->crickOnly = options->crickOnly;
-  
+
   /* Set the fixed-width font (not applicable in batch mode) */
   if (showWindow)
     {
@@ -582,12 +583,12 @@ static DotterContext* createDotterContext(DotterOptions *options,
     {
       result->fontDesc = NULL;
     }
-  
+
   result->refSeqName = g_strdup(options->qname);
   result->refSeq = options->qseq; /* take ownership of passed-in seq */
   result->refSeqRev = NULL;
   result->refSeqType = (blastMode == BLXMODE_BLASTP ? BLXSEQ_PEPTIDE : BLXSEQ_DNA);
-  
+
   /* for dna ref sequences, reverse-complement the ref seq */
   if (result->refSeqType == BLXSEQ_DNA && result->refSeq)
     {
@@ -600,7 +601,7 @@ static DotterContext* createDotterContext(DotterOptions *options,
       result->refSeqRev = g_strdup(result->refSeq);
       g_strreverse(result->refSeqRev);
     }
-  
+
   result->refSeqStrand = refSeqStrand;
 
   result->matchSeqName = g_strdup(options->sname);
@@ -608,21 +609,21 @@ static DotterContext* createDotterContext(DotterOptions *options,
   result->matchSeqRev = NULL;
   result->matchSeqType = (blastMode == BLXMODE_BLASTN ? BLXSEQ_DNA : BLXSEQ_PEPTIDE);
   result->matchSeqStrand = matchSeqStrand;
-  
+
   result->refSeqFullRange.set(options->qoffset + 1, options->qoffset + strlen(options->qseq));
   result->matchSeqFullRange.set(options->soffset + 1, options->soffset + strlen(options->sseq));
-  
+
   result->hozScaleRev = options->hozScaleRev;
   result->vertScaleRev = options->vertScaleRev;
   result->negateCoords = options->negateCoords;
-  
+
   result->displayMirror = options->mirrorImage;
-  
+
   result->memoryLimit = options->memoryLimit;
-  
+
   result->defaultColors = NULL;
-  
-  
+
+
   /* Reverse/comp match seq if applicable */
   if (result->matchSeqType == BLXSEQ_DNA && result->matchSeqStrand == BLXSTRAND_REVERSE && result->matchSeq)
     {
@@ -635,26 +636,26 @@ static DotterContext* createDotterContext(DotterOptions *options,
       result->matchSeqRev = g_strdup(result->matchSeq);
       g_strreverse(result->matchSeqRev);
     }
-  
+
   int i = 0;
   for ( ; i < result->numFrames; ++i)
     {
       result->peptideSeqs[i] = NULL;
     }
-  
-  if (result->blastMode == BLXMODE_BLASTX) 
+
+  if (result->blastMode == BLXMODE_BLASTX)
     {
       /* Create the 3 frame translations (for the strand we're interested in only). */
       const gboolean rev = (result->hozScaleRev);
       char *refSeqToUse = (rev ? result->refSeqRev : result->refSeq);
-      
+
       int i = 0;
       for (i = 0; i < result->numFrames; i++)
         {
           /* Get the start coord at this index and calculate which reading frame it really is
            * (because the first coord in the sequence might not be base 1 in frame 1). */
           const int startCoord = rev ? result->refSeqFullRange.max() - i : result->refSeqFullRange.min() + i;
-        
+
           int frame = UNSET_INT;
           convertToDisplayIdx(startCoord, TRUE, result, 1, &frame);
 
@@ -662,7 +663,7 @@ static DotterContext* createDotterContext(DotterOptions *options,
 
           DEBUG_OUT("Frame %d starts at coord %d for hoz seq strand = %d.\n", frame, startCoord, result->refSeqStrand);
         }
-      
+
       /* Check all of the frames got set */
       for (i = 0; i < result->numFrames; ++i)
         {
@@ -672,19 +673,19 @@ static DotterContext* createDotterContext(DotterOptions *options,
             }
         }
     }
-  
+
   if (showWindow)
-    { 
+    {
       createDotterColors(result);
     }
-  
+
   /* Calculate the height and width of the horizontal and vertical scales */
   const int leftBorderChars = max(numDigitsInInt(result->matchSeqFullRange.min()), numDigitsInInt(result->matchSeqFullRange.max())) + 1;
   result->scaleWidth = DEFAULT_MAJOR_TICK_HEIGHT * 2 + (roundNearest)((gdouble)leftBorderChars * result->charWidth) + SCALE_LINE_WIDTH;
   result->scaleHeight = DEFAULT_MAJOR_TICK_HEIGHT + roundNearest(result->charHeight) + SCALE_LINE_WIDTH;
-  
+
   result->msgData = &options->msgData;
-  
+
   DEBUG_EXIT("createDotterContext returning");
   return result;
 }
@@ -708,7 +709,7 @@ static void destroyDotterContext(DotterContext **dc)
               }
           }
       }
-    
+
     /* destroy the msps, sequence structs and colors */
     destroyMspList(&(*dc)->mspList);
     destroyBlxSequenceList(&(*dc)->seqList);
@@ -717,13 +718,13 @@ static void destroyDotterContext(DotterContext **dc)
     /* Free stuff allocated in calling routine (usually dotterMain) */
     g_free((*dc)->refSeq);
     (*dc)->refSeq = NULL;
-    
+
     g_free((*dc)->refSeqName);
     (*dc)->refSeqName = NULL;
-    
+
     g_free((*dc)->matchSeq);
     (*dc)->matchSeq = NULL;
-    
+
     g_free((*dc)->matchSeqName);
     (*dc)->matchSeqName = NULL;
 
@@ -732,12 +733,12 @@ static void destroyDotterContext(DotterContext **dc)
           g_free((*dc)->matrixName);
           (*dc)->matrixName = NULL;
         }
-    }  
+    }
 
   /* free the context struct itself */
   delete *dc;
   *dc = NULL;
-  
+
   DEBUG_EXIT("destroyDotterContext returning ");
 }
 
@@ -747,10 +748,10 @@ static void destroyDotterWindowContext(DotterWindowContext **dwc)
 
   if ((*dwc)->printSettings)
     g_object_unref((*dwc)->printSettings);
-  
+
   delete *dwc;
   *dwc = NULL;
-  
+
   DEBUG_EXIT("destroyDotterWindowContext returning ");
 }
 
@@ -764,7 +765,7 @@ static void onDestroyDotterWindow(GtkWidget *dotterWindow)
   DEBUG_ENTER("onDestroyDotterWindow");
 
   DotterProperties *properties = dotterGetProperties(dotterWindow);
-  
+
   if (properties)
     {
       if (properties->dotterWinCtx)
@@ -797,7 +798,7 @@ static void onDestroyDotterWindow(GtkWidget *dotterWindow)
       properties = NULL;
       g_object_set_data(G_OBJECT(dotterWindow), "DotterProperties", NULL);
     }
-  
+
   DEBUG_EXIT("onDestroyDotterWindow returning ");
 }
 
@@ -812,12 +813,12 @@ static void dotterContextCloseAllWindows(DotterContext *dc)
    * windows. Also, when the last window is destroyed, dc will be destroyed. So: loop while we
    * still have more than one entry in the list. We know we must quit after the last entry. */
   int len = g_slist_length(dc->windowList);
-  
+
   while (len > 0)
     {
       GtkWidget *window = GTK_WIDGET(dc->windowList->data);
       gtk_widget_destroy(window);
-      
+
       if (len == 1) /* just processed the last one so break */
         break;
       else
@@ -831,7 +832,7 @@ static gboolean closeWindow(GtkWidget *widget)
 {
   gboolean handled = FALSE;
   const char *name = gtk_widget_get_name(widget);
-  
+
   if (name && strcmp(name, MAIN_WINDOW_NAME) == 0)
     {
       handled = TRUE;
@@ -849,10 +850,10 @@ int convertToDisplayIdx(const int dnaIdx, const gboolean horizontal, DotterConte
   //DEBUG_ENTER("convertToDisplayIdx(dnaIdx=%d, hoz=%d, frameIn=%d)", dnaIdx, horizontal, frameIn);
 
   int result = dnaIdx;
-  
+
   if (baseNum)
     *baseNum = 1;
-  
+
   /* Match seq coords are always in display coords already, so only do anything if this is the
    * ref seq. Also, we only need to convert if it's peptide-nucleotide match. */
   if (horizontal && dc->blastMode == BLXMODE_BLASTX)
@@ -860,38 +861,38 @@ int convertToDisplayIdx(const int dnaIdx, const gboolean horizontal, DotterConte
       /* If the strand is reversed, the frame will be inverted; un-invert it first */
       const gboolean rev = (horizontal && dc->hozScaleRev) || (!horizontal && dc->vertScaleRev);
       int frame = frameIn;
-      
+
       double fraction = 0.0;
-      
+
       if (rev)
         fraction = (double)(dnaIdx + frame - 1) / (double)dc->numFrames;
       else
         fraction = (double)(dnaIdx - frame + 1) / (double)dc->numFrames;
-      
+
       DEBUG_OUT("frame=%d, fraction=%f\n", frame, fraction);
 
       /* Round to the higher value so that 0.3, 0.6 and 1.0 all round
        * to the same value. If values are negative this still works; 0, -0.3
        * and -0.6 will all round to 0.
        *
-       * To illustrate (the top section shows nucleotide coords, reading 
-       * from top-to-bottom then left-to-right): 
-       * 
+       * To illustrate (the top section shows nucleotide coords, reading
+       * from top-to-bottom then left-to-right):
+       *
        *              Display forwards        Display reversed
        * Frame1:         -5 -2  1  4             6  3  0 -3
        * Frame2:         -4 -1  2  5             5  2 -1 -4
        * Frame3:         -3  0  3  6             4  1 -2 -5
-       * 
+       *
        * Peptide coord:  -1  0  1  2             2  1  0 -1
        *
        * */
       result = ceil(fraction);
-    
+
       /* We want base 1 in the requested reading frame. */
       if (baseNum)
         {
           *baseNum = (dnaIdx - frame + 1) % dc->numFrames;
-        
+
           /* If we have a negative base number, adding 3 shifts it to the
            * correct base number. (This also fixes the fact that mod3 gives 0
            * for base 3.) */
@@ -906,25 +907,25 @@ int convertToDisplayIdx(const int dnaIdx, const gboolean horizontal, DotterConte
             }
         }
     }
-  
+
   //DEBUG_EXIT("convertToDisplayIdx returning %d", result);
   return result;
 }
 
 
 /* Convert a display index (dna or peptide) to a dna index (original sequence coord),
- * if applicable. If horizontal is true we have the horizontal (reference) sequence, 
+ * if applicable. If horizontal is true we have the horizontal (reference) sequence,
  * otherwise the vertical (match) sequence. */
-int convertToDnaIdx(const int displayIdx, 
-                    const gboolean horizontal, 
-                    DotterContext *dc, 
-                    const int frame, 
+int convertToDnaIdx(const int displayIdx,
+                    const gboolean horizontal,
+                    DotterContext *dc,
+                    const int frame,
                     int baseNum)
 {
   DEBUG_ENTER("convertToDnaIdx(displayIdx=%d, hoz=%d, frame=%d, base=%d)", displayIdx, horizontal, frame, baseNum);
 
   int result = displayIdx;
-  
+
   /* Match seq coords are always in display coords already, so only do anything if this is the
    * ref seq. Also, we only need to convert if it's peptide-nucleotide match. */
   if (horizontal && dc->blastMode == BLXMODE_BLASTX)
@@ -933,10 +934,10 @@ int convertToDnaIdx(const int displayIdx,
         result = (displayIdx * dc->numFrames) - dc->numFrames - frame + baseNum + 1;
       else
         result = (displayIdx * dc->numFrames) - dc->numFrames + frame + baseNum - 1;
-      
+
       DEBUG_OUT("dnaIdx=%d\n", result);
     }
-  
+
   DEBUG_EXIT("convertToDnaIdx returning %d", result);
   return result;
 }
@@ -951,35 +952,35 @@ static DotterWindowContext* createDotterWindowContext(DotterContext *dotterCtx,
   DEBUG_ENTER("createDotterWindowContext");
 
   DotterWindowContext *result = new DotterWindowContext;
-  
+
   result->dotterCtx = dotterCtx;
-  
+
   result->refSeqRange.set(refSeqRange);
   result->matchSeqRange.set(matchSeqRange);
 
   result->refCoord = UNSET_INT;
   result->matchCoord = UNSET_INT;
-  
+
   result->zoomFactor = getInitZoomFactor(dotterCtx, zoomFacIn, refSeqRange->length(), matchSeqRange->length());
 
   /* See if we're comparing the same portion of sequence against itself */
-  result->selfComp = (refSeqRange->min() == matchSeqRange->min() && 
+  result->selfComp = (refSeqRange->min() == matchSeqRange->min() &&
                       refSeqRange->max() == matchSeqRange->max() &&
                       stringsEqual(dotterCtx->refSeq, dotterCtx->matchSeq, FALSE));
 
   result->usePrintColors = FALSE;
 
-  if (showWindow) 
+  if (showWindow)
     {
       result->pageSetup = gtk_page_setup_new();
       gtk_page_setup_set_orientation(result->pageSetup, GTK_PAGE_ORIENTATION_LANDSCAPE);
-      
+
       result->printSettings = gtk_print_settings_new();
       gtk_print_settings_set_orientation(result->printSettings, GTK_PAGE_ORIENTATION_LANDSCAPE);
       gtk_print_settings_set_quality(result->printSettings, GTK_PRINT_QUALITY_HIGH);
       gtk_print_settings_set_resolution(result->printSettings, DEFAULT_PRINT_RESOLUTION);
     }
-  else 
+  else
     {
       result->pageSetup = NULL;
       result->printSettings = NULL;
@@ -991,14 +992,14 @@ static DotterWindowContext* createDotterWindowContext(DotterContext *dotterCtx,
     {
       result->dialogList[dialogId] = NULL;
     }
-  
+
   DEBUG_EXIT("createDotterWindowContext returning");
   return result;
 }
 
 /* properties specific to a particular dotter window */
-static void dotterCreateProperties(GtkWidget *dotterWindow, 
-                                   GtkWidget *greyrampTool, 
+static void dotterCreateProperties(GtkWidget *dotterWindow,
+                                   GtkWidget *greyrampTool,
                                    GtkWidget *greyrampWindow,
                                    GtkWidget *greyrampContainer,
                                    GtkWidget *greyrampToolMinimised,
@@ -1027,11 +1028,11 @@ static void dotterCreateProperties(GtkWidget *dotterWindow,
       properties->windowsDocked = DOCK_WINDOWS_DEFAULT;
       properties->dotterWinCtx = dotterWinCtx;
       properties->exportFileName = exportFileName;
-      
+
       g_object_set_data(G_OBJECT(dotterWindow), "DotterProperties", properties);
-      g_signal_connect(G_OBJECT(dotterWindow), "destroy", G_CALLBACK(onDestroyDotterWindow), NULL); 
+      g_signal_connect(G_OBJECT(dotterWindow), "destroy", G_CALLBACK(onDestroyDotterWindow), NULL);
     }
-  
+
   DEBUG_EXIT("dotterCreateProperties returning ");
 }
 
@@ -1052,18 +1053,18 @@ static void updateOnSelectedCoordsChanged(GtkWidget *dotterWindow)
   /* Make sure the coords are in range */
   boundsLimitValue(&properties->dotterWinCtx->refCoord, &properties->dotterWinCtx->refSeqRange);
   boundsLimitValue(&properties->dotterWinCtx->matchCoord, &properties->dotterWinCtx->matchSeqRange);
-  
+
   /* Update the alignment view and dotplot */
   updateAlignmentRange(properties->alignmentTool, properties->dotterWinCtx);
   alignmentToolRedrawAll(properties->alignmentTool);
-  
+
   /* Need to clear cached drawables for the alignment tool but can just refresh the dotplot */
   widgetClearCachedDrawable(properties->alignmentTool, NULL);
   refreshDotplot(properties->dotplot);
 }
 
 
-/* Set the initial currently-selected ref seq and match seq coords (i.e. the coords 
+/* Set the initial currently-selected ref seq and match seq coords (i.e. the coords
  * where the crosshair is centred) */
 static void setInitSelectedCoords(GtkWidget *dotterWindow, const int refCoord, const int matchCoord)
 {
@@ -1071,7 +1072,7 @@ static void setInitSelectedCoords(GtkWidget *dotterWindow, const int refCoord, c
 
   DotterProperties *properties = dotterGetProperties(dotterWindow);
   DotterWindowContext *dwc = properties->dotterWinCtx;
-  
+
   if (valueWithinRange(refCoord, &dwc->refSeqRange))
     dwc->refCoord = refCoord;
   else
@@ -1081,9 +1082,9 @@ static void setInitSelectedCoords(GtkWidget *dotterWindow, const int refCoord, c
     dwc->matchCoord = matchCoord;
   else
     dwc->matchCoord = dwc->matchSeqRange.centre();
-  
+
   updateOnSelectedCoordsChanged(dotterWindow);
-  
+
   DEBUG_EXIT("setInitSelectedCoords returning ");
 }
 
@@ -1106,10 +1107,10 @@ void dotter(const BlxBlastMode blastMode,
 {
   DEBUG_ENTER("dotter(mode=%d, qname=%s, qoff=%d, qstrand=%d, sname=%s, soff=%d, sstrand=%d)",
               blastMode, options->qname, options->qoffset, refSeqStrand, options->sname, options->soffset, matchSeqStrand);
-  
+
   const int qlen = strlen(options->qseq);
   const int slen = strlen(options->sseq);
-  
+
   if (qlen < 1) g_error("queryseq is empty\n");
   if (slen < 1) g_error("subjectseq is empty\n");
 
@@ -1117,20 +1118,20 @@ void dotter(const BlxBlastMode blastMode,
   for (i = 0; i < qlen; i++) options->qseq[i] = toupper(options->qseq[i]);
   for (i = 0; i < slen; i++) options->sseq[i] = toupper(options->sseq[i]);
 
-  if (!options->memoryLimit) 
+  if (!options->memoryLimit)
     {
       options->memoryLimit = 0.5; /* Mb */
     }
 
   /* Get score matrix */
   char *matrixName = (char*)g_malloc((MAX_MATRIX_NAME_LENGTH + 1) * sizeof(char));
-  
-  if (options->mtxfile) 
+
+  if (options->mtxfile)
     {
       readmtx(MATRIX, options->mtxfile);
       strncpy(matrixName, options->mtxfile, MAX_MATRIX_NAME_LENGTH);
     }
-  else if (blastMode == BLXMODE_BLASTN) 
+  else if (blastMode == BLXMODE_BLASTN)
     {
       DNAmatrix(MATRIX);
       strcpy(matrixName, "DNA+5/-4");
@@ -1146,8 +1147,8 @@ void dotter(const BlxBlastMode blastMode,
    * which case we need to create the window so that we have something to print  */
   const gboolean batchMode = (options->savefile || options->exportfile);
   const gboolean createWindow = options->exportfile || !batchMode;
-  
-  if (batchMode) 
+
+  if (batchMode)
     {
       /* Don't do batch processing if output file can't be opened */
       if (options->savefile && !fopen (options->savefile, "wb"))
@@ -1156,7 +1157,7 @@ void dotter(const BlxBlastMode blastMode,
       if (options->exportfile && !fopen (options->exportfile, "wb"))
         g_error("Failed to open %s\n", options->exportfile);
     }
-  
+
   /* Create the main dotter context (shared properties for all dotter windows in this process) */
   DotterContext *dotterCtx = createDotterContext(options, blastMode, createWindow, refSeqStrand, matchSeqStrand, mspList, seqList, MATRIX, matrixName);
 
@@ -1164,7 +1165,7 @@ void dotter(const BlxBlastMode blastMode,
   DotterWindowContext *dotterWinCtx = createDotterWindowContext(dotterCtx, &dotterCtx->refSeqFullRange, &dotterCtx->matchSeqFullRange, options->dotterZoom, createWindow);
 
   /* Create the widgets */
-  createDotterInstance(dotterCtx, 
+  createDotterInstance(dotterCtx,
                        dotterWinCtx,
                        options->loadfile,
                        options->savefile,
@@ -1213,7 +1214,7 @@ static GtkWidget* createDotterInstance(DotterContext *dotterCtx,
   GtkWidget *dotterWindow = NULL;
 
   GtkWidget *dotplot = NULL;
-  GtkWidget *dotplotWidget = createDotplot(dotterWinCtx, 
+  GtkWidget *dotplotWidget = createDotplot(dotterWinCtx,
                                            loadFileName,
                                            saveFileName,
                                            saveFormat,
@@ -1226,7 +1227,7 @@ static GtkWidget* createDotterInstance(DotterContext *dotterCtx,
                                            qcenter,
                                            scenter,
                                            &dotplot);
-  
+
   /* Only create the graphical elements if there is a graphical dotplot widget */
   if (dotplotWidget)
     {
@@ -1257,14 +1258,14 @@ static GtkWidget* createDotterInstance(DotterContext *dotterCtx,
           gtk_container_add(GTK_CONTAINER(alignmentWindow), alignmentTool);
           gtk_container_add(GTK_CONTAINER(greyrampWindow), greyrampTool);
         }
-  
+
       const DotterHspMode hspMode = dotplotGetHspMode(dotplot);
-      dotterWindow = createDotterWindow(dotterCtx, dotterWinCtx, hspMode, 
-                                        dotplot, dotplotWidget, 
-                                        greyrampContainer, alignmentContainer, 
+      dotterWindow = createDotterWindow(dotterCtx, dotterWinCtx, hspMode,
+                                        dotplot, dotplotWidget,
+                                        greyrampContainer, alignmentContainer,
                                         greyrampTool, alignmentTool, greyrampToolMinimised,
                                         exportFileName, windowColor);
-      
+
       /* Set the tool windows as transient for the main window and clear them up when the
        * main window is destroyed */
       gtk_window_set_transient_for(GTK_WINDOW(greyrampWindow), GTK_WINDOW(dotterWindow));
@@ -1282,15 +1283,15 @@ static GtkWidget* createDotterInstance(DotterContext *dotterCtx,
       /* Keep track of all the windows we create, so that we can destroy the DotterContext when
        * the last one is closed */
       dotterCtx->windowList = g_slist_append(dotterCtx->windowList, dotterWindow);
-      
-      dotterCreateProperties(dotterWindow, 
+
+      dotterCreateProperties(dotterWindow,
                              greyrampTool, greyrampWindow, greyrampContainer, greyrampToolMinimised,
                              alignmentTool, alignmentWindow, alignmentContainer,
                              dotplot, dotterWinCtx, exportFileName);
       DotterProperties *properties = dotterGetProperties(dotterWindow);
-      
+
       setInitSelectedCoords(dotterWindow, qcenter, scenter);
-      
+
       updateGreyMap(properties->greyrampTool);
 
       if (MINIMISE_GREYRAMP_DEFAULT)
@@ -1299,7 +1300,7 @@ static GtkWidget* createDotterInstance(DotterContext *dotterCtx,
           setToggleMenuStatus(properties->dotterWinCtx->actionGroup, "ToggleGreyramp", FALSE);
         }
     }
-  
+
   DEBUG_EXIT("createDotterInstance returning ");
   return dotterWindow;
 }
@@ -1307,7 +1308,7 @@ static GtkWidget* createDotterInstance(DotterContext *dotterCtx,
 
 /* Open another dotter window, internal to the existing process (i.e. using the same sequences
  * etc. but just displaying a different range). */
-void callDotterInternal(DotterContext *dc, 
+void callDotterInternal(DotterContext *dc,
                         const IntRange* const refSeqRange,
                         const IntRange* const matchSeqRange,
                         const gdouble zoomFactor,
@@ -1355,9 +1356,9 @@ static void rmExp(void){}
 //float mspGetFsBottomEdge(MSP *msp, float *maxy, float height)
 //{
 //  float result = 0;
-//  
+//
 //  FeatureSeries *fs = mspGetFeatureSeries(msp);
-//  
+//
 //  if (fs)
 //    {
 //      result = fs->y;
@@ -1369,7 +1370,7 @@ static void rmExp(void){}
 //          result = *maxy;
 //        }
 //    }
-//  
+//
 //  return result;
 //}
 
@@ -1386,7 +1387,7 @@ static void rmExp(void){}
 //  if (fs)
 //    {
 //      result = fs->x;
-//      
+//
 //      if (!result)
 //        {
 //          *maxx += height;
@@ -1394,7 +1395,7 @@ static void rmExp(void){}
 //          result = *maxx;
 //        }
 //    }
-//  
+//
 //  return result;
 //}
 
@@ -1418,7 +1419,7 @@ static void rmExp(void){}
 //    float y;
 //
 //    y = ceil((float)(pos - soffset)/zoom);
-//    
+//
 //    y += TopBorder-1;
 //
 //    return y;
@@ -1429,10 +1430,10 @@ static void rmExp(void){}
 //{
 //    /* Horizontal axis */
 //
-//    float  
-//      sx = seq2graphX(mspGetQStart(msp)), 
+//    float
+//      sx = seq2graphX(mspGetQStart(msp)),
 //      ex = seq2graphX(mspGetQEnd(msp));
-//    
+//
 //    offset += TopBorder + slen4 -1;
 //    oldcolor = graphColor(msp->fsColor); oldLinew = graphLinewidth(.25);
 //
@@ -1448,7 +1449,7 @@ static void rmExp(void){}
 //    graphColor(BLACK);
 //    if (fsAnnBottomOn && msp->desc) {
 //      graphText(msp->desc, sx, offset);
-//    }    
+//    }
 //    graphColor(oldcolor); graphLinewidth(oldLinew);
 //}
 
@@ -1456,8 +1457,8 @@ static void rmExp(void){}
 //static void XdrawSEGxy(MSP *msp, float offset)
 //{
 //    int i, inNotFilled=0, descShown=0;
-//    float  
-//      x, y, 
+//    float
+//      x, y,
 //      xold=0, yold=0;
 //
 //    offset += TopBorder + slen4 -1;
@@ -1475,11 +1476,11 @@ static void rmExp(void){}
 //        {
 //          x = seq2graphX(i);
 //          y = offset-1 - (float)xyVal / 100 * fsPlotHeight * fonth;
-//          
+//
 //          if (xold && (x != xold || y != yold) && (!inNotFilled || msp->fsShape == BLXCURVE_INTERPOLATE))
 //            {
 //              graphLine(xold, yold, x, y);
-//              
+//
 //              if (fsAnnBottomOn && msp->desc && !descShown)
 //                {
 //                  int linecolor = graphColor(BLACK);
@@ -1488,13 +1489,13 @@ static void rmExp(void){}
 //                  descShown = 1;
 //                }
 //            }
-//              
+//
 //          xold = x;
 //          yold = y;
 //          inNotFilled = 0;
 //        }
 //      }
-//    
+//
 //    graphColor(oldcolor); graphLinewidth(oldLinew);
 //}
 //
@@ -1503,10 +1504,10 @@ static void rmExp(void){}
 //{
 //    /* Vertical axis */
 //
-//    float  
-//      sx = seq2graphY(mspGetQStart(msp)), 
+//    float
+//      sx = seq2graphY(mspGetQStart(msp)),
 //      ex = seq2graphY(mspGetQEnd(msp));
-//    
+//
 //    offset += LeftBorder + qlen4 -1;
 //    oldcolor = graphColor(msp->fsColor); oldLinew = graphLinewidth(.25);
 //
@@ -1522,7 +1523,7 @@ static void rmExp(void){}
 //    graphColor(BLACK);
 //    if (fsAnnRightOn && msp->desc) {
 //      graphText(msp->desc, offset, sx);
-//    }    
+//    }
 //    graphColor(oldcolor); graphLinewidth(oldLinew);
 //}
 //
@@ -1530,8 +1531,8 @@ static void rmExp(void){}
 //static void YdrawSEGxy(MSP *msp, float offset)
 //{
 //    int i, inNotFilled=0, descShown=0;
-//    float  
-//      x, y, 
+//    float
+//      x, y,
 //      xold=0, yold=0;
 //
 //    offset += LeftBorder + qlen4 -1;
@@ -1540,7 +1541,7 @@ static void rmExp(void){}
 //    for (i = 0; i < qlen; i++)
 //      {
 //      const int xyVal = g_array_index(msp->xy, int, i);
-//      
+//
 //      if (xyVal == XY_NOT_FILLED)
 //        {
 //          inNotFilled = 1;
@@ -1549,12 +1550,12 @@ static void rmExp(void){}
 //        {
 //          x = seq2graphY(i);
 //          y = offset-1 - (float)xyVal / 100 * fsPlotHeight * fonth;
-//          
-//          if (xold && (x != xold || y != yold) && (!inNotFilled || msp->fsShape == BLXCURVE_INTERPOLATE)) 
+//
+//          if (xold && (x != xold || y != yold) && (!inNotFilled || msp->fsShape == BLXCURVE_INTERPOLATE))
 //            {
 //              graphLine(yold, xold, y, x);
-//              
-//              if (fsAnnRightOn && msp->desc && !descShown) 
+//
+//              if (fsAnnRightOn && msp->desc && !descShown)
 //                {
 //                  int linecolor = graphColor(BLACK);
 //                  graphText(msp->desc, offset, xold);
@@ -1568,7 +1569,7 @@ static void rmExp(void){}
 //          inNotFilled = 0;
 //        }
 //      }
-//    
+//
 //    graphColor(oldcolor); graphLinewidth(oldLinew);
 //}
 
@@ -1587,7 +1588,7 @@ static void rmExp(void){}
 //
 //static int isVerticalMSP(MSP *msp) {
 //
-//    if (!msp->qname) 
+//    if (!msp->qname)
 //      g_error("No qname set in MSP - I need this to associate it with one of the sequences");
 //
 //    if (!strcasecmp(msp->qname, sname) || !strcmp(msp->qname, "@2"))
@@ -1599,8 +1600,8 @@ static void rmExp(void){}
 
 //static void drawAllFeatures(MSP *msp)
 //{
-//  float sx, ex, 
-//    y, 
+//  float sx, ex,
+//    y,
 //    height,           /* box height/width */
 //    boxHeight=10,
 //    textHeight,
@@ -1652,15 +1653,15 @@ static void rmExp(void){}
 //  oldLinew = graphLinewidth(1);
 //
 //  BlxStrand strand = BLXSTRAND_NONE;
-//  
-//  if (selfcomp || !reversedScale) 
+//
+//  if (selfcomp || !reversedScale)
 //    strand = BLXSTRAND_FORWARD;
-//  else 
+//  else
 //    strand = BLXSTRAND_REVERSE;
 //
 //
 //  for (; msp; msp = msp->next)
-//    {    
+//    {
 //      height = boxHeight;
 //
 //      if (mspHasFs(msp))
@@ -1685,7 +1686,7 @@ static void rmExp(void){}
 //        if (fsBottomOn && (isHorizontalMSP(msp) || (selfcomp && isVerticalMSP(msp))))
 //          {
 //            /* HORIZONTAL AXIS (X) */
-//                  
+//
 //            if (msp->type == BLXMSP_XY_PLOT)
 //              {
 //                XdrawSEGxy(msp, mspGetFsRightEdge(msp, &posx, fonth*(fsPlotHeight+1)));
@@ -1710,7 +1711,7 @@ static void rmExp(void){}
 //              }
 //          }
 //
-//        graphColor(oldcolor); 
+//        graphColor(oldcolor);
 //        graphLinewidth(oldLinew);
 //      }
 //    }
@@ -1731,9 +1732,9 @@ static void rmExp(void){}
 //  oldLinew = graphLinewidth(1);
 //
 //  BlxStrand strand = BLXSTRAND_NONE;
-//  if (selfcomp || !reversedScale) 
+//  if (selfcomp || !reversedScale)
 //    strand = BLXSTRAND_FORWARD;
-//  else 
+//  else
 //    strand = BLXSTRAND_REVERSE;
 //
 //
@@ -1786,19 +1787,19 @@ static void rmExp(void){}
 //#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
 //
 //      /* Draw the strands. */
-//      oldcolor = graphColor(BLUE); 
+//      oldcolor = graphColor(BLUE);
 //      g_list_foreach(strand_genes.forward_genes, drawGenesCB, &strand_genes) ;
 //
-//      oldcolor = graphColor(MAGENTA); 
+//      oldcolor = graphColor(MAGENTA);
 //      g_list_foreach(strand_genes.reverse_genes, drawGenesCB, &strand_genes) ;
 //
-//      graphColor(oldcolor); 
+//      graphColor(oldcolor);
 //
 //    }
 //  else
 //    {
 //      for (; msp; msp = msp->next)
-//      {    
+//      {
 //        if (msp->score < 0)
 //          {
 //            if (msp->qStrand != strand)
@@ -1806,28 +1807,28 @@ static void rmExp(void){}
 //            else
 //              y = forward_y ;
 //
-//            oldcolor = graphColor(BLUE); 
+//            oldcolor = graphColor(BLUE);
 //            drawMSPGene(msp, y) ;
 //
 //            if (selfcomp) /* Draw the boxes on vertical axes too */
 //              {
 //                sy = ceil((float)(mspGetQStart(msp)+MSPoffset - qoffset)/zoom);
 //                ey = ceil((float)(mspGetQEnd(msp)+MSPoffset - qoffset)/zoom);
-//              
+//
 //                sy += TopBorder-1;
 //                ey += TopBorder-1;
-//              
+//
 //                x = LeftBorder + qlen4 + 10;
 //                if (msp->qStrand != strand) x += 20;
-//              
+//
 //                if (msp->score == -1.0) /* EXON */
 //                  {
-//                    oldcolor = graphColor(BLUE); 
+//                    oldcolor = graphColor(BLUE);
 //                    graphRectangle(x, sy, x + height, ey);
 //                  }
 //                else if (msp->score == -2.0) /* INTRON */
 //                  {
-//                    oldcolor = graphColor(BLUE); 
+//                    oldcolor = graphColor(BLUE);
 //                    midy = 0.5 * (sy + ey) ;
 //                    graphLine (x + height/2, sy, x, midy) ;
 //                    graphLine (x + height/2, ey, x, midy) ;
@@ -2069,10 +2070,10 @@ static void rmExp(void){}
 //static void printMSP(gpointer data, gpointer user_data)
 //{
 //  MSP *msp = (MSP *)data ;
-//  
+//
 //  printf("%s:\t%d,%d\t->\t%d,%d\n",
 //       msp->sname, msp->sstart, msp->send, msp->qstart, msp->qend) ;
-//  
+//
 //
 //  return ;
 //}
@@ -2081,10 +2082,10 @@ static void rmExp(void){}
 //static void printGene(gpointer data, gpointer user_data)
 //{
 //  GeneData gene = (GeneData)data ;
-//  
+//
 //  printf("%s: '%c' %d -> %d   is at position: %f\n",
 //       gene->name, gene->strand, gene->start, gene->end, gene->y_pos) ;
-//  
+//
 //
 //  return ;
 //}
@@ -2094,8 +2095,8 @@ static void rmExp(void){}
 //{
 //  int i;
 //  graphActivate(fsGraph);
-//  
-//  for (i = 0; i < gArrayGetLen(fsArr); i++) 
+//
+//  for (i = 0; i < gArrayGetLen(fsArr); i++)
 //    {
 //      FeatureSeries *fs = &g_array_index(fsArr, FeatureSeries, i);
 //      fs->on = 1;
@@ -2107,8 +2108,8 @@ static void rmExp(void){}
 //{
 //  int i;
 //  graphActivate(fsGraph);
-//  
-//  for (i = 0; i < gArrayGetLen(fsArr); i++) 
+//
+//  for (i = 0; i < gArrayGetLen(fsArr); i++)
 //    {
 //      FeatureSeries *fs = &g_array_index(fsArr, FeatureSeries, i);
 //      fs->on = 0;
@@ -2120,12 +2121,12 @@ static void rmExp(void){}
 //{
 //  int i;
 //  graphActivate(fsGraph);
-//  
-//  for (i = 0; i < gArrayGetLen(fsArr); i++) 
+//
+//  for (i = 0; i < gArrayGetLen(fsArr); i++)
 //    {
 //      FeatureSeries *fs = &g_array_index(fsArr, FeatureSeries, i);
-//      
-//      if (fs->xy) 
+//
+//      if (fs->xy)
 //      {
 //        fs->on = 0;
 //        graphBoxDraw(fsBoxStart+i, BLACK, WHITE);
@@ -2137,12 +2138,12 @@ static void rmExp(void){}
 //{
 //  int i;
 //  graphActivate(fsGraph);
-//  
-//  for (i = 0; i < gArrayGetLen(fsArr); i++) 
+//
+//  for (i = 0; i < gArrayGetLen(fsArr); i++)
 //    {
 //      FeatureSeries *fs = &g_array_index(fsArr, FeatureSeries, i);
-//      
-//      if (!fs->xy) 
+//
+//      if (!fs->xy)
 //      {
 //        fs->on = 0;
 //        graphBoxDraw(fsBoxStart+i, BLACK, WHITE);
@@ -2179,7 +2180,7 @@ static void rmExp(void){}
 //{
 //    if (box-fsBoxStart < 0 || box-fsBoxStart > gArrayGetLen(fsArr))
 //      return;
-//    
+//
 //    FeatureSeries *fs = &g_array_index(fsArr, FeatureSeries, box - fsBoxStart);
 //    int *on = &fs->on;
 //
@@ -2200,7 +2201,7 @@ static void rmExp(void){}
 //{
 //    fsPlotHeight = atof(cp);
 //}
-//    
+//
 //
 //void selectFeatures(void)
 //{
@@ -2267,19 +2268,19 @@ static void rmExp(void){}
 //      FeatureSeries *fs = &g_array_index(fsArr, FeatureSeries, i);
 //
 //      box = graphBoxStart();
-//      graphText(fs->name, 1, y);      
+//      graphText(fs->name, 1, y);
 //      graphRectangle(1 - margin, y - margin, 1 + margin + strlen(fs->name), y + 1 + margin);
 //      graphBoxEnd();
 //
-//      if (!fs->on) 
+//      if (!fs->on)
 //      {
 //        graphBoxDraw(box, BLACK, WHITE);
 //      }
-//      else 
+//      else
 //      {
 //        graphBoxDraw(box, WHITE, BLACK);
 //      }
-//      
+//
 //      y += 1.5;
 //    }
 //
@@ -2293,33 +2294,33 @@ static void rmExp(void){}
 //{
 //    int i;
 //    float maxy = 0;
-//      
+//
 //    if (!fsArr || !gArrayGetLen(fsArr))
 //      {
 //      return 0.0;
 //      }
 //
-//    for (i = 0; i < gArrayGetLen(fsArr); i++) 
+//    for (i = 0; i < gArrayGetLen(fsArr); i++)
 //      {
 //      FeatureSeries *fs = &g_array_index(fsArr, FeatureSeries, i);
 //      fs->y = fs->x = 0;
 //      }
-//      
-//    for (msp = msplist; msp; msp = msp->next) 
+//
+//    for (msp = msplist; msp; msp = msp->next)
 //      {
 //        if (mspShowFs(msp))
 //        {
-//          if (msp->type == BLXMSP_XY_PLOT) 
+//          if (msp->type == BLXMSP_XY_PLOT)
 //            {
 //              mspGetFsBottomEdge(msp, &maxy, fsPlotHeight+1);
 //            }
-//          else if (msp->type == BLXMSP_FS_SEG) 
+//          else if (msp->type == BLXMSP_FS_SEG)
 //            {
 //              mspGetFsBottomEdge(msp, &maxy, 1+1);
 //            }
 //        }
 //      }
-//    
+//
 //    return maxy + 2;
 //}
 
@@ -2328,13 +2329,13 @@ static void rmExp(void){}
 static gboolean onZoomFactorChanged(GtkWidget *widget, const gint responseId, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
-  
+
   const char *text = gtk_entry_get_text(GTK_ENTRY(widget));
   gdouble newValue = g_strtod(text, NULL);
-  
+
   if (newValue <= 0)
     {
       g_critical("Zoom factor must be greater than zero.\n");
@@ -2345,7 +2346,7 @@ static gboolean onZoomFactorChanged(GtkWidget *widget, const gint responseId, gp
       properties->dotterWinCtx->zoomFactor = newValue;
       redrawAll(dotterWindow, NULL);
     }
-  
+
   return result;
 }
 
@@ -2354,21 +2355,21 @@ static gboolean onQStartChanged(GtkWidget *widget, const gint responseId, gpoint
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
   DotterWindowContext *dwc = properties->dotterWinCtx;
-  
+
   const char *text = gtk_entry_get_text(GTK_ENTRY(widget));
   int newValue = convertStringToInt(text);
-  
+
   /* If display coords are negated, we must un-negate it before we use it */
   if (negateDisplayCoord(dwc->dotterCtx, TRUE))
     newValue *= -1;
-  
+
   if (!valueWithinRange(newValue, &dwc->dotterCtx->refSeqFullRange))
     g_warning("Limiting reference sequence start to range %d -> %d.\n", dwc->dotterCtx->refSeqFullRange.min(), dwc->dotterCtx->refSeqFullRange.max());
-  
+
   boundsLimitValue(&newValue, &dwc->dotterCtx->refSeqFullRange);
-  
+
   gboolean changed = setStartCoord(dotterWindow, dwc, TRUE, newValue);
-  
+
   /* If it's a self comparison, also update the vertical range. */
   if (dwc->selfComp)
     changed = setStartCoord(dotterWindow, dwc, FALSE, newValue) || changed;
@@ -2378,7 +2379,7 @@ static gboolean onQStartChanged(GtkWidget *widget, const gint responseId, gpoint
 
   if (changed)
     redrawAll(dotterWindow, NULL);
-  
+
   return TRUE;
 }
 
@@ -2387,25 +2388,25 @@ static gboolean onQEndChanged(GtkWidget *widget, const gint responseId, gpointer
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
   DotterWindowContext *dwc = properties->dotterWinCtx;
-  
+
   const char *text = gtk_entry_get_text(GTK_ENTRY(widget));
   int newValue = convertStringToInt(text);
 
   /* If display coords are negated, we must un-negate it before we use it */
   if (negateDisplayCoord(dwc->dotterCtx, TRUE))
     newValue *= -1;
-  
+
   if (!valueWithinRange(newValue, &dwc->dotterCtx->refSeqFullRange))
     g_warning("Limiting reference sequence end to range %d -> %d.\n", dwc->dotterCtx->refSeqFullRange.min(), dwc->dotterCtx->refSeqFullRange.max());
 
   boundsLimitValue(&newValue, &dwc->dotterCtx->refSeqFullRange);
 
   gboolean changed = setEndCoord(dotterWindow, dwc, TRUE, newValue);
-  
+
   /* If it's a self comparison, also update the vertical range. */
   if (dwc->selfComp)
     changed = setEndCoord(dotterWindow, dwc, FALSE, newValue) || changed;
-  
+
   /* Check the crosshair is still in range and if not clip it */
   updateOnSelectedCoordsChanged(dotterWindow);
 
@@ -2420,19 +2421,19 @@ static gboolean onSStartChanged(GtkWidget *widget, const gint responseId, gpoint
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
   DotterWindowContext *dwc = properties->dotterWinCtx;
-  
+
   const char *text = gtk_entry_get_text(GTK_ENTRY(widget));
   int newValue = convertStringToInt(text);
-  
+
   /* If display coords are negated, we must un-negate it before we use it */
   if (negateDisplayCoord(dwc->dotterCtx, FALSE))
     newValue *= -1;
-  
+
   if (!valueWithinRange(newValue, &dwc->dotterCtx->matchSeqFullRange))
     g_warning("Limiting vertical sequence start to range %d -> %d.\n", dwc->dotterCtx->matchSeqFullRange.min(), dwc->dotterCtx->matchSeqFullRange.max());
 
   boundsLimitValue(&newValue, &dwc->dotterCtx->matchSeqFullRange);
-  
+
   gboolean changed = setStartCoord(dotterWindow, dwc, FALSE, newValue);
 
   /* Check the crosshair is still in range and if not clip it */
@@ -2449,43 +2450,43 @@ static gboolean onSEndChanged(GtkWidget *widget, const gint responseId, gpointer
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
   DotterWindowContext *dwc = properties->dotterWinCtx;
-  
+
   const char *text = gtk_entry_get_text(GTK_ENTRY(widget));
   int newValue = convertStringToInt(text);
-  
+
   /* If display coords are negated, we must un-negate it before we use it */
   if (negateDisplayCoord(dwc->dotterCtx, FALSE))
     newValue *= -1;
-  
+
   if (!valueWithinRange(newValue, &dwc->dotterCtx->matchSeqFullRange))
     g_warning("Limiting vertical sequence end to range %d -> %d.\n", dwc->dotterCtx->matchSeqFullRange.min(), dwc->dotterCtx->matchSeqFullRange.max());
 
   boundsLimitValue(&newValue, &dwc->dotterCtx->matchSeqFullRange);
-  
+
   gboolean changed = setEndCoord(dotterWindow, dwc, FALSE, newValue);
-  
+
   /* Check the crosshair is still in range and if not clip it */
   updateOnSelectedCoordsChanged(dotterWindow);
 
   if (changed)
     redrawAll(dotterWindow, NULL);
-  
+
   return TRUE;
 }
 
 static gboolean onSlidingWinSizeChanged(GtkWidget *widget, const gint responseId, gpointer data)
 {
   gboolean result = FALSE;
-  
+
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
-  
+
   const char *text = gtk_entry_get_text(GTK_ENTRY(widget));
   int newValue = convertStringToInt(text);
 
   GError *error = NULL;
   gboolean changed = dotplotSetSlidingWinSize(properties->dotplot, newValue, &error);
-  
+
   if (error)
     {
       reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
@@ -2494,10 +2495,10 @@ static gboolean onSlidingWinSizeChanged(GtkWidget *widget, const gint responseId
     {
       result = TRUE;
     }
-  
+
   if (changed)
     redrawAll(dotterWindow, NULL);
-  
+
   return result;
 }
 
@@ -2507,10 +2508,10 @@ static gboolean onSetSpliceSitesOn(GtkWidget *button, const gint responseId, gpo
 {
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
-  
+
   const gboolean spliceSitesOn = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
   alignmentToolSetSpliceSitesOn(properties->alignmentTool, spliceSitesOn);
-  
+
   return TRUE;
 }
 
@@ -2519,10 +2520,10 @@ static gboolean onSetBreaklinesOn(GtkWidget *button, const gint responseId, gpoi
 {
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
-  
+
   const gboolean breaklinesOn = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
   dotplotSetBreaklinesOn(properties->dotplot, breaklinesOn);
-  
+
   return TRUE;
 }
 
@@ -2531,10 +2532,10 @@ static gboolean onSetHozLabelsOn(GtkWidget *button, const gint responseId, gpoin
 {
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
-  
+
   const gboolean labelsOn = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
   dotplotSetHozLabelsOn(properties->dotplot, labelsOn);
-  
+
   return TRUE;
 }
 
@@ -2543,10 +2544,10 @@ static gboolean onSetVertLabelsOn(GtkWidget *button, const gint responseId, gpoi
 {
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
-  
+
   const gboolean labelsOn = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
   dotplotSetVertLabelsOn(properties->dotplot, labelsOn);
-  
+
   return TRUE;
 }
 
@@ -2555,33 +2556,33 @@ static gboolean onSetVertLabelsOn(GtkWidget *button, const gint responseId, gpoi
 static void onResponseSettingsDialog(GtkDialog *dialog, gint responseId, gpointer data)
 {
   gboolean destroy = TRUE;
-  
+
   switch (responseId)
   {
     case GTK_RESPONSE_ACCEPT:
       /* Destroy if successful */
       destroy = widgetCallAllCallbacks(GTK_WIDGET(dialog), GINT_TO_POINTER(responseId));
       break;
-      
+
     case GTK_RESPONSE_APPLY:
       widgetCallAllCallbacks(GTK_WIDGET(dialog), GINT_TO_POINTER(responseId));
       destroy = FALSE;
       break;
-      
+
     case GTK_RESPONSE_CANCEL:
     case GTK_RESPONSE_REJECT:
       destroy = TRUE;
       break;
-      
+
     default:
       break;
   };
-  
+
   if (destroy)
     {
       /* If it's a persistent dialog, just hide it, otherwise destroy it */
       const gboolean isPersistent = GPOINTER_TO_INT(data);
-      
+
       if (isPersistent)
         {
           gtk_widget_hide_all(GTK_WIDGET(dialog));
@@ -2600,32 +2601,32 @@ static void settingsDialogParamControls(GtkWidget *dialog, GtkWidget *dotterWind
   DotterProperties *properties = dotterGetProperties(dotterWindow);
   DotterWindowContext *dwc = properties->dotterWinCtx;
   DotterContext *dc = dwc->dotterCtx;
-  
+
   /* Put everything in a frame */
   GtkWidget *frame = gtk_frame_new("Parameters");
   gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), frame);
-  gtk_container_set_border_width(GTK_CONTAINER(frame), border); 
-  
+  gtk_container_set_border_width(GTK_CONTAINER(frame), border);
+
   /* Create a table to lay out the widgets */
   const int numRows = 4;
   const int numCols = 3;
   const int xpad = 2;
   const int ypad = 2;
-  
+
   GtkTable *table = GTK_TABLE(gtk_table_new(numRows, numCols, FALSE));
   gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(table));
-  
+
   /* Get the start and end values of each range, and negate them for display if necessary */
   const int qStart = getDisplayCoord(getStartCoord(dwc, TRUE), dc, TRUE);
   const int qEnd = getDisplayCoord(getEndCoord(dwc, TRUE), dc, TRUE);
   const int sStart = getDisplayCoord(getStartCoord(dwc, FALSE), dc, FALSE);
   const int sEnd = getDisplayCoord(getEndCoord(dwc, FALSE), dc, FALSE);
-  
+
   GtkWidget *zoomEntry = createTextEntryFromDouble(dotterWindow, table, 1, 2, xpad, ypad, "_Zoom: ", dwc->zoomFactor, onZoomFactorChanged);
   gtk_widget_set_tooltip_text(zoomEntry, "Zoom out by this factor, e.g. a zoom factor of 3 will shrink the window to 1/3 of its full size");
 
   GtkWidget *windowEntry = NULL;
-  
+
   /* Create the boxes for the sequence ranges. If it's a self comparison, we only really have one range. */
   if (dwc->selfComp)
     {
@@ -2652,12 +2653,12 @@ static void settingsDialogDisplayControls(GtkWidget *dialog, GtkWidget *dotterWi
 {
   DotterProperties *properties = dotterGetProperties(dotterWindow);
   DotplotProperties *dotplotProperties = dotplotGetProperties(properties->dotplot);
-  
+
   /* Put everything in a vbox inside a frame */
   GtkWidget *frame = gtk_frame_new("Display");
   gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), frame);
-  gtk_container_set_border_width(GTK_CONTAINER(frame), border); 
-  
+  gtk_container_set_border_width(GTK_CONTAINER(frame), border);
+
   GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(frame), vbox);
 
@@ -2668,7 +2669,7 @@ static void settingsDialogDisplayControls(GtkWidget *dialog, GtkWidget *dotterWi
   gboolean spliceSitesOn = alignmentToolGetSpliceSitesOn(properties->alignmentTool);
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(splicesBtn), spliceSitesOn);
   widgetSetCallbackData(splicesBtn, onSetSpliceSitesOn, dotterWindow);
-  
+
   /* Create a check box for toggling breaklines on and off. If breaklines are
    * off at startup then it means that there are not multiple sequences, so
    * the option is not applicable. */
@@ -2676,17 +2677,17 @@ static void settingsDialogDisplayControls(GtkWidget *dialog, GtkWidget *dotterWi
 
   if (disableBreaklines == -1)
     disableBreaklines = !dotplotProperties->breaklinesOn;
-  
+
   GtkWidget *breaklinesBtn = gtk_check_button_new_with_mnemonic("Show _breaklines");
   gtk_container_add(GTK_CONTAINER(vbox), breaklinesBtn);
   gtk_widget_set_tooltip_text(breaklinesBtn, "Show breaklines between sequences when dottering multiple sequences that have been concatenated");
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(breaklinesBtn), dotplotProperties->breaklinesOn);
-  
+
   if (disableBreaklines)
     gtk_widget_set_sensitive(breaklinesBtn, FALSE);
-  
+
   widgetSetCallbackData(breaklinesBtn, onSetBreaklinesOn, dotterWindow);
-  
+
   /* Add buttons to allow the user to turn off hoz/vert annotation labels */
   GtkWidget *hozBtn = gtk_check_button_new_with_mnemonic("Show _horizontal sequence labels");
   gtk_widget_set_tooltip_text(hozBtn, "Show labels for each breakline between multiple sequences on the horizontal axis");
@@ -2699,7 +2700,7 @@ static void settingsDialogDisplayControls(GtkWidget *dialog, GtkWidget *dotterWi
   gtk_container_add(GTK_CONTAINER(vbox), vertBtn);
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vertBtn), dotplotProperties->vertLabelsOn);
   widgetSetCallbackData(vertBtn, onSetVertLabelsOn, dotterWindow);
-  
+
 }
 
 
@@ -2711,14 +2712,14 @@ static void showSettingsDialog(GtkWidget *dotterWindow)
 
   const DotterDialogId dialogId = DOTDIALOG_SETTINGS;
   GtkWidget *dialog = getPersistentDialog(dwc->dialogList, dialogId);
-  
+
   if (!dialog)
     {
       /* Create the dialog */
       char *title = g_strdup_printf("%sSettings", dotterGetTitlePrefix(dwc->dotterCtx));
 
       dialog = gtk_dialog_new_with_buttons(title,
-                                           GTK_WINDOW(dotterWindow), 
+                                           GTK_WINDOW(dotterWindow),
                                            GTK_DIALOG_DESTROY_WITH_PARENT,
                                            GTK_STOCK_OK,
                                            GTK_RESPONSE_ACCEPT,
@@ -2727,11 +2728,11 @@ static void showSettingsDialog(GtkWidget *dotterWindow)
                                            NULL);
 
       g_free(title);
-      
+
       /* These 2 calls are required to make the dialog persistent... */
       addPersistentDialog(dwc->dialogList, dialogId, dialog);
       g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-      
+
       g_signal_connect(dialog, "response", G_CALLBACK(onResponseSettingsDialog), GINT_TO_POINTER(TRUE));
     }
   else
@@ -2748,7 +2749,7 @@ static void showSettingsDialog(GtkWidget *dotterWindow)
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
   gtk_widget_show_all(dialog);
   gtk_window_present(GTK_WINDOW(dialog));
-  
+
   return;
 }
 
@@ -2757,14 +2758,14 @@ static void showSettingsDialog(GtkWidget *dotterWindow)
 static void redrawAll(GtkWidget *dotterWindow, gpointer data)
 {
   gtk_widget_queue_draw(dotterWindow);
-  
+
   DotterProperties *properties = dotterGetProperties(dotterWindow);
   DotterWindowContext *dwc = properties->dotterWinCtx;
 
   /* Check the range values are the correct way round. */
   dwc->refSeqRange.sort();
   dwc->matchSeqRange.sort();
-  
+
   if (properties)
     {
       gtk_widget_queue_draw(properties->greyrampTool);
@@ -2782,7 +2783,7 @@ static void refreshAll(GtkWidget *dotterWindow, gpointer data)
   gtk_widget_queue_draw(dotterWindow);
 
   DotterProperties *properties = dotterGetProperties(dotterWindow);
-  
+
   if (properties)
     {
       gtk_widget_queue_draw(properties->greyrampTool);
@@ -2797,9 +2798,9 @@ static void readmtx(int MATRIX[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE], char *mtxfil
     FILE *fil;
     int row, col;
     char line[1025] = "#", *p;
-    
+
     char *mtxfileText = g_strdup_printf("%s/%s", getenv("BLASTMAT"), mtxfile);
-  
+
     if (!(fil = fopen(mtxfile, "r")) &&
         !(fil = fopen(mtxfileText, "r")))
       {
@@ -2807,10 +2808,10 @@ static void readmtx(int MATRIX[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE], char *mtxfil
         g_error(msg, mtxfile);
         g_free(msg);
       }
-  
+
     g_free(mtxfileText);
     mtxfileText = NULL;
-    
+
     /* Ignore header ... */
     while (!feof(fil) && *line == '#')
       {
@@ -2824,12 +2825,12 @@ static void readmtx(int MATRIX[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE], char *mtxfil
           g_error("Wrong number of rows in matrix file: %d (should be %d).\n", row, CONS_MATRIX_SIZE);
 
         p = strtok(line, " \t\n");
-        for (col = 0; col < CONS_MATRIX_SIZE; col++) 
+        for (col = 0; col < CONS_MATRIX_SIZE; col++)
         {
             while (*p == '*' || isalpha((int) *p))
                 p = strtok(NULL, " \t\n");
-          
-            if (!p) 
+
+            if (!p)
               g_error("Error on row %d in matrix file.\n", row);
 
             MATRIX[row][col] = atoi(p);
@@ -2858,9 +2859,9 @@ static void DNAmatrix(int mtx[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE])
 
     for (i = 0 ; i < 6 ; i++)
         for (j = 0 ; j < 6 ; j++) {
-            if ( i < 4 && j < 4) 
+            if ( i < 4 && j < 4)
                 mtx[i][j] = (i == j ? 5 : -4);
-            else 
+            else
                 mtx[i][j] = -4;
         }
 }
@@ -2892,7 +2893,7 @@ static void showHideGreyrampTool(GtkWidget *dotterWindow, const gboolean show)
         {
           /* Show it, and bring it to the front if it's a toplevel window */
           gtk_widget_show_all(parent);
-      
+
           if (GTK_IS_WINDOW(parent))
             gtk_window_present(GTK_WINDOW(parent));
 
@@ -2923,7 +2924,7 @@ static void showHideAlignmentTool(GtkWidget *dotterWindow, const gboolean show)
         {
           /* Show it, and bring it to the front if it's a toplevel window */
           gtk_widget_show_all(parent);
-      
+
           if (GTK_IS_WINDOW(parent))
             gtk_window_present(GTK_WINDOW(parent));
         }
@@ -2996,7 +2997,7 @@ void dotterEnableSelectionMenus(DotterWindowContext *dwc, const gboolean enable)
 }
 
 /* Toggle the given menu item on or off */
-void dotterSetToggleMenuStatus(DotterWindowContext *dwc, 
+void dotterSetToggleMenuStatus(DotterWindowContext *dwc,
                                const char *menuItem,
                                const gboolean enable)
 {
@@ -3011,9 +3012,9 @@ void dotterSetToggleMenuStatus(DotterWindowContext *dwc,
 static void aboutDialogOpenLinkCB(GtkAboutDialog *about, const gchar *link, gpointer data)
 {
   GError *error = NULL ;
-    
+
   if (!seqtoolsLaunchWebBrowser(link, &error))
-    g_critical("Cannot show link in web browser: \"%s\"", link) ;    
+    g_critical("Cannot show link in web browser: \"%s\"", link) ;
 }
 
 
@@ -3027,7 +3028,7 @@ static void showAboutDialog(GtkWidget *parent)
 
   gtk_show_about_dialog(GTK_WINDOW(parent),
                         "authors", authors,
-                        "comments", dotterGetCommentsString(), 
+                        "comments", dotterGetCommentsString(),
                         "copyright", dotterGetCopyrightString(),
                         "license", dotterGetLicenseString(),
                         "name", dotterGetAppName(),
@@ -3035,7 +3036,7 @@ static void showAboutDialog(GtkWidget *parent)
                         "website", dotterGetWebSiteString(),
                         NULL) ;
 #endif
-  
+
   return ;
 }
 
@@ -3043,43 +3044,43 @@ static void showAboutDialog(GtkWidget *parent)
 static void showHelpDialog(GtkWidget *dotterWindow)
 {
   GError *error = NULL;
-  
+
   /* The docs should live in /share/doc/seqtools/, in the same parent
    * directory that our executable's 'bin' directory is in. Open the 'quick
    * start' page. */
   char rel_path[100] = "../share/doc/seqtools/dotter_quick_start.html";
-  
+
   /* Find the executable's path */
   char *exe = g_find_program_in_path(g_get_prgname());
   gboolean ok = (exe != NULL);
-  
+
   if (ok)
     {
       /* Get the executable's directory */
       char *dir = g_path_get_dirname(exe);
-      
+
       ok = dir != NULL;
-      
+
       if (ok)
         {
           /* Get the path to the html page */
           char *path = g_strdup_printf("%s/%s", dir, rel_path);
-          
+
           ok = path != NULL;
-          
+
           if (ok)
             {
               g_message("Opening help page '%s'\n", path);
               seqtoolsLaunchWebBrowser(path, &error);
               g_free(path);
             }
-          
+
           g_free(dir);
         }
 
       g_free(exe);
     }
-  
+
   if (!ok)
     {
       if (error)
@@ -3115,7 +3116,7 @@ static void onSavePlotMenu(GtkAction *action, gpointer data)
 
   GError *error = NULL;
   savePlot(properties->dotplot, NULL, NULL, DOTSAVE_BINARY, &error);
-  
+
   prefixError(error, "Error saving plot. ");
   reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
 }
@@ -3127,7 +3128,7 @@ static void onSaveAsciiPlotMenu(GtkAction *action, gpointer data)
 
   GError *error = NULL;
   savePlot(properties->dotplot, NULL, NULL, DOTSAVE_ASCII, &error);
-  
+
   prefixError(error, "Error saving plot. ");
   reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
 }
@@ -3141,10 +3142,10 @@ static void onExportPlotMenu(GtkAction *action, gpointer data)
   GdkColor *defaultBgColor = getGdkColor(DOTCOLOR_BACKGROUND, properties->dotterWinCtx->dotterCtx->defaultColors, FALSE, TRUE);
   setWidgetBackgroundColor(dotterWindow, defaultBgColor);
   redrawAll(dotterWindow, NULL);
-  
+
   GError *error = NULL;
   exportPlot(properties->dotplot, GTK_WINDOW(dotterWindow), NULL, &error);
-  
+
   prefixError(error, "Error exporting plot. ");
   reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
 
@@ -3203,7 +3204,7 @@ static void onPrintAlignmentMenu(GtkAction *action, gpointer data)
 
   /* Make sure cached drawables are re-drawn before we print them. */
   gdk_window_process_all_updates();
-  
+
   GtkWidget *window = gtk_widget_get_toplevel(alignmentTool);
   blxPrintWidget(alignmentTool, NULL, GTK_WINDOW(window), &dwc->printSettings, &dwc->pageSetup, NULL, TRUE, PRINT_FIT_BOTH);
 
@@ -3219,7 +3220,7 @@ static void copyIntToPrimaryClipboard(const int val)
 {
   char *displayText = convertIntToString(val);
   setPrimaryClipboardText(displayText);
-  g_free(displayText); 
+  g_free(displayText);
 }
 
 /* Callback called when the user selects the 'copy horizontal coord' menu option */
@@ -3227,7 +3228,7 @@ static void onCopyHCoordMenu(GtkAction *action, gpointer data)
 {
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
-  
+
   copyIntToDefaultClipboard(properties->dotterWinCtx->refCoord);
   copyIntToPrimaryClipboard(properties->dotterWinCtx->refCoord);
 }
@@ -3343,7 +3344,7 @@ static void onToggleHspMode(GtkRadioAction *action, GtkRadioAction *current, gpo
 {
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
-  
+
   const DotterHspMode hspMode = (const DotterHspMode)gtk_radio_action_get_current_value(current);
   setHspMode(properties->dotplot, hspMode);
 }
@@ -3355,10 +3356,10 @@ static void onPrintColorsChanged(GtkWidget *dotterWindow)
 
   /* Refresh the background colors for both the main window and the alignment tool */
   GdkColor *defaultBgColor = getGdkColor(DOTCOLOR_BACKGROUND, dwc->dotterCtx->defaultColors, FALSE, dwc->usePrintColors);
-  
+
   setWidgetBackgroundColor(dotterWindow, defaultBgColor);
   setWidgetBackgroundColor(properties->alignmentTool, defaultBgColor);
-  
+
   /* Redraw everything */
   refreshAll(dotterWindow, NULL);
 }
@@ -3368,7 +3369,7 @@ static void onToggleUsePrintColorsMenu(GtkAction *action, gpointer data)
   GtkWidget *dotterWindow = GTK_WIDGET(data);
   DotterProperties *properties = dotterGetProperties(dotterWindow);
   DotterWindowContext *dwc = properties->dotterWinCtx;
-  
+
   /* Toggle the flag*/
   dwc->usePrintColors = !dwc->usePrintColors;
   onPrintColorsChanged(dotterWindow);
@@ -3392,7 +3393,7 @@ static void onToggleDockWindowsMenu(GtkAction *action, gpointer data)
 static gboolean onButtonPressDotter(GtkWidget *window, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->type == GDK_BUTTON_PRESS && event->button == 3) /* right click */
     {
       GtkMenu *contextMenu = GTK_MENU(data);
@@ -3404,7 +3405,7 @@ static gboolean onButtonPressDotter(GtkWidget *window, GdkEventButton *event, gp
       updateOnSelectedCoordsChanged(window);
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -3412,14 +3413,14 @@ static gboolean onButtonPressDotter(GtkWidget *window, GdkEventButton *event, gp
 static gboolean onButtonPressTool(GtkWidget *greyrampTool, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->type == GDK_BUTTON_PRESS && event->button == 3) /* right click */
     {
       GtkMenu *contextMenu = GTK_MENU(data);
       gtk_menu_popup (contextMenu, NULL, NULL, NULL, NULL, event->button, event->time);
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -3428,7 +3429,7 @@ static gboolean onButtonPressTool(GtkWidget *greyrampTool, GdkEventButton *event
 static gboolean onMouseMoveDotter(GtkWidget *window, GdkEventMotion *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->state & GDK_BUTTON1_MASK)  /* left-drag */
     {
       /* If the dot-plot was clicked the selected coords will have changed. Perform required updates. */
@@ -3452,15 +3453,15 @@ int getResFactor(DotterContext *dc, const gboolean horizontal)
 static gboolean negateDisplayCoord(DotterContext *dc, const gboolean horizontal)
 {
   gboolean result = FALSE;
-  
+
   if (dc->negateCoords)
     {
     if (horizontal)
       result = dc->hozScaleRev;
-    else 
+    else
       result = dc->vertScaleRev;
     }
-  
+
   return result;
 }
 
@@ -3469,15 +3470,15 @@ static gboolean negateDisplayCoord(DotterContext *dc, const gboolean horizontal)
 int getDisplayCoord(const int coordIn, DotterContext *dc, const gboolean horizontal)
 {
   int result = coordIn;
-  
+
   if (negateDisplayCoord(dc, horizontal))
     result *= -1;
-  
+
   return result;
 }
 
 
-/* Get the currently-selected (i.e. crosshair) coord for the horizontal or 
+/* Get the currently-selected (i.e. crosshair) coord for the horizontal or
  * vertical sequence, as indicated by the bool */
 int getSelectedCoord(DotterWindowContext *dwc, const gboolean horizontal)
 {
@@ -3489,12 +3490,12 @@ int getSelectedCoord(DotterWindowContext *dwc, const gboolean horizontal)
 int getStartCoord(DotterWindowContext *dwc, const gboolean horizontal)
 {
   int result = UNSET_INT;
-  
+
   if (horizontal)
     result = dwc->dotterCtx->hozScaleRev ? dwc->refSeqRange.max() : dwc->refSeqRange.min();
   else
     result = dwc->dotterCtx->vertScaleRev ? dwc->matchSeqRange.max() : dwc->matchSeqRange.min();
-  
+
   return result;
 }
 
@@ -3502,12 +3503,12 @@ int getStartCoord(DotterWindowContext *dwc, const gboolean horizontal)
 int getEndCoord(DotterWindowContext *dwc, const gboolean horizontal)
 {
   int result = UNSET_INT;
-  
+
   if (horizontal)
     result = dwc->dotterCtx->hozScaleRev ? dwc->refSeqRange.min() : dwc->refSeqRange.max();
   else
     result = dwc->dotterCtx->vertScaleRev ? dwc->matchSeqRange.min() : dwc->matchSeqRange.max();
-  
+
   return result;
 }
 
@@ -3516,8 +3517,8 @@ int getEndCoord(DotterWindowContext *dwc, const gboolean horizontal)
 /* Set the start coord of the display range for the given sequence */
 static gboolean setStartCoord(GtkWidget *dotterWindow, DotterWindowContext *dwc, const gboolean horizontal, const int newValue)
 {
-  gboolean changed = FALSE; 
-  
+  gboolean changed = FALSE;
+
   if (horizontal)
     {
       if (dwc->dotterCtx->hozScaleRev)
@@ -3532,7 +3533,7 @@ static gboolean setStartCoord(GtkWidget *dotterWindow, DotterWindowContext *dwc,
       else
         changed = dwc->matchSeqRange.setMin(newValue);
     }
-  
+
   return changed;
 }
 
@@ -3540,7 +3541,7 @@ static gboolean setStartCoord(GtkWidget *dotterWindow, DotterWindowContext *dwc,
 static gboolean setEndCoord(GtkWidget *dotterWindow, DotterWindowContext *dwc, const gboolean horizontal, const int newValue)
 {
   gboolean changed = FALSE;
-  
+
   if (horizontal)
     {
       if (dwc->dotterCtx->hozScaleRev)
@@ -3555,18 +3556,18 @@ static gboolean setEndCoord(GtkWidget *dotterWindow, DotterWindowContext *dwc, c
       else
         changed = dwc->matchSeqRange.setMax(newValue);
     }
-  
+
   return changed;
 }
 
-/* Move the given sequence coord by the given number of coords (which can be negative to move 
+/* Move the given sequence coord by the given number of coords (which can be negative to move
  * in the decreasing direction. 'horizontal' indicates whether it's the horizontal or vertical
  * sequence that we're modifying and 'reverse' indicates whether that sequence's scale is shown reversed. */
-static void incrementCoord(GtkWidget *dotterWindow, 
+static void incrementCoord(GtkWidget *dotterWindow,
                            DotterContext *dc,
-                           int *coord, 
-                           const gboolean reverse, 
-                           const gboolean horizontal, 
+                           int *coord,
+                           const gboolean reverse,
+                           const gboolean horizontal,
                            const gboolean convertCoords,
                            const int numCoords)
 {
@@ -3580,7 +3581,7 @@ static void incrementCoord(GtkWidget *dotterWindow,
     {
       *coord += incValue;
     }
-  
+
   updateOnSelectedCoordsChanged(dotterWindow);
 }
 
@@ -3590,7 +3591,7 @@ static gboolean onKeyPressQ(GtkWidget *dotterWindow, const gboolean ctrlModifier
 {
   if (ctrlModifier)
     dotterContextCloseAllWindows(dotterGetContext(dotterWindow));
-  
+
   return ctrlModifier;
 }
 
@@ -3603,7 +3604,7 @@ static gboolean onKeyPressW(GtkWidget *widget, const gboolean ctrlModifier)
     {
       handled = closeWindow(widget);
     }
-  
+
   return handled;
 }
 
@@ -3612,7 +3613,7 @@ static gboolean onKeyPressH(GtkWidget *dotterWindow, const gboolean ctrlModifier
 {
   if (ctrlModifier)
     showHelpDialog(dotterWindow);
-  
+
   return ctrlModifier;
 }
 
@@ -3622,7 +3623,7 @@ static gboolean onKeyPressS(GtkWidget *dotterWindow, const gboolean ctrlModifier
 {
   if (ctrlModifier)
     showSettingsDialog(dotterWindow);
-    
+
   return ctrlModifier;
 }
 
@@ -3637,7 +3638,7 @@ static gboolean onKeyPressG(GtkWidget *dotterWindow, const gboolean ctrlModifier
       /* Toggle the visiblity */
       setToggleMenuStatus(properties->dotterWinCtx->actionGroup, "ToggleGreyramp", !active);
     }
-  
+
   return ctrlModifier;
 }
 
@@ -3652,12 +3653,12 @@ static gboolean onKeyPressA(GtkWidget *dotterWindow, const gboolean ctrlModifier
       /* Toggle the visiblity */
       setToggleMenuStatus(properties->dotterWinCtx->actionGroup, "ToggleAlignment", !active);
     }
-  
+
   return ctrlModifier;
 }
 
 /* Handle C key press (Ctrl-C => copy selection; Shift-Ctrl-C => copy selection coords) */
-static gboolean onKeyPressC(GtkWidget *dotterWindow, 
+static gboolean onKeyPressC(GtkWidget *dotterWindow,
                             const gboolean ctrlModifier,
                             const gboolean shiftModifier)
 {
@@ -3679,7 +3680,7 @@ static gboolean onKeyPressD(GtkWidget *dotterWindow, const gboolean ctrlModifier
 {
   if (ctrlModifier)
     showDotterWindow(dotterWindow);
-  
+
   return ctrlModifier;
 }
 
@@ -3691,7 +3692,7 @@ static gboolean onKeyPressK(GtkWidget *dotterWindow, const gboolean ctrlModifier
       DotterProperties *properties = dotterGetProperties(dotterWindow);
       setToggleMenuStatus(properties->dotterWinCtx->actionGroup, "DockWindows", !properties->windowsDocked);
     }
-  
+
   return ctrlModifier;
 }
 
@@ -3701,10 +3702,10 @@ static gboolean onKeyPressUpDown(GtkWidget *dotterWindow, const gboolean isUp, c
   /* Increment/decrement the vertical (i.e. match) sequence coord */
   DotterProperties *properties = dotterGetProperties(dotterWindow);
   DotterWindowContext *dwc = properties->dotterWinCtx;
-  
+
   const int numCoords = isUp ? -1 : 1;
-  
-  incrementCoord(dotterWindow, dwc->dotterCtx, &dwc->matchCoord, dwc->dotterCtx->vertScaleRev, FALSE, !modifier, numCoords);  
+
+  incrementCoord(dotterWindow, dwc->dotterCtx, &dwc->matchCoord, dwc->dotterCtx->vertScaleRev, FALSE, !modifier, numCoords);
   return TRUE;
 }
 
@@ -3716,7 +3717,7 @@ static gboolean onKeyPressLeftRight(GtkWidget *dotterWindow, const gboolean isLe
   DotterWindowContext *dwc = properties->dotterWinCtx;
 
   const int numCoords = isLeft ? -1 : 1;
-  
+
   incrementCoord(dotterWindow, dwc->dotterCtx, &dwc->refCoord, dwc->dotterCtx->hozScaleRev, TRUE, !modifier, numCoords);
   return TRUE;
 }
@@ -3761,12 +3762,12 @@ static gboolean onKeyPressEsc(GtkWidget *dotterWindow)
 gboolean onKeyPressDotter(GtkWidget *widget, GdkEventKey *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   GtkWidget *dotterWindow = GTK_WIDGET(data);
-  
-  const gboolean ctrlModifier = (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;  
-  const gboolean shiftModifier = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;  
-  
+
+  const gboolean ctrlModifier = (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK;
+  const gboolean shiftModifier = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK;
+
   switch (event->keyval)
     {
       case GDK_A:   /* fall through */
@@ -3780,7 +3781,7 @@ gboolean onKeyPressDotter(GtkWidget *widget, GdkEventKey *event, gpointer data)
 
       case GDK_G:   /* fall through */
       case GDK_g:   handled = onKeyPressG(dotterWindow, ctrlModifier);              break;
-        
+
       case GDK_H:   /* fall through */
       case GDK_h:   handled = onKeyPressH(dotterWindow, ctrlModifier);              break;
 
@@ -3800,23 +3801,23 @@ gboolean onKeyPressDotter(GtkWidget *widget, GdkEventKey *event, gpointer data)
 
       case GDK_Up:            handled = onKeyPressUpDown(dotterWindow, TRUE, shiftModifier);        break;
       case GDK_Down:          handled = onKeyPressUpDown(dotterWindow, FALSE, shiftModifier);       break;
-            
+
       case GDK_Left:          handled = onKeyPressLeftRight(dotterWindow, TRUE, shiftModifier);     break;
       case GDK_Right:         handled = onKeyPressLeftRight(dotterWindow, FALSE, shiftModifier);    break;
-            
+
       case GDK_comma:         handled = onKeyPressCommaPeriod(dotterWindow, TRUE, shiftModifier);   break;
       case GDK_less:          handled = onKeyPressCommaPeriod(dotterWindow, TRUE, shiftModifier);   break;
       case GDK_period:        handled = onKeyPressCommaPeriod(dotterWindow, FALSE, shiftModifier);  break;
       case GDK_greater:       handled = onKeyPressCommaPeriod(dotterWindow, FALSE, shiftModifier);  break;
-        
+
       case GDK_bracketleft:   handled = onKeyPressLeftRightBracket(dotterWindow, TRUE, shiftModifier);        break;
       case GDK_braceleft:     handled = onKeyPressLeftRightBracket(dotterWindow, TRUE, shiftModifier);        break;
       case GDK_bracketright:  handled = onKeyPressLeftRightBracket(dotterWindow, FALSE, shiftModifier);       break;
       case GDK_braceright:    handled = onKeyPressLeftRightBracket(dotterWindow, FALSE, shiftModifier);       break;
-        
+
       default: break;
     }
-  
+
   return handled;
 }
 
@@ -3831,7 +3832,7 @@ gboolean onKeyPressDotter(GtkWidget *widget, GdkEventKey *event, gpointer data)
 GList* dotterCreateColumns()
 {
   GList *columnList = NULL;
-  
+
   /* Create the columns' data structs. The columns appear in the order
    * that they are added here. */
   blxColumnCreate(BLXCOL_SEQNAME, FALSE, "Name", G_TYPE_STRING, NULL, 0, TRUE, TRUE, FALSE, FALSE, FALSE, "Name", NULL, NULL, &columnList);
@@ -3857,11 +3858,11 @@ static GtkUIManager* createUiManager(GtkWidget *window, const DotterHspMode hspM
   enableMenuAction(action_group, "CopySeln", FALSE);
   enableMenuAction(action_group, "CopySelnCoords", FALSE);
   enableMenuAction(action_group, "ClearSeln", FALSE);
-  
+
   GtkUIManager *ui_manager = gtk_ui_manager_new ();
   gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
   gtk_ui_manager_set_add_tearoffs(ui_manager, TRUE);
-  
+
   GtkAccelGroup *accel_group = gtk_ui_manager_get_accel_group (ui_manager);
   gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
 
@@ -3873,9 +3874,9 @@ static GtkUIManager* createUiManager(GtkWidget *window, const DotterHspMode hspM
 
 
 /* Create a menu. Optionally add it to the given menu bar, if menuBar is not null, with the given label */
-static GtkWidget* createDotterMenu(GtkWidget *window, 
-                                   const char *menuDescription, 
-                                   const char *path, 
+static GtkWidget* createDotterMenu(GtkWidget *window,
+                                   const char *menuDescription,
+                                   const char *path,
                                    GtkUIManager *ui_manager)
 {
   GError *error = NULL;
@@ -3884,18 +3885,18 @@ static GtkWidget* createDotterMenu(GtkWidget *window,
       prefixError(error, "Building menus failed: ");
       reportAndClearIfError(&error, G_LOG_LEVEL_ERROR);
     }
-  
+
   GtkWidget *menu = gtk_ui_manager_get_widget (ui_manager, path);
-  
+
   return menu;
 }
 
 
-static GtkWidget* createDotterWindow(DotterContext *dc, 
+static GtkWidget* createDotterWindow(DotterContext *dc,
                                      DotterWindowContext *dwc,
-                                     const DotterHspMode hspMode, 
+                                     const DotterHspMode hspMode,
                                      GtkWidget *dotplot,
-                                     GtkWidget *dotplotContainer, 
+                                     GtkWidget *dotplotContainer,
                                      GtkWidget *greyrampContainer,
                                      GtkWidget *alignmentContainer,
                                      GtkWidget *greyrampTool,
@@ -3903,19 +3904,19 @@ static GtkWidget* createDotterWindow(DotterContext *dc,
                                      GtkWidget *greyrampToolMinimised,
                                      const char *exportFileName,
                                      char *windowColor)
-{ 
+{
   DEBUG_ENTER("createDotterWindow");
 
   GtkWidget *dotterWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_widget_set_name(dotterWindow, MAIN_WINDOW_NAME);
-  
+
   char *title = g_strdup_printf("%s%s vs. %s", dotterGetTitlePrefix(dc), dc->refSeqName, dc->matchSeqName);
   gtk_window_set_title(GTK_WINDOW(dotterWindow), title);
   g_free(title);
-  
+
   /* Set the parent window in the message handlers' data, now we know it */
   dc->msgData->parent = GTK_WINDOW(dotterWindow);
-  
+
   /* Create the menu bar, and a right-click context menu */
   dwc->uiManager = createUiManager(dotterWindow, hspMode, &dwc->actionGroup);
   GtkWidget *menuBar = createDotterMenu(dotterWindow, mainMenuDescription, "/MenuBar", dwc->uiManager);
@@ -3926,7 +3927,7 @@ static GtkWidget* createDotterWindow(DotterContext *dc,
 
   blxSetWidgetColor(menuBar, windowColor);
 
-  /* We'll set the default window size based on the dotplot/exon widget size, up to a 
+  /* We'll set the default window size based on the dotplot/exon widget size, up to a
    * max based on screen size. */
   int maxWidth = 300, maxHeight = 200;
   gbtools::GUIGetTrueMonitorSizeFraction(dotterWindow, MAX_WINDOW_WIDTH_FRACTION, MAX_WINDOW_HEIGHT_FRACTION, &maxWidth, &maxHeight);
@@ -3960,7 +3961,7 @@ static GtkWidget* createDotterWindow(DotterContext *dc,
   int height = getDotplotHeight(dotplot, dotplotProperties) + exonViewHeight + alignmentToolHeight;
   width = min(width, maxWidth);
   height = min(height, maxHeight);
-  
+
   gtk_window_set_default_size(GTK_WINDOW(dotterWindow), width, height);
 
   /* Put the widgets in a table */
@@ -4004,9 +4005,9 @@ static GtkWidget* createDotterWindow(DotterContext *dc,
   g_signal_connect(G_OBJECT(greyrampTool), "button-press-event", G_CALLBACK(onButtonPressTool), contextMenuGreyrampMax);
   g_signal_connect(G_OBJECT(greyrampToolMinimised), "button-press-event", G_CALLBACK(onButtonPressTool), contextMenuGreyrampMin);
   g_signal_connect(G_OBJECT(alignmentTool), "button-press-event", G_CALLBACK(onButtonPressTool), contextMenuAlignment);
-  
+
   gtk_widget_show_all(dotterWindow);
-  
+
   DEBUG_EXIT("createDotterWindow returning ");
   return dotterWindow;
 }
@@ -4045,11 +4046,11 @@ const char *dotterGetWebSiteString(void)
  * functions, this one allocates a new string which must be free'd by the caller */
 const char *dotterGetCommentsString(void)
 {
-  char *result = g_strdup_printf("%s\n%s\n%s %s\n\n%s\n", 
-                                 DOTTER_TITLE_STRING, 
+  char *result = g_strdup_printf("%s\n%s\n%s %s\n\n%s\n",
+                                 DOTTER_TITLE_STRING,
                                  gbtools::UtilsGetVersionTitle(),
-                                 UT_COMPILE_PHRASE, 
-                                 UT_MAKE_COMPILE_DATE(), 
+                                 UT_COMPILE_PHRASE,
+                                 UT_MAKE_COMPILE_DATE(),
                                  AUTHOR_TEXT);
 
   return result;
@@ -4072,7 +4073,7 @@ void copyIntToDefaultClipboard(const int val)
 {
   char *displayText = convertIntToString(val);
   setDefaultClipboardText(displayText);
-  g_free(displayText); 
+  g_free(displayText);
 }
 
 
@@ -4090,7 +4091,7 @@ static void printDotterWindow(GtkWidget *dotterWindow)
    * but we want it to show in the print, so draw it on now. */
   GtkWidget *dotplot = properties->dotplot;
   dotplotPrepareForPrinting(dotplot);
-  
+
   /* Print the parent of the dotplot, because this contains the exon views as well.
    * Note that we don't want to print the scrolled window, because that will chop off
    * parts of the plot that are not currently visible; we want to print the whole plot) */
@@ -4099,7 +4100,7 @@ static void printDotterWindow(GtkWidget *dotterWindow)
   /* Do the print */
   DotterWindowContext *dwc = properties->dotterWinCtx;
   blxPrintWidget(parent, NULL, GTK_WINDOW(dotterWindow), &dwc->printSettings, &dwc->pageSetup, NULL, TRUE, PRINT_FIT_BOTH);
-  
+
   /* Revert the background colour */
   onPrintColorsChanged(dotterWindow);
 
diff --git a/src/dotterApp/dotter.hpp b/src/dotterApp/dotter.hpp
index 779f7f3c476e8bf784597a324ac9f06527748614..455245ac60a8a732030e9c65f0d15b45625fe544 100644
--- a/src/dotterApp/dotter.hpp
+++ b/src/dotterApp/dotter.hpp
@@ -1,5 +1,6 @@
 /*  File: dotter.h
  *  Author: Erik Sonnhammer, 1999-08-26
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -28,14 +29,14 @@
  *      Roy Storey        (Sanger Institute, UK)  <rds@sanger.ac.uk>
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
- * Description: 
+ * Description:
  * Exported functions:
  *   Only 3 parameters are mandatory, the rest can be set to NULL.
  *   A minimal call would look like:
  *
  *   dotter(type, 0, 0, qseq, 0, 0, sseq, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  *
- *   NOTE: qseq and sseq must be g_malloc'ed in the calling routine.  
+ *   NOTE: qseq and sseq must be g_malloc'ed in the calling routine.
  *   They are g_free'd by Dotter.
  *----------------------------------------------------------------------------
  */
@@ -56,7 +57,7 @@ typedef enum _DotterExportFormat
   } DotterExportFormat;
 
 // Save file format, either binary or text.
-// 
+//
 typedef enum
   {
     DOTSAVE_INVALID,
@@ -80,23 +81,23 @@ typedef struct _DotterOptions
     int install : 1;          /* whether to add -install to the dotter args (for private colormaps) */
     int pixelFacset;
     int seqInSFS;             /* whether the sequences are in the features file, i.e. there are no separate sequence files */
-    
+
     float memoryLimit;
-    
+
     DotterSaveFormatType saveFormat;                        // Save as binary or ascii text.
     char *savefile;           /* file to save the dot-plot to (batch mode; saves the dot-matrix so it can be loaded later and interacted with) */
     char *exportfile;         /* file to export the dot-plot to (batch mode; exports to a graphical format, e.g. pdf or ps. Default is pdf unless file extension indicates otherwise) */
     char *loadfile;           /* file to load a dot-plot from */
     char *FSfilename;         /* file containing features i.e. MSPs */
     char *mtxfile;            /* caller-supplied matrix file */
-    
+
     char *winsize;            /* caller-supplied sliding-window size */
-    
+
     char *qname;              /* reference (horizontal) sequence name */
     char *qseq;               /* reference (horizontal) sequence data */
     char *sname;              /* match (vertical) sequence name */
     char *sseq;               /* match (vertical) sequence data */
-    
+
     gboolean mirrorImage;     /* display mirror image in self comparisons (i.e. so we only have to calculate half of the dot-plot) */
     gboolean watsonOnly;      /* only show the watson (forward) strand of the ref seq */
     gboolean crickOnly;       /* only show the crick (reverse) strand of the ref seq */
@@ -107,7 +108,7 @@ typedef struct _DotterOptions
     gboolean vertScaleRev;    /* revese the vertical scale */
     gboolean negateCoords;    /* negate the displayed coords when the scale is reversed, i.e. so they still appear to increase from left-to-right */
     gboolean abbrevTitle;     /* abbrev window title prefix to save space */
-    
+
     BlxMessageData msgData;   /* data to be passed to the message handlers */
 
     char *windowColor;        /* if not null, background color for the window */
@@ -115,22 +116,22 @@ typedef struct _DotterOptions
 
 
 void dotter(
-	const BlxBlastMode blastMode, /* Mandatory, one of { BLASTP, BLASTN, BLASTX } 
+	const BlxBlastMode blastMode, /* Mandatory, one of { BLASTP, BLASTN, BLASTX }
 			      P -> Protein-Protein
 			      N -> DNA-DNA
 			      X -> DNA-Protein */
-	
-	DotterOptions *options, /* Optional, may be NULL 
+
+	DotterOptions *options, /* Optional, may be NULL
                                    Various options for display features */
 
 	const BlxStrand refSeqStrand,   /* which strand of the reference sequence was passed */
 
         const BlxStrand matchSeqStrand, /* which strand of the match sequence was passed */
 
-	int   qcenter,	   /* Optional, may be NULL 
+	int   qcenter,	   /* Optional, may be NULL
 			      Coordinate to centre horisontal sequence on */
 
-	int   scenter,	   /* Optional, may be NULL 
+	int   scenter,	   /* Optional, may be NULL
 			      Coordinate to centre horisontal sequence on */
 
 	MSP *MSPs,	   /* Optional, may be NULL
@@ -138,7 +139,7 @@ void dotter(
 
 	GList *seqList,	   /* Optional, may be NULL
 			      List of all match sequences, as BlxSequences */
-	    
+
 	int   MSPoff	   /* Optional, may be NULL
 			      Coordinate offset of MSPs */
 );
diff --git a/src/dotterApp/dotterKarlin.cpp b/src/dotterApp/dotterKarlin.cpp
index 8ea29d8c6db07312adb84e2d02c16b4ce8278eb8..e9dd324b150d50e6f0da42c2edd9a28e1405c59a 100644
--- a/src/dotterApp/dotterKarlin.cpp
+++ b/src/dotterApp/dotterKarlin.cpp
@@ -1,5 +1,6 @@
 /*  File: dotterKarlin.c
  *  Author: Erik Sonnhammer, 1995-08-28
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -50,12 +51,12 @@
  * From blast/gish/fct/fct_powi.c
  */
 double fct_powi(double x, register int n)
-/* x  argument */ 
+/* x  argument */
 /* n  power */
 {
     int	i;
     double	y;
-    
+
     y = 1.;
     for (i = abs(n); i > 0; i /= 2) {
 	if (i&1)
@@ -75,11 +76,11 @@ double fct_powi(double x, register int n)
 long fct_gcd(long a, long b)
 {
     long	c;
-    
+
     b = abs(b);
     if (b > a)
 	c=a, a=b, b=c;
-    
+
     while (b != 0) {
 	c = a%b;
 	a = b;
@@ -98,13 +99,13 @@ long fct_gcd(long a, long b)
 double fct_expm1(double x)
 {
     double absx = ((x < 0) ? -x : x) ;
-    
+
     if (absx > .33)
 	return exp(x) - 1.;
-    
+
     if (absx < 1.e-16)
 	return x;
-    
+
     return x * (1. + x *
 		(0.5 + x * (1./6. + x *
 			    (1./24. + x * (1./120. + x *
@@ -120,7 +121,7 @@ double fct_expm1(double x)
 }
 
 
-/* etop() -- given an Expect value, return the associated probability 
+/* etop() -- given an Expect value, return the associated probability
  * From blast/blast/lib/etop.c
  */
 double etop(double E)
@@ -131,12 +132,12 @@ double etop(double E)
 
 /* From blast/blast/lib/karlin.c
  *
- *  long	low;	 	 Lowest score (must be negative)    
- *  long	high;		 Highest score (must be positive)   
- *  double	*pr;		 Probabilities for various scores   
- *  double	*lambda;	 Pointer to parameter lambda        
- *  double	*K;		 Pointer to parmeter K              
- *  double	*H;		 Pointer to parmeter H              
+ *  long	low;	 	 Lowest score (must be negative)
+ *  long	high;		 Highest score (must be positive)
+ *  double	*pr;		 Probabilities for various scores
+ *  double	*lambda;	 Pointer to parameter lambda
+ *  double	*K;		 Pointer to parmeter K
+ *  double	*H;		 Pointer to parmeter H
  */
 double karlin(long low, long high, double *pr, double *lambda, double *K, double *H)
 {
@@ -182,9 +183,9 @@ See:	Karlin, S. & Altschul, S.F. "Methods for Assessing the Statistical
 	of the highest scoring contiguous segment of this sequence.  Then if N
 	is sufficiently large (greater than 100), the following bound on the
 	probability that S is greater than or equal to x applies:
-	
+
 		P( S >= x )   <=   1 - exp [ - KN exp ( - lambda * x ) ].
-	
+
 	In other words, the p-value for this segment can be written as
 	1-exp[-KN*exp(-lambda*S)].
 
@@ -250,7 +251,7 @@ See:	Karlin, S. & Altschul, S.F. "Methods for Assessing the Statistical
 	for (sum=0,i=low; i<=high; ++i)
 	    sum += *ptr1++ * exp(up*i);
     } while (sum<1.0);
-    
+
     /* Root solving by the bisection method */
     for (*lambda=0., j=0; j<25; ++j) {
 	new_val = (*lambda+up)/2.0;
@@ -270,7 +271,7 @@ See:	Karlin, S. & Altschul, S.F. "Methods for Assessing the Statistical
     for (av=0, i=low; i<=high; ++i)
 	av += *ptr1++ *i*exp(*lambda*i);
     *H = *lambda*av;
-    
+
     /* Calculate the parameter K */
     if (low == -1 || high == 1) {
 	*K = (high == 1 ? av : Sum*Sum/av);
@@ -319,17 +320,17 @@ See:	Karlin, S. & Altschul, S.F. "Methods for Assessing the Statistical
 	oldsum *= ratio;
 	Sum += sum = oldsum / ++j;
     }
-    
+
     for (i=low; p[i-low] == 0.; ++i)
 	;
     for (j= -i;i<high && j>1;)
 	if (p[++i-low])
 	    j = fct_gcd(j,i);
-    
+
     *K = (j*exp(-2.*Sum))/(av*etop(*lambda * j));
 
 OKExit:
-	   
+
     g_free(p);
     g_free(P);
     return 0;		/* Parameters calculated successfully */
@@ -337,29 +338,29 @@ OKExit:
 
 
 /* Adapted from blastp.c */
-int winsizeFromlambdak(gint32 mtx[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE], int *tob, int abetsize, const char *qseq, const char *sseq, 
+int winsizeFromlambdak(gint32 mtx[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE], int *tob, int abetsize, const char *qseq, const char *sseq,
 		       double *exp_res_score, double *Lambda)
 {
-    gint32 
+    gint32
         lows=0, highs=0,
         range;
-  
-    int    
+
+    int
 	i, j,
 	*n1, *n2,
 	qlen=0, slen=0,
 	retval,
 	n = 100;		/* Nominal size of dot-matrix */
-    double  
+    double
 	*fq1, *fq2, *prob, K, H,
 	qij, exp_MSP_score, sum;
-    
-    
+
+
     n1 = (int *)g_malloc((abetsize+4)*sizeof(int));
     n2 = (int *)g_malloc((abetsize+4)*sizeof(int));
     fq1 = (double *)g_malloc((abetsize+4)*sizeof(double));
     fq2 = (double *)g_malloc((abetsize+4)*sizeof(double));
-    
+
 
     /* Find high and lows score in score matrix */
     for (i = 0; i < abetsize; ++i)
@@ -391,20 +392,20 @@ int winsizeFromlambdak(gint32 mtx[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE], int *tob,
 	    slen++;
 	}
     }
-		    
+
 
     /* Convert counts to frequencies */
     for (i = 0; i < abetsize; ++i) {
 	fq1[i] = (double)n1[i] / qlen;
 	fq2[i] = (double)n2[i] / slen;
-    }	
-    
+    }
+
 
     /* Calculate probability of each score */
     range = highs - lows;
     prob = (double *)g_malloc(sizeof(double)*(range+1));
     for (i = 0; i <= range; ++i) prob[i] = 0.0;
-    
+
     for (i = 0; i < abetsize; ++i)
       {
 	for (j = 0; j < abetsize ; ++j)
@@ -418,7 +419,7 @@ int winsizeFromlambdak(gint32 mtx[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE], int *tob,
 	g_critical("Setting ad hoc values to winsize=%d and expected score=%.3f", 25, *exp_res_score);
 	return 25;
       }
-    
+
 
     /* Calculate expected score per residue in MSP */
     *exp_res_score = sum = 0;
@@ -452,4 +453,3 @@ int winsizeFromlambdak(gint32 mtx[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE], int *tob,
 
     return retval;
 }
- 
diff --git a/src/dotterApp/dotterMain.cpp b/src/dotterApp/dotterMain.cpp
index 98bf3936e2c055060737dc616afa331653bde3a3..45d8bfeea7031eb1aa3011b6c9f788d84f3b96d4 100644
--- a/src/dotterApp/dotterMain.cpp
+++ b/src/dotterApp/dotterMain.cpp
@@ -1,5 +1,6 @@
 /*  File: dotterMain.c
  *  Author: esr, 1999-08-26
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -45,7 +46,7 @@
 
 #define UNSET_INT  -1
 
-/* Usage text. This is a duplicate of the text that is in 
+/* Usage text. This is a duplicate of the text that is in
  * doc/User_doc/dotter_usage.txt, so ideally we would get rid of this and use
  * the text from the file instead; for now, we must update both. */
 
@@ -190,7 +191,7 @@ static void setDefaultOptions(DotterOptions *options)
   options->install = 1;
   options->pixelFacset = 0;
   options->seqInSFS = 0;
-  
+
   options->memoryLimit = 0.0;
 
   options->saveFormat = DOTSAVE_BINARY ;
@@ -205,7 +206,7 @@ static void setDefaultOptions(DotterOptions *options)
   options->qseq = NULL;
   options->sname = NULL;
   options->sseq = NULL;
-  
+
   options->mirrorImage = TRUE;
   options->watsonOnly = FALSE;
   options->crickOnly = FALSE;
@@ -216,7 +217,7 @@ static void setDefaultOptions(DotterOptions *options)
   options->vertScaleRev = FALSE;
   options->negateCoords = FALSE;
   options->abbrevTitle = FALSE;
-  
+
   options->msgData.titlePrefix = g_strdup(DOTTER_PREFIX);
   options->msgData.parent = NULL;
   options->msgData.statusBar = NULL;
@@ -257,7 +258,7 @@ static void addBreakline (MSP **MSPlist, char *name, char *desc, int pos, const
   MSP *lastMsp = NULL;
   char *cp = NULL;
 
-  if (!*MSPlist) 
+  if (!*MSPlist)
     {
       /* Create the first msp in the list */
       msp = createEmptyMsp(&lastMsp, MSPlist);
@@ -266,7 +267,7 @@ static void addBreakline (MSP **MSPlist, char *name, char *desc, int pos, const
     {
       /* Append a new msp to the end of the list */
       MSP *lastMsp = *MSPlist;
-      while(lastMsp->next) 
+      while(lastMsp->next)
 	lastMsp = lastMsp->next;
 
       msp = createEmptyMsp(&lastMsp, MSPlist);
@@ -290,7 +291,7 @@ static void addBreakline (MSP **MSPlist, char *name, char *desc, int pos, const
   gboolean failures[1];
   gdk_colormap_alloc_colors(gdk_colormap_get_system(), &msp->fsColor, 1, TRUE, TRUE, failures);
 //   insertFS(msp, "chain_separator");
-}		      
+}
 
 
 /* Print the usage text to stderr */
@@ -306,13 +307,13 @@ static void showUsageText(const int exitCode)
 /* Prints version info to stderr */
 static void showVersionInfo()
 {
-  g_message(VERSION_TEXT);  
+  g_message(VERSION_TEXT);
 }
 
 /* Prints compiled date (must go to stdout for our build scripts to work) */
 static void showCompiledInfo()
 {
-  g_message("%s\n", UT_MAKE_COMPILE_DATE());  
+  g_message("%s\n", UT_MAKE_COMPILE_DATE());
 }
 
 
@@ -332,17 +333,17 @@ int main(int argc, char **argv)
 
   static DotterOptions options;
   setDefaultOptions(&options);
-  
-  char   
+
+  char
       line[MAXLINE+1],
-      *curChar, *cc, *cq,  
+      *curChar, *cc, *cq,
       *qfilename, *sfilename,
       text[MAXLINE+1];
 
   FILE *qfile, *sfile;
   MSP *MSPlist = NULL;
   GList *seqList = NULL;
-  
+
   /* MSPlist above is obsolete and should be replaced by featureLists, which contains all the MSPs
    * but in GLists in an array indexed by type. Initialise each GList to NULL. */
   GArray* featureLists[BLXMSP_NUM_TYPES];
@@ -351,7 +352,7 @@ int main(int argc, char **argv)
     {
       featureLists[typeId] = g_array_new(TRUE, FALSE, sizeof(MSP*));
     }
-  
+
   static gboolean showHelp = FALSE;
   static gboolean showVersion = FALSE;
   static gboolean showCompiled = FALSE;
@@ -359,21 +360,21 @@ int main(int argc, char **argv)
   static gboolean vertScaleRev = FALSE;
   static BlxSeqType qSeqType = BLXSEQ_NONE;
   static BlxSeqType sSeqType = BLXSEQ_NONE;
-  
+
   /* The strand stuff is a bit hacky, because dotter was originally never designed to deal with
    * reverse match seq strands, so match and ref seq strands work in different ways. If the ref seq
    * strand is reversed then the horizontal scale is reversed as well. (Because the 'active' (top) strand
-   * in Blixem is always the reverse strand if the display is reversed. Note that for DNA matches both 
-   * strands are always shown anyway, so the -r option essentially just swaps which strand is shown at 
+   * in Blixem is always the reverse strand if the display is reversed. Note that for DNA matches both
+   * strands are always shown anyway, so the -r option essentially just swaps which strand is shown at
    * the top of the alignment tool, and of course reverses the direction of the display.)
-   * The vertical scale was never originally designed to be reversed in dotter. I've 
+   * The vertical scale was never originally designed to be reversed in dotter. I've
    * added the vertScaleRev flag in case we might want to do this in the future, but this is currently
    * always set to false, even if we have the reverse match seq strand (which is indicated with the -v option). */
   BlxStrand qStrand = BLXSTRAND_FORWARD;
   BlxStrand sStrand = BLXSTRAND_FORWARD;
 
   gtk_parse_args(&argc, &argv);
-  
+
   /* Get the input args. We allow long args, so we need to create a long_options array */
   static struct option long_options[] =
     {
@@ -421,10 +422,10 @@ int main(int argc, char **argv)
   int          optionIndex; /* getopt_long stores the index into the option struct here */
   int          optc;        /* the current option gets stored here */
   int sleepSecs = -1;
-  
+
   while ((optc = getopt_long(argc, argv, optstring, long_options, &optionIndex)) != EOF)
     {
-      switch (optc) 
+      switch (optc)
         {
 	  case 0:
             if (long_options[optionIndex].flag != 0)
@@ -439,7 +440,7 @@ int main(int argc, char **argv)
                   qSeqType = BLXSEQ_DNA;
                 else
                   g_critical("Invalid value for horizontal-type argument: expected 'p' or 'd'\n");
-              }                
+              }
             else if (stringsEqual(long_options[optionIndex].name, "vertical-type", TRUE))
               {
                 if (*optarg == 'p')
@@ -448,7 +449,7 @@ int main(int argc, char **argv)
                   sSeqType = BLXSEQ_DNA;
                 else
                   g_critical("Invalid value for vertical-type argument: expected 'p' or 'd'\n");
-              }                
+              }
             else if (stringsEqual(long_options[optionIndex].name, "session_colour", TRUE))
               {
                 options.windowColor = g_strdup(optarg);
@@ -458,28 +459,28 @@ int main(int argc, char **argv)
                 sleepSecs = convertStringToInt(optarg);
               }
             break;
-          
+
 	  case '?':
             break; /* getopt_long already printed an error message */
-	  
+
           case 'a': options.saveFormat = DOTSAVE_ASCII ; options.savefile = g_strdup(optarg);   break;
           case 'b': options.saveFormat = DOTSAVE_BINARY ; options.savefile = g_strdup(optarg);   break;
           case 'c': options.crickOnly = TRUE;              break;
           case 'D': options.mirrorImage = FALSE;           break;
           case 'e': options.exportfile = g_strdup(optarg); break;
           case 'f': options.FSfilename = g_strdup(optarg); break;
-          case 'F': 
-            options.seqInSFS = 1;        
+          case 'F':
+            options.seqInSFS = 1;
             options.FSfilename = (char*)g_malloc(strlen(optarg)+1);
             strcpy(options.FSfilename, optarg);            break;
-	  case 'h': 
+	  case 'h':
             showHelp = TRUE;                               break;
           case 'H': options.hspsOnly = TRUE;               break;
           case 'i': options.install = 0;                   break;
-          case 'l': 
+          case 'l':
             options.loadfile = (char*)g_malloc(strlen(optarg)+1);
             strcpy(options.loadfile, optarg);              break;
-          case 'M': 
+          case 'M':
             options.mtxfile = (char*)g_malloc(strlen(optarg)+1);
             strcpy(options.mtxfile, optarg);               break;
           case 'm': options.memoryLimit = atof(optarg);    break;
@@ -489,10 +490,10 @@ int main(int argc, char **argv)
           case 'R': options.swapGreyramp = TRUE;           break;
           case 'r': qStrand = BLXSTRAND_REVERSE;	   break;
           case 's': options.soffset = atoi(optarg);        break;
-          case 'S': 
+          case 'S':
             options.selfcall = TRUE;                       break;
           case 'v': sStrand = BLXSTRAND_REVERSE;	   break;
-          case 'W': 
+          case 'W':
             options.winsize = (char*)g_malloc(strlen(optarg)+1);
             strcpy(options.winsize, optarg);               break;
           case 'w': options.watsonOnly = TRUE;             break;
@@ -501,7 +502,7 @@ int main(int argc, char **argv)
           case 'z': options.dotterZoom = atoi(optarg);     break;
           default :
             {
-              g_message("Illegal option\n"); 
+              g_message("Illegal option\n");
               showUsageText(EXIT_FAILURE);
               exit(EXIT_FAILURE);
               break ;
@@ -539,24 +540,24 @@ int main(int argc, char **argv)
       showUsageText(EXIT_SUCCESS);
       exit(EXIT_SUCCESS);
     }
-  
+
   if (showVersion)
     {
       showVersionInfo();
       exit (EXIT_SUCCESS);
     }
-  
+
   if (showCompiled)
     {
       showCompiledInfo();
       exit (EXIT_SUCCESS);
     }
-  
+
   validateOptions(&options);
 
   options.hozScaleRev = hozScaleRev;
   options.vertScaleRev = vertScaleRev;
-  
+
   /* There's a bug if the rev-scale options are not used with the rev strand and vv, so
    * for now if one option is set, force the other. */
   if (options.hozScaleRev || qStrand == BLXSTRAND_REVERSE)
@@ -564,31 +565,31 @@ int main(int argc, char **argv)
       options.hozScaleRev = TRUE;
       qStrand = BLXSTRAND_REVERSE;
     }
-  
+
   if (options.vertScaleRev || sStrand == BLXSTRAND_REVERSE)
     {
       options.vertScaleRev = TRUE;
       sStrand = BLXSTRAND_REVERSE;
     }
-  
-  
+
+
   if (options.selfcall) /* Blixem/Dotter calling dotter */
     {
       DEBUG_OUT("Dotter was called internally.\n");
-      
+
       /* The input arguments (following the options) are: qname, qlen, sname, slen. */
       if (argc - optind < 5 || argc - optind > 5)
         {
-          g_message("Incorrect number of arguments passed to dotter from internal program call\n"); 
+          g_message("Incorrect number of arguments passed to dotter from internal program call\n");
           showUsageText(EXIT_FAILURE);
           exit(EXIT_FAILURE);
         }
-      
+
       options.qname = g_strdup(argv[optind]);
       options.qlen = atoi(argv[optind + 1]);
       options.sname = g_strdup(argv[optind + 2]);
       options.slen = atoi(argv[optind + 3]);
-      
+
       /* Allocate memory for the sequences, now we know their lengths */
       options.qseq = (char*)g_malloc(sizeof(char) * (options.qlen+1));
       options.sseq = (char*)g_malloc(sizeof(char) * (options.slen+1));
@@ -596,8 +597,8 @@ int main(int argc, char **argv)
       /* Read in the sequences from the piped input */
       DEBUG_OUT("Reading sequences from pipe...\n");
 
-      int l = fread(options.qseq, 1, options.qlen, stdin); 
-      if (l != options.qlen) 
+      int l = fread(options.qseq, 1, options.qlen, stdin);
+      if (l != options.qlen)
         {
           g_message("Only read %d chars to qseq, expected %d\n", l, options.qlen);
           exit(EXIT_FAILURE);
@@ -605,7 +606,7 @@ int main(int argc, char **argv)
       options.qseq[options.qlen] = 0;
 
       l = fread(options.sseq, 1, options.slen, stdin);
-      if (l != options.slen) 
+      if (l != options.slen)
         {
           g_message("Only read %d chars to sseq, expected %d\n", l, options.slen);
           exit(EXIT_FAILURE);
@@ -616,9 +617,9 @@ int main(int argc, char **argv)
       /* Read in the features from the piped input */
       DEBUG_OUT("Reading features from pipe...\n");
       MSP *lastMsp = NULL;
-      
+
       while (!feof (stdin))
-        { 
+        {
           /* read in the blxsequences. they are separated by newlines */
           if (!fgets (text, MAXLINE, stdin) || (unsigned char)*text == (unsigned char)EOF)
             break;
@@ -626,7 +627,7 @@ int main(int argc, char **argv)
           int numMsps = 0;
           BlxSequence *blxSeq = readBlxSequenceFromText(text, &numMsps);
           seqList = g_list_append(seqList, blxSeq);
-          
+
           /* read in the msps for this blx sequence and add them to the msplist */
           int i = 0;
           for ( ; i < numMsps; ++i)
@@ -637,14 +638,14 @@ int main(int argc, char **argv)
 
               MSP *msp = createEmptyMsp(&lastMsp, &MSPlist);
               readMspFromText(msp, text);
-              
+
               /* add it to the relevant feature list. */
               featureLists[msp->type] = g_array_append_val(featureLists[msp->type], msp);
-              
+
               /* add the msp to the blxsequence */
               blxSeq->mspList = g_list_append(blxSeq->mspList, msp);
               msp->sSequence = blxSeq;
-              
+
               /* really horrible hack */
               if (msp->type == BLXMSP_FS_SEG)
                 {
@@ -653,7 +654,7 @@ int main(int argc, char **argv)
                 }
             }
         }
-        
+
       fclose(stdin);
       DEBUG_OUT("...done.\n");
     }
@@ -671,23 +672,23 @@ int main(int argc, char **argv)
     {
 
       /* The input arguments (following the options) are: qfile, sfile, so we should have 2 arguments */
-      if (argc - optind < 2 || argc - optind > 2) 
+      if (argc - optind < 2 || argc - optind > 2)
         {
           showUsageText(EXIT_FAILURE);
           exit(EXIT_FAILURE);
         }
 
-      if(!(qfile = fopen(argv[optind], "r"))) 
+      if(!(qfile = fopen(argv[optind], "r")))
         {
-          g_message("Cannot open %s\n", argv[optind]); 
+          g_message("Cannot open %s\n", argv[optind]);
           exit(EXIT_FAILURE);
         }
-    
+
       qfilename = argv[optind];
       fseek(qfile, 0, SEEK_END);
       options.qlen = ftell(qfile);
       fseek(qfile, 0, SEEK_SET);
-    
+
       if ((curChar = (char *)strrchr(argv[optind], '/')))
         {
           options.qname = g_strdup(curChar+1);
@@ -697,17 +698,17 @@ int main(int argc, char **argv)
           options.qname = g_strdup(argv[optind]);
         }
 
-      if (!(sfile = fopen(argv[optind+1], "r"))) 
+      if (!(sfile = fopen(argv[optind+1], "r")))
         {
-          g_message("Cannot open %s\n", argv[optind+1]); 
+          g_message("Cannot open %s\n", argv[optind+1]);
           exit(EXIT_FAILURE);
         }
-    
+
       sfilename = argv[optind+1];
       fseek(sfile, 0, SEEK_END);
       options.slen = ftell(sfile);
       fseek(sfile, 0, SEEK_SET);
-    
+
       if ((curChar = (char *)strrchr(argv[optind]+1, '/')))
         {
           options.sname = g_strdup(curChar+1);
@@ -725,25 +726,25 @@ int main(int argc, char **argv)
       int l = 0, count = 0;
       cc = options.qseq;
       char *firstdesc = NULL;
-    
+
       while (!feof(qfile))
         {
           if (!fgets(line, MAXLINE, qfile))
             {
               break;
             }
-      
+
           if ((cq = (char *)strchr(line, '\n')))
             {
               *cq = 0;
             }
 
           /* Name headers */
-          if ((cq = (char *)strchr(line, '>'))) 
+          if ((cq = (char *)strchr(line, '>')))
             {
 
               cq++;
-              if (++l == 1) 
+              if (++l == 1)
                 {
 
                   options.qname = (char*)g_malloc(strlen(cq)+1); strNamecpy(options.qname, cq);
@@ -753,25 +754,25 @@ int main(int argc, char **argv)
                 {
 
                 /* Multiple sequences - add break lines */
-                  if (l == 2) 
+                  if (l == 2)
                     {
 
                       options.breaklinesOn = TRUE;
 
                       /* Second sequence - add break line to mark first sequence */
                       addBreakline (&MSPlist, qfilename, firstdesc, options.qoffset, 1);
-                      
+
                       /* change sequence name to filename */
                       options.qname = (char*)g_malloc(strlen(qfilename)+1); strcpy(options.qname, qfilename);
                     }
-                  
+
                   addBreakline (&MSPlist, qfilename, cq, count + options.qoffset, 1);
                 }
             }
-          else 
+          else
             {
               /* Read in sequence data */
-              for (cq = line; *cq; cq++) 
+              for (cq = line; *cq; cq++)
                 {
                   /* Don't know yet what type of sequence it is, so accept chars for both types */
                   if (isValidIupacChar(*cq, BLXSEQ_DNA) || isValidIupacChar(*cq, BLXSEQ_PEPTIDE))
@@ -793,7 +794,7 @@ int main(int argc, char **argv)
 
       l = 0, count = 0;
       cc = options.sseq;
-    
+
       while (!feof(sfile))
         {
           if (!fgets(line, MAXLINE, sfile))
@@ -816,16 +817,16 @@ int main(int argc, char **argv)
 
       	        /* Second sequence - add break line to mark first sequence */
       	        addBreakline (&MSPlist, sfilename, firstdesc, options.soffset, 2);
-      		
+
       		/* change sequence name to filename */
       		options.sname = (char*)g_malloc(strlen(sfilename)+1); strcpy(options.sname, sfilename);
       	    }
       	    addBreakline (&MSPlist, sfilename, cq, count + options.soffset, 2);
       	}
           }
-          else 
+          else
             {
-              for (cq = line; *cq; cq++) 
+              for (cq = line; *cq; cq++)
                 {
                   /* Don't know yet what type of sequence it is, so accept chars for both types */
                   if (isValidIupacChar(*cq, BLXSEQ_DNA) || isValidIupacChar(*cq, BLXSEQ_PEPTIDE))
@@ -836,9 +837,9 @@ int main(int argc, char **argv)
                 }
             }
         }
-      
+
       *cc = 0;
-      
+
       if (firstdesc)
         {
           g_free(firstdesc);
@@ -848,11 +849,11 @@ int main(int argc, char **argv)
 
   BlxBlastMode blastMode = BLXMODE_UNSET;
 
-  if (options.FSfilename) 
+  if (options.FSfilename)
     {
       FILE *file;
-      
-      if (!strcmp(options.FSfilename, "-")) 
+
+      if (!strcmp(options.FSfilename, "-"))
         {
           file = stdin;
         }
@@ -861,20 +862,20 @@ int main(int argc, char **argv)
           g_message("Cannot open %s\n", options.FSfilename);
           exit(EXIT_FAILURE);
         }
-      
+
       GSList *supportedTypes = blxCreateSupportedGffTypeList(BLXSEQ_NONE);
       GList *columnList = dotterCreateColumns();
       GError *error = NULL;
-  
+
       /* Create a temporary lookup table for BlxSequences so we can link them on GFF ID */
       GHashTable *lookupTable = g_hash_table_new(g_direct_hash, g_direct_equal);
 
       parseFS(&MSPlist, file, &blastMode, featureLists, &seqList, columnList, supportedTypes, NULL, &options.qseq, options.qname, NULL, &options.sseq, options.sname, NULL, lookupTable, NULL, &error);
 
       reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
-      
+
       finaliseBlxSequences(featureLists, &MSPlist, &seqList, columnList, 0, BLXSEQ_NONE, -1, NULL, FALSE, lookupTable);
-      
+
       blxDestroyGffTypeList(&supportedTypes);
     }
 
@@ -886,7 +887,7 @@ int main(int argc, char **argv)
       prefixError(error, "Error starting dotter; could not determine the sequence type for '%s'.\n", options.qname);
       reportAndClearIfError(&error, G_LOG_LEVEL_ERROR);
     }
-  
+
   if (sSeqType == BLXSEQ_NONE)
     {
       GError *error = NULL;
@@ -894,18 +895,18 @@ int main(int argc, char **argv)
       prefixError(error, "Error starting dotter; could not determine the sequence type for '%s'.\n", options.sname);
       reportAndClearIfError(&error, G_LOG_LEVEL_ERROR);
     }
-  
-  if (qSeqType == BLXSEQ_PEPTIDE && sSeqType == BLXSEQ_PEPTIDE) 
+
+  if (qSeqType == BLXSEQ_PEPTIDE && sSeqType == BLXSEQ_PEPTIDE)
     {
       g_message("\nDetected sequence types: Protein vs. Protein\n");
       blastMode = BLXMODE_BLASTP;
     }
-  else if (qSeqType == BLXSEQ_DNA && sSeqType == BLXSEQ_DNA) 
+  else if (qSeqType == BLXSEQ_DNA && sSeqType == BLXSEQ_DNA)
     {
       g_message("\nDetected sequence types: DNA vs. DNA\n");
       blastMode = BLXMODE_BLASTN;
     }
-  else if (qSeqType == BLXSEQ_DNA && sSeqType == BLXSEQ_PEPTIDE) 
+  else if (qSeqType == BLXSEQ_DNA && sSeqType == BLXSEQ_PEPTIDE)
     {
       g_message("\nDetected sequence types: DNA vs. Protein\n");
       blastMode = BLXMODE_BLASTX;;
@@ -915,9 +916,9 @@ int main(int argc, char **argv)
       g_message("Illegal sequence types: Protein vs. DNA - turn arguments around!\n");
       exit(EXIT_FAILURE);
     }
-    
+
   /* Add -install for private colormaps */
-  if (options.install) 
+  if (options.install)
     {
       argvAdd(&argc, &argv, "-install");
     }
@@ -930,7 +931,7 @@ int main(int argc, char **argv)
     {
       gtk_main();
     }
-  
+
   /* destroy the feature lists. note that the stored msps are owned
    * by the msplist, not by the feature lists */
   typeId = 0;
diff --git a/src/dotterApp/dotter_.hpp b/src/dotterApp/dotter_.hpp
index cce6b224c059ae290ba61c70e48798b88c7bbef8..1d634683e40289c8694d62341cfdbc89a49f24d7 100644
--- a/src/dotterApp/dotter_.hpp
+++ b/src/dotterApp/dotter_.hpp
@@ -1,5 +1,6 @@
 /*  File: dotter_.h
  *  Author: esr, 1999-08-26
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -95,14 +96,14 @@ typedef enum _DotterHspMode
   } DotterHspMode;
 
 /* The following are used to define default colors for certain types of features in Dotter.
- * One of several different actual colors from the BlxColor struct may be used depending 
- * on state, e.g. we use a different color if "print colors" (i.e. black and 
+ * One of several different actual colors from the BlxColor struct may be used depending
+ * on state, e.g. we use a different color if "print colors" (i.e. black and
  * white mode) is on. */
 
-typedef enum 
+typedef enum
 {
   DOTCOLOR_MIN,                             /* dummy value so that we don't get a zero ID */
-  
+
   DOTCOLOR_BACKGROUND,                      /* background color for widgets */
   DOTCOLOR_MATCH,                           /* background color for an exact match */
   DOTCOLOR_CONS,                            /* background color for a conserved match */
@@ -122,7 +123,7 @@ typedef enum
   DOTCOLOR_BREAKLINE,                       /* the color of break-lines between sequences */
   DOTCOLOR_CANONICAL,
   DOTCOLOR_NON_CANONICAL,
-  
+
   DOTCOLOR_NUM_COLORS
 } DotterColorId;
 
@@ -133,10 +134,10 @@ typedef enum
 typedef enum
   {
     DOTDIALOG_NOT_PERSISTENT = 0,   /* Reserved for dialogs that do not have an entry in the array */
-    
+
     DOTDIALOG_HELP,                 /* The Help dialog */
     DOTDIALOG_SETTINGS,             /* The Settings dialog */
-    
+
     DOTDIALOG_NUM_DIALOGS           /* The number of dialogs. Must always be the last entry in this enum */
   } DotterDialogId;
 
@@ -160,11 +161,11 @@ typedef struct _DotterContext
 
   gboolean watsonOnly;                      /* true if we only display the watson strand */
   gboolean crickOnly;                       /* true if we only display the crick strand */
-  
+
   PangoFontDescription *fontDesc;           /* fixed-width font to use for alignment */
   gdouble charWidth;                        /* the fixed-width font width */
   gdouble charHeight;                       /* the fixed-width font height */
-  
+
   char *refSeqName;                         /* the reference sequence name */
   char *refSeq;                             /* the passed-in reference sequence */
   char *refSeqRev;                          /* the reverse-complement of refSeq (or NULL if not applicable) */
@@ -173,14 +174,14 @@ typedef struct _DotterContext
   BlxSeqType refSeqType;                    /* whether refSeq is in nucleotide or peptide coords */
 
   char* peptideSeqs[NUM_READING_FRAMES];    /* Array of 3 strings containing the 3 frame translations of the reference sequence */
-  
+
   char *matchSeqName;                       /* the match sequence name */
   char *matchSeq;                           /* the match sequence */
   char *matchSeqRev;                        /* the revsere-complemented match sequence (or NULL if not applicable) */
   IntRange matchSeqFullRange;               /* the full match sequence range passed to dotter on startup */
   BlxStrand matchSeqStrand;                 /* which strand of the match seq we were passed */
   BlxSeqType matchSeqType;                  /* whether matchSeq is in nucleotide or peptide coords */
-  
+
   gboolean hozScaleRev;                     /* true if horizontal coords should increase from right-to-left rather than left-to-right */
   gboolean vertScaleRev;                    /* true if vertical coords should increase from bottom-to-top rather than top-to-bottom */
   gboolean negateCoords;                    /* negate displayed coords if the scale is reversed, i.e. so coords still appear to increase left-to-right */
@@ -188,12 +189,12 @@ typedef struct _DotterContext
   gboolean abbrevTitle;                     /* abbreviate window titles to save space */
 
   double memoryLimit;                       /* maximum Mb allowed for dotplot */
-  
+
   int scaleWidth;                           /* width of the dotplot scale */
   int scaleHeight;                          /* height of the dotplot scale */
 
   GArray *defaultColors;                    /* Default colors used by Dotter */
-  
+
   BlxMessageData *msgData;                  /* Data to be passed to message handlers */
 } DotterContext;
 
@@ -202,18 +203,18 @@ typedef struct _DotterContext
 typedef struct _DotterWindowContext
   {
     DotterContext *dotterCtx;
-    
+
     IntRange refSeqRange;                     /* displayed ref seq range currently displayed in this window */
     IntRange matchSeqRange;                   /* displayed match seq range currently displayed in this window */
-    
+
     int refCoord;                             /* currently-selected ref seq coord */
     int matchCoord;                           /* currently-selected match seq coord */
-    
+
     gdouble zoomFactor;                       /* we divide by this to scale the dotplot, i.e. <1 zooms in, >1 zooms out */
     gboolean selfComp;                        /* true if we're comparing the same portion ref seq against itself */
-    
+
     GtkWidget *dialogList[DOTDIALOG_NUM_DIALOGS]; /* list of all persistent dialogs for this window */
-    
+
     GtkPrintSettings *printSettings;          /* print settings */
     GtkPageSetup *pageSetup;                  /* page setup for printing */
     gboolean usePrintColors;                  /* whether to use print colours */
@@ -249,36 +250,36 @@ public:
   GtkWidget *hozExons2;               /* shows other strand exons for horizontal sequence */
   GtkWidget *vertExons1;              /* shows main strand exons for vertical sequence */
   GtkWidget *vertExons2;              /* shows other strand exons for vertical sequence */
-    
+
   gulong greyMap[NUM_COLORS];         /* maps weight -> pixel value. fixed mapping in pseudo colour displays
                                          variable mapping in truecolor displays */
   GdkColor greyRamp[NUM_COLORS];      /* 256 grey colors, black->white, only used in true color displays */
   GdkColormap *colorMap;              /* the greyramp colormap */
-    
+
   int imageWidth;
   int imageHeight;
   GdkImage *image;                    /* the greyramp image */
-    
+
   double expResScore;
   int pixelFac;
   int slidingWinSize;
-    
+
   /* Dynamic properties: */
   unsigned char *pixelmap;            /* source data for drawing the dot-plot */
   unsigned char *hspPixmap;           /* source data for drawing the HSP dot-plot */
-    
+
   gboolean crosshairOn;               /* whether to show the crosshair that marks the position of the currently-selected coord */
   gboolean crosshairCoordsOn;         /* whether to display the crosshair label */
   gboolean crosshairFullscreen;       /* whether to show the crosshair over the whole widget or just within the dot-plot rectangle */
-    
+
   gboolean pixelmapOn;                /* whether to show the dot-plot pixelmap or not */
   DotterHspMode hspMode;              /* how (and whether) to show high-scoring pairs from Blast */
-    
+
   gboolean gridlinesOn;               /* whether to show grid lines */
   gboolean breaklinesOn;              /* whether to show break-lines between sequences */
   gboolean hozLabelsOn;               /* whether to show labels for features on the horizontal sequence */
   gboolean vertLabelsOn;              /* whether to show labels for features on the vertical sequence */
-    
+
   GdkPoint dragStart;                 /* start point for mid-click drag */
   GdkPoint dragEnd;                   /* end point for mid-click drag */
 
@@ -300,7 +301,7 @@ const char*         dotterGetLicenseString(void);
 const char*         dotterGetVersionString(void);
 
 int                 winsizeFromlambdak(int mtx[CONS_MATRIX_SIZE][CONS_MATRIX_SIZE],
-                                       int *tob, int abetsize, const char *qseq, const char *sseq, 
+                                       int *tob, int abetsize, const char *qseq, const char *sseq,
                                        double *exp_res_score, double *Lambda);
 
 void                argvAdd(int *argc, char ***argv, const char *s);
@@ -315,13 +316,13 @@ int                 getEndCoord(DotterWindowContext *dwc, const gboolean horizon
 int                 getSelectedCoord(DotterWindowContext *dwc, const gboolean horizontal);
 void                dotterEnableSelectionMenus(DotterWindowContext *dwc, const gboolean enable);
 
-void                callDotterInternal(DotterContext *dc, 
+void                callDotterInternal(DotterContext *dc,
                                        const IntRange* const refSeqRange,
                                        const IntRange* const matchSeqRange,
                                        const gdouble zoomFactor,
                                        const gboolean breaklinesOn);
 
-void                dotterSetToggleMenuStatus(DotterWindowContext *dwc, 
+void                dotterSetToggleMenuStatus(DotterWindowContext *dwc,
                                               const char *menuItem,
                                               const gboolean enable);
 
@@ -343,7 +344,7 @@ void                alignmentToolCopySelnCoords(GtkWidget *alignmentTool);
 void                alignmentToolClearSequenceSelection(GtkWidget *alignmentTool);
 
 /* dotplot.c */
-GtkWidget*          createDotplot(DotterWindowContext *dwc, 
+GtkWidget*          createDotplot(DotterWindowContext *dwc,
                                   const char *loadFileName,
                                   const char *saveFileName,
                                   const DotterSaveFormatType saveFormat,
diff --git a/src/dotterApp/greyramptool.cpp b/src/dotterApp/greyramptool.cpp
index 84a5bf36b6c678e7ef7c4106cacbb70ea734a579..2f986e507ce4d7e63f37fe215bbbafa32c58d123 100644
--- a/src/dotterApp/greyramptool.cpp
+++ b/src/dotterApp/greyramptool.cpp
@@ -1,5 +1,6 @@
 /*  File: greyramp.c
  *  Author: Gemma Barson, 2010-08-31
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -29,8 +30,8 @@
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
  * Description: Creates the greyramp tool window for a Dotter window.
- *              The greyramp tool is used to control how much noise is filtered 
- *              out in the dotplot. The greyramp too is owned by the Dotter 
+ *              The greyramp tool is used to control how much noise is filtered
+ *              out in the dotplot. The greyramp too is owned by the Dotter
  *              window and will be destroyed when that window is closed.
  *----------------------------------------------------------------------------
  */
@@ -71,22 +72,22 @@ public:
                                        * undocked from the main window */
   DotterWindowContext *dwc;
   GdkRectangle gradientRect;          /* the area where the gradient ectangle is drawn */
-    
+
   GtkWidget *whiteSpinButton;         /* spin button to control the position of the white point in the gradient */
   GtkWidget *blackSpinButton;         /* spin button to control the position of the black point in the gradient */
-    
+
   int blackPoint;                     /* current position for the black point */
   int whitePoint;                     /* current position for the white point */
   int lastBlackPoint;                 /* the previous value for the black-point spin button (so we can undo) */
   int lastWhitePoint;                 /* the previous value for the white-point spin button (so we can undo) */
-    
+
   gboolean swapValues;                /* top and bottom values are swapped (i.e. so top is max and bottom is min) */
 
   gboolean draggingWhite;             /* set to true when dragging the white-point marker */
   gboolean draggingBlack;             /* set to true when dragging the black-point marker */
   gboolean draggingThreshold;         /* set to true when dragging the threshold marker */
   gint dragXPos;                      /* x position of where the drag started */
-    
+
   GSList *callbackItems;              /* a list of callbacks to be called when the greyramp is updated */
 
   int greyrampMinDist;                /* minimum dist between black and white point */
@@ -105,7 +106,7 @@ static GreyrampProperties* greyrampGetProperties(GtkWidget *greyramp)
 static void onDestroyGreyramp(GtkWidget *greyramp)
 {
   GreyrampProperties *properties = greyrampGetProperties(greyramp);
-  
+
   if (properties)
     {
       if (properties->callbackItems)
@@ -116,23 +117,23 @@ static void onDestroyGreyramp(GtkWidget *greyramp)
               CallbackItem *callbackItem = (CallbackItem*)(item->data);
               delete callbackItem;
             }
-          
+
           g_slist_free(properties->callbackItems);
         }
-      
+
       delete properties;
       properties = NULL;
       g_object_set_data(G_OBJECT(greyramp), "GreyrampProperties", NULL);
     }
 }
 
-static void greyrampCreateProperties(GtkWidget *greyramp, 
+static void greyrampCreateProperties(GtkWidget *greyramp,
                                      GtkWidget *greyrampWindow,
 				     DotterWindowContext *dwc,
                                      GdkRectangle *gradientRect,
                                      GtkWidget *whiteSpinButton,
                                      GtkWidget *blackSpinButton,
-                                     const int blackPoint, 
+                                     const int blackPoint,
                                      const int whitePoint,
                                      const int lastBlackPoint,
                                      const int lastWhitePoint,
@@ -163,9 +164,9 @@ static void greyrampCreateProperties(GtkWidget *greyramp,
       properties->dragXPos = 0;
       properties->callbackItems = NULL;
       properties->greyrampMinDist = greyrampMinDist;
-      
+
       g_object_set_data(G_OBJECT(greyramp), "GreyrampProperties", properties);
-      g_signal_connect(G_OBJECT(greyramp), "destroy", G_CALLBACK(onDestroyGreyramp), NULL); 
+      g_signal_connect(G_OBJECT(greyramp), "destroy", G_CALLBACK(onDestroyGreyramp), NULL);
     }
 }
 
@@ -174,7 +175,7 @@ static void greyrampCreateProperties(GtkWidget *greyramp,
 static void greyrampSetWhitePoint(GtkWidget *greyramp, GreyrampProperties *properties, const int whitePoint)
 {
   properties->whitePoint = whitePoint;
-  
+
   const int greyrampMin = GREYRAMP_MIN;
   const int greyrampMax = GREYRAMP_MAX;
 
@@ -182,7 +183,7 @@ static void greyrampSetWhitePoint(GtkWidget *greyramp, GreyrampProperties *prope
     {
       properties->whitePoint = greyrampMin;
     }
-  
+
   if (properties->whitePoint > greyrampMax)
     {
       properties->whitePoint = greyrampMax;
@@ -192,7 +193,7 @@ static void greyrampSetWhitePoint(GtkWidget *greyramp, GreyrampProperties *prope
     {
       properties->whitePoint = properties->blackPoint - properties->greyrampMinDist;
     }
-  
+
   if (properties->whiteSpinButton)
     {
       gtk_spin_button_set_value(GTK_SPIN_BUTTON(properties->whiteSpinButton), properties->whitePoint);
@@ -207,7 +208,7 @@ static void greyrampSetWhitePoint(GtkWidget *greyramp, GreyrampProperties *prope
 static void greyrampSetBlackPoint(GtkWidget *greyramp, GreyrampProperties *properties, const int blackPoint)
 {
   properties->blackPoint = blackPoint;
-  
+
   const int greyrampMin = GREYRAMP_MIN;
   const int greyrampMax = GREYRAMP_MAX;
 
@@ -215,7 +216,7 @@ static void greyrampSetBlackPoint(GtkWidget *greyramp, GreyrampProperties *prope
     {
       properties->blackPoint = greyrampMin;
     }
-  
+
   if (properties->blackPoint > greyrampMax)
     {
       properties->blackPoint = greyrampMax;
@@ -245,13 +246,13 @@ void registerGreyrampCallback(GtkWidget *greyramp, GtkWidget *widget, GtkCallbac
   DEBUG_ENTER("registerGreyrampCallback");
 
   GreyrampProperties *properties = greyrampGetProperties(greyramp);
-  
+
   CallbackItem *callbackItem = new CallbackItem;
   callbackItem->widget = widget;
   callbackItem->func = func;
-  
+
   properties->callbackItems = g_slist_append(properties->callbackItems, callbackItem);
-  
+
   DEBUG_EXIT("registerGreyrampCallback returning ");
 }
 
@@ -277,12 +278,12 @@ static gboolean onDeleteGreyrampTool(GtkWidget *widget, GdkEvent *event, gpointe
 void updateGreyMap(GtkWidget *greyramp)
 {
   GreyrampProperties *properties = greyrampGetProperties(greyramp);
-  
+
   unsigned char *ramp = (unsigned char*)g_malloc(256 * sizeof(unsigned char));
-  
+
   int whitePoint = properties->whitePoint;
   int blackPoint = properties->blackPoint;
-  
+
   /* If black and white point are the same, make the white point less than the black point
    * (But make sure it's still in bounds) */
   if (blackPoint == whitePoint && blackPoint < GREYRAMP_MAX)
@@ -293,48 +294,48 @@ void updateGreyMap(GtkWidget *greyramp)
     {
       --whitePoint;
     }
-  
+
   if (blackPoint < whitePoint)
     {
       int i = 0;
-    
+
       for (i = 0 ; i < blackPoint ; ++i)
 	ramp[i] = 0x0 ;
-    
+
       gdouble fac = 0xff / (gdouble)(whitePoint - blackPoint) ;
-    
+
       for ( ; i < whitePoint && i < 256 ; ++i)
-	ramp[i] =  fac * (i - blackPoint) ; 
-    
+	ramp[i] =  fac * (i - blackPoint) ;
+
       for ( ; i < 256 ; ++i)
 	ramp[i] = 0xff ;
     }
   else
-    { 
+    {
       int i = 0;
-      
+
       for (i = 0 ; i < whitePoint ; ++i)
 	ramp[i] = 0xff ;
-      
+
       gdouble fac = 0xff / (gdouble)(blackPoint - whitePoint) ;
-      
+
       for ( ; i < blackPoint && i < 256 ; ++i)
-	ramp[i] = fac * (blackPoint - i) ; 
-      
+	ramp[i] = fac * (blackPoint - i) ;
+
       for ( ; i < 256 ; ++i)
 	ramp[i] = 0x0 ;
     }
-  
-  
+
+
   /* Loop through our list of widgets that require their callbacks to be called */
   GSList *item = properties->callbackItems;
-  
+
   for ( ; item; item = item->next)
     {
       CallbackItem *callbackItem = (CallbackItem*)(item->data);
       callbackItem->func(callbackItem->widget, ramp);
     }
-  
+
   g_free(ramp);
 }
 
@@ -408,7 +409,7 @@ static void drawGradient(GdkDrawable *drawable, GtkWidget *greyramp)
   /* If the positions are the same, make the black pos slightly smaller (to emulate historic behaviour) */
   int whitePoint = properties->whitePoint;
   int blackPoint = properties->blackPoint;
-  
+
   if (whitePoint == blackPoint)
     {
       if (blackPoint <= 1)
@@ -424,28 +425,28 @@ static void drawGradient(GdkDrawable *drawable, GtkWidget *greyramp)
   /* Get the white and black points as fractions of 1.0 */
   gdouble blackPos = blackPoint / ((gdouble)GREYRAMP_MAX);
   gdouble whitePos = whitePoint / ((gdouble)GREYRAMP_MAX);
-  
+
   /* Add a stop at the start and end. The start is white if the whitePos is less than blackPos */
   const int whiteEnd = whitePos < blackPos ? 0 : 1;
   const int blackEnd = whitePos < blackPos ? 1 : 0;
   cairo_pattern_add_color_stop_rgb(pattern, whiteEnd, 1.0, 1.0, 1.0);
   cairo_pattern_add_color_stop_rgb(pattern, blackEnd, 0.0, 0.0, 0.0);
-  
+
   /* Add stop points at the black/white positions */
   cairo_pattern_add_color_stop_rgb(pattern, whitePos, 1.0, 1.0, 1.0);
   cairo_pattern_add_color_stop_rgb(pattern, blackPos, 0.0, 0.0, 0.0);
-  
+
   if (cairo_pattern_status(pattern) == CAIRO_STATUS_SUCCESS)
     {
       cairo_t *cr = gdk_cairo_create(drawable);
-      
+
       gdk_cairo_rectangle(cr, rect);
       cairo_set_source(cr, pattern);
       cairo_fill(cr);
-      
+
       cairo_destroy(cr);
     }
-  
+
   cairo_pattern_destroy(pattern);
 }
 
@@ -455,10 +456,10 @@ static void drawWhiteMarker(GdkDrawable *drawable, GtkWidget *greyramp)
 {
   GreyrampProperties *properties = greyrampGetProperties(greyramp);
   DotterContext *dc = properties->dwc->dotterCtx;
-  
+
   GdkRectangle markerRect;
   getWhiteMarkerRect(properties, &markerRect);
-  
+
   /* Draw a triangle. Line color is the 'selected' color if dragging */
   GdkColor *fillColor = getGdkColor(DOTCOLOR_MARKER_FILL, dc->defaultColors, FALSE, properties->dwc->usePrintColors);
   GdkColor *lineColor = getGdkColor(DOTCOLOR_MARKER_LINE, dc->defaultColors, properties->draggingWhite, properties->dwc->usePrintColors);
@@ -474,12 +475,12 @@ static void drawWhiteMarker(GdkDrawable *drawable, GtkWidget *greyramp)
 
   /* Draw and outline of marker */
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   gdk_gc_set_foreground(gc, fillColor);
   gdk_draw_polygon(drawable, gc, TRUE, points, numPoints);
   gdk_gc_set_foreground(gc, lineColor);
   gdk_draw_polygon(drawable, gc, FALSE, points, numPoints);
-  
+
   g_object_unref(gc);
 }
 
@@ -492,11 +493,11 @@ static void drawBlackMarker(GdkDrawable *drawable, GtkWidget *greyramp)
 
   GdkRectangle markerRect;
   getBlackMarkerRect(properties, &markerRect);
-  
+
   /* Draw a triangle. Line color is the 'selected' color if dragging */
   GdkColor *fillColor = getGdkColor(DOTCOLOR_MARKER_FILL, dc->defaultColors, FALSE, properties->dwc->usePrintColors);
   GdkColor *lineColor = getGdkColor(DOTCOLOR_MARKER_LINE, dc->defaultColors, properties->draggingBlack, properties->dwc->usePrintColors);
-  
+
   int numPoints = 3;
   GdkPoint points[numPoints];
   points[0].x = markerRect.x + (markerRect.width / 2);
@@ -505,15 +506,15 @@ static void drawBlackMarker(GdkDrawable *drawable, GtkWidget *greyramp)
   points[1].y = markerRect.y + markerRect.height;
   points[2].x = markerRect.x + markerRect.width;
   points[2].y = markerRect.y + markerRect.height;
-  
+
   /* Draw fill in white and line in black (or green if dragging) */
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   gdk_gc_set_foreground(gc, fillColor);
   gdk_draw_polygon(drawable, gc, TRUE, points, numPoints);
   gdk_gc_set_foreground(gc, lineColor);
   gdk_draw_polygon(drawable, gc, FALSE, points, numPoints);
-  
+
   g_object_unref(gc);
 }
 
@@ -523,17 +524,17 @@ static void drawThresholdMarker(GdkDrawable *drawable, GtkWidget *greyramp)
 {
   GreyrampProperties *properties = greyrampGetProperties(greyramp);
   DotterContext *dc = properties->dwc->dotterCtx;
-  
+
   GdkRectangle markerRect;
   getThresholdMarkerRect(properties, &markerRect);
-  
+
   /* Draw the threshold marker outline (there's no fill because we want the background greyramp to show through) */
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   GdkColor *lineColor = getGdkColor(DOTCOLOR_THRESHOLD_MARKER, dc->defaultColors, properties->draggingThreshold, properties->dwc->usePrintColors);
   gdk_gc_set_foreground(gc, lineColor);
   gdk_draw_rectangle(drawable, gc, FALSE, markerRect.x, markerRect.y, markerRect.width, markerRect.height);
-  
+
   g_object_unref(gc);
 }
 
@@ -566,7 +567,7 @@ static gboolean onExposeGradient(GtkWidget *gradient, GdkEventExpose *event, gpo
       drawBlackMarker(drawable, greyramp);
       drawThresholdMarker(drawable, greyramp);
     }
-  
+
   return TRUE;
 }
 
@@ -582,7 +583,7 @@ static gboolean onExposeGradientMinimised(GtkWidget *gradient, GdkEventExpose *e
       drawGradient(drawable, greyramp);
       drawThresholdMarker(drawable, greyramp);
     }
-  
+
   return TRUE;
 }
 
@@ -591,12 +592,12 @@ static gboolean onExposeGradientMinimised(GtkWidget *gradient, GdkEventExpose *e
 static gboolean onButtonPressGradient(GtkWidget *gradient, GdkEventButton *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->button == 1)
     {
       GtkWidget *greyramp = GTK_WIDGET(data);
       GreyrampProperties *properties = greyrampGetProperties(greyramp);
-      
+
       /* See if we clicked inside one of the markers */
       if (pointInWhiteMarker(properties, event->x, event->y))
         {
@@ -617,15 +618,15 @@ static gboolean onButtonPressGradient(GtkWidget *gradient, GdkEventButton *event
       if (properties->draggingWhite || properties->draggingBlack || properties->draggingThreshold)
         {
           /* Remember the current values so we can undo if this is the start of a drag */
-          properties->lastBlackPoint =  properties->blackPoint; 
+          properties->lastBlackPoint =  properties->blackPoint;
           properties->lastWhitePoint =  properties->whitePoint;
 
           gtk_widget_queue_draw(greyramp);
         }
-      
+
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
@@ -634,14 +635,14 @@ static gboolean onButtonReleaseGradient(GtkWidget *gradient, GdkEventButton *eve
 {
   GtkWidget *greyramp = GTK_WIDGET(data);
   GreyrampProperties *properties = greyrampGetProperties(greyramp);
-  
+
   properties->draggingWhite = FALSE;
   properties->draggingBlack = FALSE;
   properties->draggingThreshold = FALSE;
   properties->dragXPos = 0;
-  
+
   gtk_widget_queue_draw(greyramp);
-  
+
   return TRUE;
 }
 
@@ -650,12 +651,12 @@ static gboolean onButtonReleaseGradient(GtkWidget *gradient, GdkEventButton *eve
 static gboolean onMouseMoveGradient(GtkWidget *gradient, GdkEventMotion *event, gpointer data)
 {
   gboolean handled = FALSE;
-  
+
   if (event->state & GDK_BUTTON1_MASK) /* left button pressed */
     {
       GtkWidget *greyramp = GTK_WIDGET(data);
       GreyrampProperties *properties = greyrampGetProperties(greyramp);
-      
+
       if (properties->draggingWhite)
         {
           /* Move the white point by the amount offset since the last move/button-press */
@@ -678,22 +679,22 @@ static gboolean onMouseMoveGradient(GtkWidget *gradient, GdkEventMotion *event,
           greyrampSetWhitePoint(greyramp, properties, properties->whitePoint + offset);
           greyrampSetBlackPoint(greyramp, properties, properties->blackPoint + offset);
         }
-      
+
       handled = TRUE;
     }
-  
+
   return handled;
 }
 
 
 /* Called when the black-point spin button's value has changed */
 static void onBlackSpinButtonChanged(GtkSpinButton *blackSpinButton, gpointer data)
-{ 
+{
   GtkWidget *greyramp = GTK_WIDGET(data);
   GreyrampProperties *properties = greyrampGetProperties(greyramp);
 
   properties->blackPoint = gtk_spin_button_get_value_as_int(blackSpinButton);
-  
+
   gtk_widget_queue_draw(greyramp);
   updateGreyMap(greyramp);
 }
@@ -701,12 +702,12 @@ static void onBlackSpinButtonChanged(GtkSpinButton *blackSpinButton, gpointer da
 
 /* Called when the white-point spin button's value has changed */
 static void onWhiteSpinButtonChanged(GtkSpinButton *whiteSpinButton, gpointer data)
-{ 
+{
   GtkWidget *greyramp = GTK_WIDGET(data);
   GreyrampProperties *properties = greyrampGetProperties(greyramp);
 
   properties->whitePoint = gtk_spin_button_get_value_as_int(whiteSpinButton);
-  
+
   gtk_widget_queue_draw(greyramp);
   updateGreyMap(greyramp);
 }
@@ -718,20 +719,20 @@ static gint onPressUndoButton(GtkWidget *button, gpointer data)
   GtkWidget *greyramp = GTK_WIDGET(data);
   GreyrampProperties *properties = greyrampGetProperties(greyramp);
 
-  int temp = properties->blackPoint; 
-  properties->blackPoint = properties->lastBlackPoint; 
+  int temp = properties->blackPoint;
+  properties->blackPoint = properties->lastBlackPoint;
   properties->lastBlackPoint = temp;
-  
-  temp = properties->whitePoint; 
-  properties->whitePoint = properties->lastWhitePoint; 
+
+  temp = properties->whitePoint;
+  properties->whitePoint = properties->lastWhitePoint;
   properties->lastWhitePoint = temp;
-  
+
   if (properties->blackSpinButton)
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(properties->blackSpinButton), (float)properties->blackPoint) ;
 
   if (properties->whiteSpinButton)
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(properties->whiteSpinButton), (float)properties->whitePoint); 
-  
+    gtk_spin_button_set_value(GTK_SPIN_BUTTON(properties->whiteSpinButton), (float)properties->whitePoint);
+
   return TRUE;
 }
 
@@ -741,19 +742,19 @@ static gint onPressSwapButton(GtkWidget *button, gpointer data)
 {
   GtkWidget *greyramp = GTK_WIDGET(data);
   GreyrampProperties *properties = greyrampGetProperties(greyramp);
-  
-  int temp = properties->blackPoint; 
-  properties->blackPoint = properties->whitePoint; 
+
+  int temp = properties->blackPoint;
+  properties->blackPoint = properties->whitePoint;
   properties->whitePoint = temp;
-  
+
   properties->swapValues = !properties->swapValues;
-  
+
   if (properties->blackSpinButton)
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(properties->blackSpinButton), (float)properties->blackPoint) ;
 
   if (properties->whiteSpinButton)
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(properties->whiteSpinButton), (float)properties->whitePoint);
-  
+
   return TRUE;
 }
 
@@ -774,19 +775,19 @@ static void onMaximiseGreyrampClicked(GtkWidget *button, gpointer data)
 /* Utility to create a spin button with the range 0 to 255 and various other default values. */
 static GtkWidget* createSpinButton(const gdouble initValue, GCallback callbackFunc, GtkWidget *greyramp)
 {
-  GtkObject *adjustment = gtk_adjustment_new(initValue, 
+  GtkObject *adjustment = gtk_adjustment_new(initValue,
                                              0.0,       /* lower */
                                              255.0,     /* upper */
                                              1.0,       /* step increment */
                                              1.0,       /* page increment */
                                              0.0);      /* page size */
-  
-  GtkWidget *spinButton = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), 
+
+  GtkWidget *spinButton = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment),
                                               0.5, /* climb rate, i.e. amount to increase per button click */
                                               0);  /* num decimal places to display */
-  
+
   g_signal_connect(spinButton,"value_changed", callbackFunc, greyramp);
-  
+
   return spinButton;
 }
 
@@ -794,8 +795,8 @@ static GtkWidget* createSpinButton(const gdouble initValue, GCallback callbackFu
 /* Create the toolbar for the greyramp window. */
 static GtkWidget* createGreyrampToolbar(GtkTable *table,
                                         const int col,
-                                        GtkWidget *greyramp, 
-                                        GtkWidget *whiteSpinButton, 
+                                        GtkWidget *greyramp,
+                                        GtkWidget *whiteSpinButton,
                                         GtkWidget *blackSpinButton,
                                         const int blackPoint,
                                         const int whitePoint)
@@ -808,7 +809,7 @@ static GtkWidget* createGreyrampToolbar(GtkTable *table,
   gtk_widget_set_tooltip_text(swapButton, "Swap the black and white point to invert the colours");
   gtk_widget_set_tooltip_text(undoButton, "Undo/redo the last change to the sliders");
 
-  g_signal_connect(G_OBJECT(quitButton), "pressed", G_CALLBACK(onCloseGreyramp), greyramp); 
+  g_signal_connect(G_OBJECT(quitButton), "pressed", G_CALLBACK(onCloseGreyramp), greyramp);
   g_signal_connect(G_OBJECT(undoButton), "pressed", G_CALLBACK(onPressUndoButton), greyramp);
   g_signal_connect(G_OBJECT(swapButton), "pressed", G_CALLBACK(onPressSwapButton), greyramp);
 
@@ -834,7 +835,7 @@ static GtkWidget* createGreyrampToolbar(GtkTable *table,
    * then its text will be selected and we will inadvertently overwrite the
    * contents of the primary clipboard. */
   gtk_container_set_focus_child(GTK_CONTAINER(vbox), quitButton);
-  
+
   return vbox;
 }
 
@@ -846,7 +847,7 @@ static GtkWidget* createGradientRect(GtkWidget *greyramp, GdkRectangle *rect)
   GtkWidget *frame = gtk_frame_new(NULL);
   gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
   gtk_container_set_border_width(GTK_CONTAINER(frame), GRADIENT_RECT_FRAME_PADDING);
-  
+
   /* Get the total size of the gradient area, including markers and padding */
   const int totalWidth = GRADIENT_RECT_WIDTH + (2 * GRADIENT_RECT_X_PADDING) ;
   const int totalHeight = GRADIENT_RECT_HEIGHT + (2 * (GRADIENT_RECT_MARKER_HEIGHT + GRADIENT_RECT_Y_PADDING));
@@ -860,18 +861,18 @@ static GtkWidget* createGradientRect(GtkWidget *greyramp, GdkRectangle *rect)
   gtk_widget_add_events(layout, GDK_BUTTON_PRESS_MASK);
   gtk_widget_add_events(layout, GDK_BUTTON_RELEASE_MASK);
   gtk_widget_add_events(layout, GDK_POINTER_MOTION_MASK);
-  
+
   g_signal_connect(G_OBJECT(layout), "expose-event", G_CALLBACK(onExposeGradient), greyramp);
   g_signal_connect(G_OBJECT(layout), "button-press-event", G_CALLBACK(onButtonPressGradient), greyramp);
   g_signal_connect(G_OBJECT(layout), "button-release-event", G_CALLBACK(onButtonReleaseGradient), greyramp);
   g_signal_connect(G_OBJECT(layout), "motion-notify-event", G_CALLBACK(onMouseMoveGradient), greyramp);
-  
+
   /* Set the size of the gradient rectangle to be drawn */
   rect->x = GRADIENT_RECT_X_PADDING;
   rect->y = GRADIENT_RECT_MARKER_HEIGHT + GRADIENT_RECT_Y_PADDING;
   rect->width = GRADIENT_RECT_WIDTH;
   rect->height = GRADIENT_RECT_HEIGHT;
-  
+
   return frame;
 }
 
@@ -891,18 +892,18 @@ static GtkWidget* createGradientRectMinimised(GdkRectangle *rect, GtkWidget *gre
   gtk_widget_add_events(greyramp, GDK_BUTTON_PRESS_MASK);
   gtk_widget_add_events(greyramp, GDK_BUTTON_RELEASE_MASK);
   gtk_widget_add_events(greyramp, GDK_POINTER_MOTION_MASK);
-  
+
   g_signal_connect(G_OBJECT(greyramp), "expose-event", G_CALLBACK(onExposeGradientMinimised), greyrampTool);
   g_signal_connect(G_OBJECT(greyramp), "button-press-event", G_CALLBACK(onButtonPressGradient), greyrampTool);
   g_signal_connect(G_OBJECT(greyramp), "button-release-event", G_CALLBACK(onButtonReleaseGradient), greyrampTool);
   g_signal_connect(G_OBJECT(greyramp), "motion-notify-event", G_CALLBACK(onMouseMoveGradient), greyrampTool);
-  
+
   /* Set the size of the gradient rectangle to be drawn */
   rect->x = GRADIENT_RECT_X_PADDING_MIN;
   rect->y = GRADIENT_RECT_Y_PADDING_MIN;
   rect->width = GRADIENT_RECT_WIDTH;
   rect->height = GRADIENT_RECT_HEIGHT_MIN;
-  
+
   return greyramp;
 }
 
@@ -930,7 +931,7 @@ GtkWidget* createGreyrampToolMinimised(DotterWindowContext *dwc,
                                        const int blackPoint)
 {
   DEBUG_ENTER("createGreyrampToolMinimised");
-  
+
   GtkWidget *greyrampTool = gtk_hbox_new(FALSE, 0) ;
 
   /* Create a layout for drawing the greyramp gradient onto. This will be in the first column,
@@ -945,23 +946,23 @@ GtkWidget* createGreyrampToolMinimised(DotterWindowContext *dwc,
   g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(onMaximiseGreyrampClicked), greyrampTool);
   gtk_widget_set_tooltip_text(button, "Maximise the greyramp tool for more options (Ctrl-G)");
 
-  greyrampCreateProperties(greyrampTool, 
+  greyrampCreateProperties(greyrampTool,
                            NULL,
 			   dwc,
                            &gradientRect,
-                           NULL, 
-                           NULL, 
-                           blackPoint, 
-                           whitePoint, 
+                           NULL,
+                           NULL,
+                           blackPoint,
+                           whitePoint,
                            0,
-                           255, 
+                           255,
                            FALSE,
                            blackPoint - whitePoint);
-  
+
   gtk_widget_show_all(greyrampTool);
-  
+
   updateGreyMap(greyrampTool);
-                   
+
   DEBUG_EXIT("createGreyrampToolMinimised returning ");
   return greyrampTool;
 }
@@ -987,7 +988,7 @@ GtkWidget* createGreyrampTool(DotterWindowContext *dwc,
   const int padding = 0;
   GtkTable *table = GTK_TABLE(gtk_table_new(numRows, numCols, FALSE));
   gtk_container_add(GTK_CONTAINER(greyrampTool), GTK_WIDGET(table));
-  
+
   /* Create a layout for drawing the greyramp gradient onto. This will be in the first column,
    * spanning all rows */
   GdkRectangle gradientRect;
@@ -997,39 +998,37 @@ GtkWidget* createGreyrampTool(DotterWindowContext *dwc,
   /* Create the toolbar and pack it into the parent */
   const int whitePoint = swapValues ? blackPointIn : whitePointIn;
   const int blackPoint = swapValues ? whitePointIn : blackPointIn;
-  
+
   GtkWidget *whiteSpinButton = createSpinButton(whitePoint + 1, G_CALLBACK(onWhiteSpinButtonChanged), greyrampTool);
   GtkWidget *blackSpinButton = createSpinButton(blackPoint + 1, G_CALLBACK(onBlackSpinButtonChanged), greyrampTool);
 
   createGreyrampToolbar(table, 1, greyrampTool, whiteSpinButton, blackSpinButton, blackPoint, whitePoint);
 
   GtkWidget *greyrampWindow = createGreyrampToolWindow(dwc, greyrampTool);
-  
-  greyrampCreateProperties(greyrampTool, 
+
+  greyrampCreateProperties(greyrampTool,
                            greyrampWindow,
 			   dwc,
                            &gradientRect,
-                           whiteSpinButton, 
-                           blackSpinButton, 
-                           blackPoint, 
-                           whitePoint, 
+                           whiteSpinButton,
+                           blackSpinButton,
+                           blackPoint,
+                           whitePoint,
                            0,
-                           255, 
+                           255,
                            swapValues,
                            0);
 
   gtk_spin_button_set_value(GTK_SPIN_BUTTON(whiteSpinButton), (float)whitePoint);
   gtk_spin_button_set_value(GTK_SPIN_BUTTON(blackSpinButton), (float)blackPoint);
-  
+
   gtk_widget_show_all(greyrampTool);
-  
+
   updateGreyMap(greyrampTool);
 
   if (greyrampWindow_out)
     *greyrampWindow_out = greyrampWindow;
-                   
+
   DEBUG_EXIT("createGreyrampTool returning ");
   return greyrampTool;
 }
-  
-
diff --git a/src/dotterApp/seqtoolsExonView.cpp b/src/dotterApp/seqtoolsExonView.cpp
index b11541c51a4c08d03daa23ee5f266e3c5b1fd94f..deee75cbb80ed845b4871eafcafc87a82b8d967b 100644
--- a/src/dotterApp/seqtoolsExonView.cpp
+++ b/src/dotterApp/seqtoolsExonView.cpp
@@ -1,5 +1,6 @@
 /*  File: seqtoolsExonView.c
  *  Author: Gemma Barson, 2009-12-24
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -48,17 +49,17 @@ typedef struct _ExonViewProperties
     GtkCallback refreshFunc;	      /* Callback function to call on the parent when we require a refresh */
     DotterContext *dc;		      /* Dotter session context */
     DotterWindowContext *dwc;	      /* Dotter window context */
-  
+
     BlxStrand strand;                 /* Which strand of the sequence this view displays exons for */
     gboolean horizontal;              /* Whether these exons are for the horizontal or vertical sequence  */
     const IntRange* qRange;           /* the range of ref seq coords the exon view displays, in nucleotide coords */
-    
+
     gboolean bumped;		      /* Whether the exon view is expanded (bumped) or compressed */
     int yPad;			      /* y padding */
-    
+
     GdkRectangle exonViewRect;	      /* The drawing area for the exon view */
-    int exonHeight;                   /* the height of an individual exon */ 
-    
+    int exonHeight;                   /* the height of an individual exon */
+
     gboolean showCrosshair;           /* Flag that indicates whether we should draw the crosshair */
   } ExonViewProperties;
 
@@ -74,7 +75,7 @@ typedef struct _DrawData
 
     GdkRectangle *exonViewRect;
     const IntRange* const qRange;
-    
+
     int yPad;			      /* y padding */
     int y;			      /* y position to draw this exon at (constant if view compressed; increases if view bumped) */
     int height;			      /* height of exon box */
@@ -97,11 +98,11 @@ static void                     drawExonView(GtkWidget *exonView, GdkDrawable *d
  ***********************************************************/
 
 /* Draw an exon */
-static void drawExon(const MSP* const msp, 
-                     DrawData *data, 
-                     const BlxSequence *blxSeq, 
-                     const gboolean isSelected, 
-                     const gint x, 
+static void drawExon(const MSP* const msp,
+                     DrawData *data,
+                     const BlxSequence *blxSeq,
+                     const gboolean isSelected,
+                     const gint x,
                      const gint y,
                      const gint widthIn,
                      const gint heightIn)
@@ -110,10 +111,10 @@ static void drawExon(const MSP* const msp,
   gint xStart = x;
   gint xEnd = x + widthIn;
   gint width = widthIn;
-  
+
   const gint xMin = (data->horizontal ? data->exonViewRect->x : data->exonViewRect->y);
   const gint xMax = xMin + (data->horizontal ? data->exonViewRect->width : data->exonViewRect->height);
-  
+
   if (xStart <= xMax && xEnd >= xMin)
     {
       if (xStart < xMin)
@@ -139,19 +140,19 @@ static void drawExon(const MSP* const msp,
           height = width;
           width = heightIn;
         }
-      
+
       /* Draw the fill rectangle */
       const GdkColor *fillColor = mspGetColor(msp, data->dc->defaultColors, DOTCOLOR_BACKGROUND, blxSeq, isSelected, data->dwc->usePrintColors, TRUE, DOTCOLOR_EXON_FILL, DOTCOLOR_EXON_LINE, DOTCOLOR_CDS_FILL, DOTCOLOR_CDS_LINE, DOTCOLOR_UTR_FILL, DOTCOLOR_UTR_LINE);
       gdk_gc_set_foreground(data->gc, fillColor);
       gdk_draw_rectangle(data->drawable, data->gc, TRUE, xStart, yStart, width, height);
-      
+
       /* Draw outline (exon box outline always the same (unselected) color; only intron lines change when selected) */
       const GdkColor *lineColor = mspGetColor(msp, data->dc->defaultColors, DOTCOLOR_BACKGROUND, blxSeq, isSelected, data->dwc->usePrintColors, FALSE, DOTCOLOR_EXON_FILL, DOTCOLOR_EXON_LINE, DOTCOLOR_CDS_FILL, DOTCOLOR_CDS_LINE, DOTCOLOR_UTR_FILL, DOTCOLOR_UTR_LINE);
       gdk_gc_set_foreground(data->gc, lineColor);
       gdk_draw_rectangle(data->drawable, data->gc, FALSE, xStart, yStart, width, height);
     }
 }
-  
+
 
 static void swapValues(int *val1, int*val2)
 {
@@ -169,24 +170,24 @@ static void drawIntronLine(DrawData *data, const gint x1, const gint y1, const g
    * y values that are in range so don't bother checking them. */
   const gint xMin = data->horizontal ? clipRect->x : clipRect->y;
   const gint xMax = xMin + (data->horizontal ? clipRect->width : clipRect->height);
-  
+
   if (x1 <= xMax && x2 >= xMin)
     {
       int xStart = x1;
       int xEnd = x2;
       int yStart = y1;
       int yEnd = y2;
-      
+
       /* Clip the start/end x values if out of range */
       if (xStart < xMin)
         {
           const int origWidth = abs(xEnd - xStart);
-        
+
           xStart = xMin;
 
           const int newWidth = abs(xEnd - xStart);
           const int newHeight = roundNearest((double)(yEnd - yStart) * (double)newWidth / (double)origWidth); /* negative if yend < ystart */
-          
+
           yStart = yEnd - newHeight;
         }
 
@@ -198,30 +199,30 @@ static void drawIntronLine(DrawData *data, const gint x1, const gint y1, const g
 
           const int newWidth = abs(xEnd - xStart);
           const int newHeight = roundNearest((double)(yEnd - yStart) * (double)newWidth / (double)origWidth);
-          
+
           yEnd = yStart + newHeight;
         }
-      
+
       /* Swap x and y if we're drawing the view vertically rather than horizontally */
       if (!data->horizontal)
         {
           swapValues(&xStart, &yStart);
           swapValues(&xEnd, &yEnd);
         }
-      
+
       gdk_draw_line(data->drawable, data->gc, xStart, yStart, xEnd, yEnd);
     }
 }
 
 
 /* Draw an intron */
-static void drawIntron(const MSP* const msp, 
-                       DrawData *data, 
-                       const BlxSequence *blxSeq, 
-                       const gboolean isSelected, 
-                       const gint xIn, 
-                       const gint yIn, 
-                       const gint widthIn, 
+static void drawIntron(const MSP* const msp,
+                       DrawData *data,
+                       const BlxSequence *blxSeq,
+                       const gboolean isSelected,
+                       const gint xIn,
+                       const gint yIn,
+                       const gint widthIn,
                        const gint heightIn)
 {
   const GdkColor *lineColor = mspGetColor(msp, data->dc->defaultColors, DOTCOLOR_BACKGROUND, blxSeq, isSelected, data->dwc->usePrintColors, FALSE, DOTCOLOR_EXON_FILL, DOTCOLOR_EXON_LINE, DOTCOLOR_CDS_FILL, DOTCOLOR_CDS_LINE, DOTCOLOR_UTR_FILL, DOTCOLOR_UTR_LINE);
@@ -235,7 +236,7 @@ static void drawIntron(const MSP* const msp,
   const int yOffset = roundNearest((double)heightIn / 2.0);
   int yTop = data->horizontal ? yIn : yIn + heightIn;
   int yBottom = yIn + yOffset;
-  
+
   /* Draw the first section, from the given x to the mid point, sloping up */
   int xStart = xIn;
   int xEnd = xStart + roundNearest((double)widthIn / 2.0);
@@ -252,7 +253,7 @@ static void drawIntron(const MSP* const msp,
 static gboolean drawExonIntron(const MSP *msp, DrawData *data, const gboolean isSelected, const BlxSequence *blxSeq)
 {
   gboolean drawn = FALSE;
-  
+
   if (rangesOverlap(&msp->qRange, data->qRange))
     {
       drawn = TRUE;
@@ -264,12 +265,12 @@ static gboolean drawExonIntron(const MSP *msp, DrawData *data, const gboolean is
       /* Get the length-ways position (technically this will actually be y for the vertical sequence) */
       const gint x1 = convertBaseIdxToRectPos(qStart, data->exonViewRect, data->qRange, data->horizontal, data->dc->hozScaleRev, FALSE);
       const gint x2 = convertBaseIdxToRectPos(qEnd, data->exonViewRect, data->qRange, data->horizontal, data->dc->hozScaleRev, FALSE);
-      
+
       gint x = min(x1, x2);
       gint width = abs(x1 - x2);
       gint y = data->y + data->yPad;
       gint height = data->height;
-      
+
       if (mspIsBoxFeature(msp))
 	{
 	  drawExon(msp, data, blxSeq, isSelected, x, y, width, height);
@@ -279,7 +280,7 @@ static gboolean drawExonIntron(const MSP *msp, DrawData *data, const gboolean is
 	  drawIntron(msp, data, blxSeq, isSelected, x, y, width, height);
 	}
     }
-    
+
   return drawn;
 }
 
@@ -289,10 +290,10 @@ static gboolean showMspInExonView(const MSP *msp, DrawData *drawData)
 {
   /* Check it's an exon or intron */
   gboolean showMsp = mspIsBoxFeature(msp) || mspIsIntron(msp);
-  
+
   /* Check it's in a visible layer */
   showMsp &= mspLayerIsVisible(msp);
-  
+
   /* Check it's the correct strand */
   showMsp &= (mspGetRefStrand(msp) == drawData->strand);
 
@@ -301,7 +302,7 @@ static gboolean showMspInExonView(const MSP *msp, DrawData *drawData)
     showMsp &= stringsEqual(msp->qname, drawData->dc->refSeqName, FALSE);
   else
     showMsp &= stringsEqual(msp->qname, drawData->dc->matchSeqName, FALSE);
-  
+
   return showMsp;
 }
 
@@ -314,23 +315,23 @@ static void drawExonIntronItem(gpointer listItemData, gpointer data)
 
   const gboolean isSelected = FALSE; /* selections not implemented in dotter yet */
   gboolean seqDrawn = FALSE;
-  
+
   if (!drawData->normalOnly || !isSelected)
     {
       /* Loop through all msps in this sequence */
       GList *mspListItem = seq->mspList;
-  
+
       for ( ; mspListItem; mspListItem = mspListItem->next)
 	{
 	  MSP *msp = (MSP*)(mspListItem->data);
-      
+
 	  if (showMspInExonView(msp, drawData))
 	    {
 	      seqDrawn |= drawExonIntron(msp, drawData, isSelected, seq);
 	    }
 	}
     }
-  
+
   /* If the view is bumped, increase the y-coord for the next sequence */
   if (seqDrawn && drawData->bumped)
     {
@@ -342,21 +343,21 @@ static void drawExonIntronItem(gpointer listItemData, gpointer data)
 static void drawCrosshair(GtkWidget *exonView, GdkDrawable *drawable, GdkGC *gc)
 {
   ExonViewProperties *properties = exonViewGetProperties(exonView);
-  
+
   if (properties->showCrosshair)
     {
       DotterContext *dc = properties->dc;
       DotterWindowContext *dwc = properties->dwc;
-      
+
       const gdouble scaleFactor = dwc->zoomFactor * getResFactor(dc, properties->horizontal);
       const int coord = getSelectedCoord(dwc, properties->horizontal);
-      
+
       /* Work out the distance from the left/top edge of the rect */
       const int distFromEdge = abs(coord - getStartCoord(dwc, properties->horizontal)) / scaleFactor;
 
       GdkColor *color = getGdkColor(DOTCOLOR_CROSSHAIR, dc->defaultColors, FALSE, dwc->usePrintColors);
       gdk_gc_set_foreground(gc, color);
-      
+
       if (properties->horizontal)
         {
           /* Draw a vertical line at x */
@@ -378,13 +379,13 @@ static void drawCrosshair(GtkWidget *exonView, GdkDrawable *drawable, GdkGC *gc)
 void exonViewPrepareForPrinting(GtkWidget *exonView)
 {
   GdkDrawable *drawable = widgetGetDrawable(exonView);
-  
+
   if (!drawable)
     {
       drawable = createBlankPixmap(exonView);
       drawExonView(exonView, drawable);
     }
-  
+
   if (drawable)
     {
       GdkGC *gc = gdk_gc_new(drawable);
@@ -398,7 +399,7 @@ void exonViewPrepareForPrinting(GtkWidget *exonView)
 static void drawExonView(GtkWidget *exonView, GdkDrawable *drawable)
 {
   DEBUG_ENTER("drawExonView");
-  
+
   ExonViewProperties *properties = exonViewGetProperties(exonView);
   DotterContext *dc = properties->dc;
 
@@ -408,20 +409,20 @@ static void drawExonView(GtkWidget *exonView, GdkDrawable *drawable)
    * edges" to make sure intron lines have the correct slope etc.) */
   gdk_gc_set_clip_origin(gc, 0, 0);
   gdk_gc_set_clip_rectangle(gc, &properties->exonViewRect);
-  
+
   /* Draw the exons and introns. Since we could have a lot of them in the loop, extract all the
    * info we need now and pass it around so we don't have to look for this stuff each time. */
-  
+
   DrawData drawData = {
     properties->parent,
     drawable,
     gc,
     properties->dc,
     properties->dwc,
-    
+
     &properties->exonViewRect,
     properties->qRange,
-    
+
     properties->yPad,
     properties->horizontal ? properties->exonViewRect.y : properties->exonViewRect.x,
     properties->exonHeight,
@@ -431,7 +432,7 @@ static void drawExonView(GtkWidget *exonView, GdkDrawable *drawable)
     properties->bumped,
     FALSE
   };
-  
+
   /* Loop through all sequences, drawing all msps that are exons/introns */
   GList *seqList = dc->seqList;
   g_list_foreach(seqList, drawExonIntronItem, &drawData);
@@ -449,21 +450,21 @@ void calculateDotterExonViewHeight(GtkWidget *exonView)
   /* Calculate the height based on how many exon lines will actually be drawn */
   int numExons = 0;
   int maxExons = properties->bumped ? UNSET_INT : 1; /* unset means no limit */
-  
+
   /* Loop through all sequences */
   GList *seqItem = dc->seqList;
-  
+
   for ( ; seqItem; seqItem = seqItem->next)
     {
       /* Loop through all msps */
       const BlxSequence *seq = (BlxSequence*)(seqItem->data);
       GList *mspItem = seq->mspList;
-      
+
       for ( ; mspItem; mspItem = mspItem->next)
 	{
 	  const MSP *msp = (const MSP*)(mspItem->data);
-	  
-	  if ((mspIsBoxFeature(msp) || mspIsIntron(msp)) && 
+
+	  if ((mspIsBoxFeature(msp) || mspIsIntron(msp)) &&
               mspGetRefStrand(msp) == properties->strand &&
 	      rangesOverlap(&msp->qRange, properties->qRange))
             {
@@ -471,14 +472,14 @@ void calculateDotterExonViewHeight(GtkWidget *exonView)
               break; /* break inner loop and move to next sequence */
             }
 	}
-      
+
       /* Break after we've found the maximum number of lines, if a max is specified */
       if (maxExons != UNSET_INT && numExons >= maxExons)
 	{
 	  break;
 	}
     }
-  
+
   if (properties->horizontal)
     {
       properties->exonViewRect.height = (numExons * (properties->exonHeight + 2 * properties->yPad)) + (2 * properties->yPad);
@@ -499,7 +500,7 @@ void calculateDotterExonViewBorders(GtkWidget *exonView, const int width, const
   DEBUG_ENTER("calculateDotterExonViewBorders(width=%d, height=%d)", width, height);
 
   ExonViewProperties *properties = exonViewGetProperties(exonView);
-  
+
   /* Calculate the area where the exon view will be drawn */
   if (properties->horizontal)
     {
@@ -515,10 +516,10 @@ void calculateDotterExonViewBorders(GtkWidget *exonView, const int width, const
       properties->exonViewRect.width = properties->exonHeight + (2 * properties->yPad);
       properties->exonViewRect.height = height;
     }
-  
+
   gtk_layout_set_size(GTK_LAYOUT(exonView), properties->exonViewRect.x + properties->exonViewRect.width, properties->exonViewRect.y + properties->exonViewRect.height);
   gtk_widget_set_size_request(exonView, properties->exonViewRect.x + properties->exonViewRect.width, properties->exonViewRect.y + properties->exonViewRect.height);
-  
+
   /* If the display is bumped, we need to do more work to determine the height
    * because it depends on the number of exons that are visible */
   if (properties->bumped)
@@ -526,7 +527,7 @@ void calculateDotterExonViewBorders(GtkWidget *exonView, const int width, const
 
   widgetClearCachedDrawable(exonView, NULL);
   gtk_widget_queue_draw(exonView);
-  
+
   DEBUG_OUT("seq horizontal=%d, x=%d, y=%d, w=%d, h=%d\n", properties->horizontal, properties->exonViewRect.x, properties->exonViewRect.y, properties->exonViewRect.width, properties->exonViewRect.height);
   DEBUG_EXIT("calculateDotterExonViewBorders returning ");
 }
@@ -551,8 +552,8 @@ static void onDestroyExonView(GtkWidget *exonView)
     }
 }
 
-static void exonViewCreateProperties(GtkWidget *exonView, 
-				     GtkWidget *parent, 
+static void exonViewCreateProperties(GtkWidget *exonView,
+				     GtkWidget *parent,
 				     GtkCallback refreshFunc,
                                      const gboolean horizontal,
 				     const BlxStrand strand,
@@ -565,7 +566,7 @@ static void exonViewCreateProperties(GtkWidget *exonView,
   if (exonView)
     {
       ExonViewProperties *properties = new ExonViewProperties;
-      
+
       properties->parent	      = parent;
       properties->refreshFunc	      = refreshFunc;
       properties->dc		      = dc;
@@ -574,10 +575,10 @@ static void exonViewCreateProperties(GtkWidget *exonView,
       properties->strand	      = strand;
       properties->horizontal          = horizontal;
       properties->qRange	      = qRange;
-      
+
       properties->bumped	      = FALSE;
       properties->yPad		      =	DEFAULT_EXON_YPAD;
-      
+
       properties->exonViewRect.x      = 0;
       properties->exonViewRect.y      = DEFAULT_EXON_YPAD;
       properties->exonViewRect.width  = width;
@@ -585,7 +586,7 @@ static void exonViewCreateProperties(GtkWidget *exonView,
 
       properties->exonHeight          = DEFAULT_EXON_HEIGHT;
       properties->showCrosshair       = showCrosshair;
-      
+
       gtk_widget_set_size_request(exonView, 0, DEFAULT_EXON_HEIGHT + (2 * DEFAULT_EXON_YPAD));
 
       g_object_set_data(G_OBJECT(exonView), "ExonViewProperties", properties);
@@ -610,12 +611,12 @@ void exonViewSetBumped(GtkWidget *exonView, const gboolean bumped)
       properties->yPad = DEFAULT_EXON_YPAD_BUMPED;
       properties->exonHeight = DEFAULT_EXON_HEIGHT_BUMPED;
     }
-  else 
+  else
     {
       properties->yPad = DEFAULT_EXON_YPAD;
       properties->exonHeight = DEFAULT_EXON_HEIGHT;
     }
-  
+
   calculateDotterExonViewHeight(exonView);
 
   /* Refresh the parent */
@@ -649,26 +650,26 @@ void exonViewSetShowCrosshair(GtkWidget *exonView, const gboolean showCrosshair)
 static gboolean onExposeExonView(GtkWidget *exonView, GdkEventExpose *event, gpointer data)
 {
   GdkDrawable *drawable = widgetGetDrawable(exonView);
-  
+
   if (!drawable)
     {
       /* Create a pixmap and draw the exon view onto it */
       drawable = createBlankPixmap(exonView);
       drawExonView(exonView, drawable);
     }
-  
+
   if (drawable)
-    {  
+    {
       /* Push the pixmap onto the screen */
       GdkDrawable *window = GTK_LAYOUT(exonView)->bin_window;
-      
+
       GdkGC *gc = gdk_gc_new(window);
 
       gdk_draw_drawable(window, gc, drawable, 0, 0, 0, 0, -1, -1);
 
       /* Draw the crosshair over the top */
       drawCrosshair(exonView, window, gc);
-      
+
       g_object_unref(gc);
     }
 
@@ -707,10 +708,10 @@ static gboolean onMouseMoveExonView(GtkWidget *exonView, GdkEventMotion *event,
 
 /* Create the part of the view that will show the exons. Returns the outermost container of the
  * exon and sets the exonViewOut output arg to the actual layout widget for the exon view. */
-GtkWidget *createDotterExonView(GtkWidget *parent, 
+GtkWidget *createDotterExonView(GtkWidget *parent,
 				GtkCallback refreshFunc,
                                 const gboolean horizontal,
-				const BlxStrand strand, 
+				const BlxStrand strand,
 				DotterWindowContext *dwc,
 				const int width,
                                 const int height,
@@ -721,18 +722,18 @@ GtkWidget *createDotterExonView(GtkWidget *parent,
   DEBUG_ENTER("createDotterExonView(width=%d, height=%d, qRange=%d %d)", width, height, qRange->min(), qRange->max());
 
   DotterContext *dc = dwc->dotterCtx;
-  
+
   GtkWidget *exonView = gtk_layout_new(NULL, NULL);
   gtk_widget_set_name(exonView, SEQTOOLS_EXON_VIEW_NAME);
 
   if (exonViewOut)
     *exonViewOut = exonView;
-  
+
   /* Connect signals */
   gtk_widget_add_events(exonView, GDK_BUTTON_PRESS_MASK);
   gtk_widget_add_events(exonView, GDK_BUTTON_RELEASE_MASK);
   gtk_widget_add_events(exonView, GDK_POINTER_MOTION_MASK);
-  
+
   g_signal_connect(G_OBJECT(exonView),	"expose-event",		G_CALLBACK(onExposeExonView),	      NULL);
   g_signal_connect(G_OBJECT(exonView),	"size-allocate",	G_CALLBACK(onSizeAllocateExonView),   NULL);
   g_signal_connect(G_OBJECT(exonView),	"button-press-event",   G_CALLBACK(onButtonPressExonView),    NULL);
@@ -741,7 +742,7 @@ GtkWidget *createDotterExonView(GtkWidget *parent,
 
   exonViewCreateProperties(exonView, parent, refreshFunc, horizontal, strand, dc, dwc, width, qRange, showCrosshair);
   calculateDotterExonViewBorders(exonView, width, height);
-  
+
   DEBUG_EXIT("createDotterExonView returning ");
   return exonView;
 }
diff --git a/src/dotterApp/seqtoolsExonView.hpp b/src/dotterApp/seqtoolsExonView.hpp
index 0d5b16acba3339f47eca1e7e1a4855a636f645e5..7b35049ac8cf7ba77b6936941b0174bcabe41413 100644
--- a/src/dotterApp/seqtoolsExonView.hpp
+++ b/src/dotterApp/seqtoolsExonView.hpp
@@ -1,5 +1,6 @@
 /*  File: seqtoolsExonView.h
  *  Author: Gemma Barson, 2009-12-24
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -34,7 +35,7 @@
  *              contain much of the same code so the aim was to make these
  *              files generic enough for both Blixem and Dotter to use and to
  *              put them in the seqtoolsUtils library. Unfortunately due to
- *              time constraints this didn't happen, so these files still 
+ *              time constraints this didn't happen, so these files still
  *              contain some Dotter- and Blixem- specific stuff: in Dotter
  *              we need to draw the crosshair over the exon view; in Blixem
  *              we need to draw the highlight box to indicate the current
@@ -57,10 +58,10 @@
 
 
 /* Public function declarations */
-GtkWidget *createDotterExonView(GtkWidget *parent, 
+GtkWidget *createDotterExonView(GtkWidget *parent,
 				GtkCallback refreshFunc,
                                 const gboolean horizontal,
-				const BlxStrand strand, 
+				const BlxStrand strand,
 				DotterWindowContext *dwc,
 				const int width,
                                 const int height,
diff --git a/src/seqtoolsUtils/blxGff3Parser.cpp b/src/seqtoolsUtils/blxGff3Parser.cpp
index b7348652f74248d444c573d2fd39b0984c2b7cf8..21a8f18231a26aefcb967f8d227cea81e9c36b90 100644
--- a/src/seqtoolsUtils/blxGff3Parser.cpp
+++ b/src/seqtoolsUtils/blxGff3Parser.cpp
@@ -1,5 +1,6 @@
 /*  File: blxGff3parser.c
  *  Author: Gemma Barson
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -82,7 +83,7 @@ typedef enum {
 
 
 /* Utility struct to compile GFF fields and attributes into */
-typedef struct _BlxGffData 
+typedef struct _BlxGffData
   {
     /* standard fields */
     char *qName;	/* ref seq name */
@@ -94,7 +95,7 @@ typedef struct _BlxGffData
     gdouble percentId;  /* percent ID */
     BlxStrand qStrand;	/* ref seq strand */
     int phase;		/* phase */
-    
+
     /* Attributes */
     char *sName;	/* target name */
     char *sName_orig;   /* target name with original case. */
@@ -175,13 +176,13 @@ static void freeGffData(BlxGffData *gffData)
 void blxDestroyGffTypeList(GSList **supportedTypes)
 {
   GSList *item = *supportedTypes;
-  
+
   for ( ; item; item = item->next)
     {
       BlxGffType *gffType = (BlxGffType*)(item->data);
       destroyGffType(&gffType);
     }
-  
+
   g_slist_free(*supportedTypes);
   *supportedTypes = NULL;
 }
@@ -203,7 +204,7 @@ GSList* blxCreateSupportedGffTypeList(const BlxSeqType seqType)
   /* In protein mode we need to exclude nucleotide matches, so set them to invalid */
   if (seqType == BLXSEQ_PEPTIDE)
     dnaType = BLXMSP_INVALID;
-  
+
   addGffType(&supportedTypes, "nucleotide_match", "SO:0000347", dnaType);
   addGffType(&supportedTypes, "primer_match", "SO:0001472", dnaType);
   addGffType(&supportedTypes, "cross_genome_match", "SO:0000177", dnaType);
@@ -216,11 +217,11 @@ GSList* blxCreateSupportedGffTypeList(const BlxSeqType seqType)
 
   addGffType(&supportedTypes, "protein_match", "SO:0000349", proteinType);
   addGffType(&supportedTypes, "protein_hmm_match", "SO:0001831", proteinType);
-  
+
   addGffType(&supportedTypes, "match", "SO:0000343", BLXMSP_MATCH);
   addGffType(&supportedTypes, "match_part", "SO:0000039", BLXMSP_MATCH);
   addGffType(&supportedTypes, "match_set", "SO:0000038", BLXMSP_MATCH_SET);
-  
+
   addGffType(&supportedTypes, "transcript", "SO:0000673", BLXMSP_TRANSCRIPT);
   addGffType(&supportedTypes, "primary_transcript", "SO:0000185", BLXMSP_TRANSCRIPT);
   addGffType(&supportedTypes, "processed_transcript", "SO:0000233", BLXMSP_TRANSCRIPT);
@@ -234,7 +235,7 @@ GSList* blxCreateSupportedGffTypeList(const BlxSeqType seqType)
   addGffType(&supportedTypes, "UTR", "SO:0000203", BLXMSP_UTR);
   addGffType(&supportedTypes, "exon", "SO:0000147", BLXMSP_EXON);
   addGffType(&supportedTypes, "intron", "SO:0000188", BLXMSP_INTRON);
-  
+
   addGffType(&supportedTypes, "SNP", "SO:0000694", BLXMSP_VARIATION);
   addGffType(&supportedTypes, "SNV", "SO:0001483", BLXMSP_VARIATION);
   addGffType(&supportedTypes, "copy_number_variation", "SO:0001019", BLXMSP_VARIATION);
@@ -253,7 +254,7 @@ GSList* blxCreateSupportedGffTypeList(const BlxSeqType seqType)
   addGffType(&supportedTypes, "region", "SO:0000001", BLXMSP_REGION);
 
   supportedTypes = g_slist_reverse(supportedTypes);
-  
+
   return supportedTypes;
 }
 
@@ -266,18 +267,18 @@ static BlxMspType getBlxType(GSList *supportedTypes, const char *typeStr, GError
 
   /* Loop through the supported types and see if the requested type matches the name or SO id */
   GSList *item = supportedTypes;
-  
+
   for ( ; item; item = item->next)
     {
       BlxGffType *gffType = (BlxGffType*)(item->data);
-      
+
       if (stringsEqual(typeStr, gffType->name, FALSE) || stringsEqual(typeStr, gffType->soId, FALSE))
         {
           result = gffType->blxType;
           break;
         }
     }
-  
+
   /* If it wasn't found, treat as a basic feature... */
   if (result == BLXMSP_NONE)
     {
@@ -290,10 +291,10 @@ static BlxMspType getBlxType(GSList *supportedTypes, const char *typeStr, GError
 
 /* Parse GFF3 header information */
 void parseGff3Header(const int lineNum,
-                     MSP **lastMsp, 
-		     MSP **mspList, 
-		     BlxParserState *parserState, 
-		     GString *line_string, 
+                     MSP **lastMsp,
+		     MSP **mspList,
+		     BlxParserState *parserState,
+		     GString *line_string,
 		     GList **seqList,
                      char *refSeqName,
                      IntRange *refSeqRange,
@@ -302,7 +303,7 @@ void parseGff3Header(const int lineNum,
   //DEBUG_ENTER("parseGff3Header [line=%d]", lineNum);
 
   GError *tmpError = NULL;
-  
+
   /* Look for the "sequence-region" comment line, which tells us info about the reference
    * sequence. The format is as follows: ##sequence-region    qname qstart qend */
   char qName[MAXLINE + 1];
@@ -316,7 +317,7 @@ void parseGff3Header(const int lineNum,
           g_set_error(&tmpError, BLX_GFF3_ERROR, BLX_GFF3_ERROR_INVALID_HEADER,
                       "Invalid format in sequence-region line '%s'\n", line_string->str);
         }
-      
+
       //DEBUG_OUT("Found reference sequence name=%s [start=%d, end=%d]\n", qName, qStart, qEnd);
 
       /* If the ref seq name is already populated, check it's the same as the one we've just read */
@@ -325,7 +326,7 @@ void parseGff3Header(const int lineNum,
           if (!stringsEqual(refSeqName, qName, FALSE))
             {
               g_set_error(&tmpError, BLX_GFF3_ERROR, BLX_GFF3_ERROR_INVALID_SEQ,
-                          "The sequence name '%s' in the GFF file does not match the reference sequence '%s'.\n", 
+                          "The sequence name '%s' in the GFF file does not match the reference sequence '%s'.\n",
                           qName, refSeqName);
             }
         }
@@ -333,7 +334,7 @@ void parseGff3Header(const int lineNum,
         {
           strcpy(refSeqName, qName);
         }
-      
+
       if (!tmpError && refSeqRange)
         {
           if (!refSeqRange->isSet())
@@ -344,21 +345,21 @@ void parseGff3Header(const int lineNum,
           else if (qStart > refSeqRange->max() || qEnd < refSeqRange->min())
             {
               /* GFF file range does not overlap the existing range, so we can't load this file */
-              g_set_error(&tmpError, BLX_GFF3_ERROR, BLX_GFF3_ERROR_OUT_OF_RANGE, 
+              g_set_error(&tmpError, BLX_GFF3_ERROR, BLX_GFF3_ERROR_OUT_OF_RANGE,
                           "GFF file range [%d,%d] does not overlap the reference sequence range [%d,%d]",
                           qStart, qEnd, refSeqRange->min(), refSeqRange->max());
             }
         }
     }
-  
+
   if (tmpError)
     g_propagate_error(error, tmpError);
-  
+
   //DEBUG_EXIT("parseGff3Header");
 }
 
 
-/* Get the dataType for the given source from the source-to-data-type mapping 
+/* Get the dataType for the given source from the source-to-data-type mapping
  * stanza in the config file. Returns 0 if not found. */
 static GQuark getBlxDataTypeFromSourceMapping(const char *source, GKeyFile *keyFile)
 {
@@ -367,7 +368,7 @@ static GQuark getBlxDataTypeFromSourceMapping(const char *source, GKeyFile *keyF
   if (keyFile && g_key_file_has_group(keyFile, SOURCE_DATA_TYPES_GROUP))
     {
       char *dataTypeName = g_key_file_get_string(keyFile, SOURCE_DATA_TYPES_GROUP, source, NULL);
-      
+
       if (dataTypeName)
         {
           dataType = g_quark_from_string(dataTypeName);
@@ -388,7 +389,7 @@ static GQuark getBlxDataTypeFromSource(const char *source, GKeyFile *keyFile)
   if (keyFile && source && g_key_file_has_group(keyFile, source))
     {
       char *dataTypeName = g_key_file_get_string(keyFile, source, DATA_TYPE_TAG, NULL);
-      
+
       if (dataTypeName)
         {
           dataType = g_quark_from_string(dataTypeName);
@@ -407,16 +408,16 @@ static GQuark getBlxDataTypeDefault(const char *source, GKeyFile *keyFile)
 
   /* Check in the source stanza first */
   dataType = getBlxDataTypeFromSource(source, keyFile);
-  
+
   /* If not there, check in the source-to-data-types mapping stanza */
   if (!dataType)
     dataType = getBlxDataTypeFromSourceMapping(source, keyFile);
-  
+
   return dataType;
 }
 
 
-/* Get the value for the given flag for the given group, and set 
+/* Get the value for the given flag for the given group, and set
  * it in the datatype if found */
 static void getMspFlag(GKeyFile *keyFile, const char *group, const MspFlag flag, BlxDataType *dataType)
 {
@@ -427,7 +428,7 @@ static void getMspFlag(GKeyFile *keyFile, const char *group, const MspFlag flag,
     {
       GError *tmpError = NULL;
       gboolean result = g_key_file_get_boolean(keyFile, group, key, &tmpError);
-      
+
       /* If found, update the value in the dataType */
       if (!tmpError)
         dataType->flags[flag] = result;
@@ -435,13 +436,13 @@ static void getMspFlag(GKeyFile *keyFile, const char *group, const MspFlag flag,
 }
 
 
-/* Get the BlxDataType with the given name. Returns null and sets the error if 
+/* Get the BlxDataType with the given name. Returns null and sets the error if
  * we expected to find the name but didn't. */
 BlxDataType* getBlxDataType(GQuark dataType, const char *source, GKeyFile *keyFile, GError **error)
 {
   BlxDataType *result = NULL;
 
-  /* If no data type was specified in the gff, see if there is a default 
+  /* If no data type was specified in the gff, see if there is a default
    * data-type for this source */
   if (!dataType)
     dataType = getBlxDataTypeDefault(source, keyFile);
@@ -451,7 +452,7 @@ BlxDataType* getBlxDataType(GQuark dataType, const char *source, GKeyFile *keyFi
    * supply values that are used in blixem, so are irrelevant to dotter). */
   if (!keyFile || !dataType)
     return result;
-  
+
   if (dataType)
     {
       /* Check if it's already cached */
@@ -472,29 +473,29 @@ BlxDataType* getBlxDataType(GQuark dataType, const char *source, GKeyFile *keyFi
               result->name = dataType;
 
               /* Get the values. They're all optional so just ignore any errors. */
-              result->bulkFetch = keyFileGetCsv(keyFile, typeName, SEQTOOLS_BULK_FETCH, NULL); 
-              result->userFetch = keyFileGetCsv(keyFile, typeName, SEQTOOLS_USER_FETCH, NULL); 
-              result->optionalFetch = keyFileGetCsv(keyFile, typeName, SEQTOOLS_OPTIONAL_FETCH, NULL); 
-              
+              result->bulkFetch = keyFileGetCsv(keyFile, typeName, SEQTOOLS_BULK_FETCH, NULL);
+              result->userFetch = keyFileGetCsv(keyFile, typeName, SEQTOOLS_USER_FETCH, NULL);
+              result->optionalFetch = keyFileGetCsv(keyFile, typeName, SEQTOOLS_OPTIONAL_FETCH, NULL);
+
               /* Get the flags. Again, they're all optional. These calls update the
                * flag in place if it is found, or leave it at the pre-set default otherwise. */
               int flag = MSPFLAG_MIN + 1;
               for ( ; flag < MSPFLAG_NUM_FLAGS; ++flag)
                 {
                   getMspFlag(keyFile, typeName, (MspFlag)flag, result);
-                }              
-              
+                }
+
               /* Insert it into the table of data types */
               g_dataTypes[dataType] = result ;
             }
           else
             {
-              g_set_error(error, BLX_GFF3_ERROR, BLX_GFF3_ERROR_DATA_TYPE, 
+              g_set_error(error, BLX_GFF3_ERROR, BLX_GFF3_ERROR_DATA_TYPE,
                           "Config file error: data type '%s' not found", typeName);
             }
         }
     }
-  
+
   return result;
 }
 
@@ -502,7 +503,7 @@ BlxDataType* getBlxDataType(GQuark dataType, const char *source, GKeyFile *keyFi
 BlxDataType* constructBlxDataType(BlxGffData *gffData, GHashTable *fetchMethods, GError **error)
 {
   BlxDataType *result = NULL;
-  
+
   /* If no data type is specified then try to construct one from the given fetch method */
   if (gffData && !gffData->dataType && gffData->fetchCommand)
     {
@@ -531,7 +532,7 @@ BlxDataType* constructBlxDataType(BlxGffData *gffData, GHashTable *fetchMethods,
           fetchMethod->separator = g_strdup(" ");
           fetchMethod->outputType = BLXFETCH_OUTPUT_GFF;
           fetchMethod->location = g_strdup(gffData->fetchCommand);
-                                                
+
           if (gffData->fetchArgs)
             fetchMethod->args = g_strdup(gffData->fetchArgs);
 
@@ -554,13 +555,13 @@ BlxDataType* constructBlxDataType(BlxGffData *gffData, GHashTable *fetchMethods,
 }
 
 
-/* Return the filename from the gff if given, otherwise check 
+/* Return the filename from the gff if given, otherwise check
  * if the filename is given in the config and return that.
  * Returns 0 if not found. */
 static GQuark getFeatureFilename(BlxGffData *gffData, GKeyFile *keyFile, GError **error)
 {
   GQuark result = 0;
-  
+
   if (gffData->filename)
     {
       /* Filename was given in the gff so use that */
@@ -573,23 +574,23 @@ static GQuark getFeatureFilename(BlxGffData *gffData, GKeyFile *keyFile, GError
       result = g_quark_from_string(filename);
       g_free(filename);
     }
-  
+
   return result;
 }
 
 
 /* Create a blixem object from the given parsed GFF data. Creates an MSP if the type is
  * exon or match, or a BlxSequence if the type is transcript. Does nothing for other types. */
-static void createBlixemObject(BlxGffData *gffData, 
+static void createBlixemObject(BlxGffData *gffData,
                                GArray* featureLists[],
-			       MSP **lastMsp, 
-			       MSP **mspList, 
-			       GList **seqList, 
+			       MSP **lastMsp,
+			       MSP **mspList,
+			       GList **seqList,
                                GList *columnList,
 			       GSList *styles,
                                const int resFactor,
                                GKeyFile *keyFile,
-                               GHashTable *lookupTable, 
+                               GHashTable *lookupTable,
                                GHashTable *fetchMethods,
 			       GError **error)
 {
@@ -597,7 +598,7 @@ static void createBlixemObject(BlxGffData *gffData,
     {
       return;
     }
-    
+
   GError *tmpError = NULL;
 
   /* Get the data type struct */
@@ -616,38 +617,38 @@ static void createBlixemObject(BlxGffData *gffData,
   if (gffData->mspType > BLXMSP_NUM_TYPES)
     {
       /* "Invalid" MSP types, i.e. don't create a real MSP from these types. */
-      
+
       if (gffData->mspType == BLXMSP_TRANSCRIPT)
         {
           /* For transcripts, although we don't create an MSP we do create a sequence */
           addBlxSequence(gffData->sName, gffData->sName_orig, gffData->idTag, gffData->qStrand,
-                         dataType, gffData->source, seqList, columnList, gffData->sequence, NULL, 
+                         dataType, gffData->source, seqList, columnList, gffData->sequence, NULL,
                          lookupTable, NULL, &tmpError);
         }
     }
   else
     {
       /* For all other types, create an MSP */
-      
+
       /* Regions don't necessarily have a name or ID, but they should have a
        * source, so use that as the name */
       if (gffData->mspType == BLXMSP_REGION && !gffData->sName)
         {
           gffData->sName = g_strdup(gffData->source);
         }
-      
-      if (!gffData->sName && !gffData->parentIdTag && 
-	  (gffData->mspType == BLXMSP_TRANSCRIPT || typeIsExon(gffData->mspType) || 
+
+      if (!gffData->sName && !gffData->parentIdTag &&
+	  (gffData->mspType == BLXMSP_TRANSCRIPT || typeIsExon(gffData->mspType) ||
 	   typeIsMatch(gffData->mspType)))
 	{
 	  g_set_error(error, BLX_ERROR, 1, "Target/name/parent-ID must be specified for exons and alignments.\n");
 	  return;
 	}
-	
+
       /* Get the id corresponding to the BlxSequence: we want the parent if it's an intron/exon, or the
        * ID for this item if it's a transcript or match */
       char *idTag = typeIsExon(gffData->mspType) || typeIsIntron(gffData->mspType) ? gffData->parentIdTag : gffData->idTag;
-      
+
       /* For exons and transcripts, the target strand is irrelevant - use the ref seq strand */
       if (typeIsExon(gffData->mspType) || typeIsIntron(gffData->mspType) || gffData->mspType == BLXMSP_TRANSCRIPT)
 	{
@@ -655,38 +656,38 @@ static void createBlixemObject(BlxGffData *gffData,
 	}
 
       MSP *msp = createNewMsp(featureLists,
-                              lastMsp, 
-			      mspList, 
-			      seqList, 
+                              lastMsp,
+			      mspList,
+			      seqList,
                               columnList,
 			      gffData->mspType,
                               dataType,
 			      gffData->source,
-			      gffData->score, 
-			      gffData->percentId, 
+			      gffData->score,
+			      gffData->percentId,
                               gffData->phase,
 			      idTag,
-			      gffData->qName, 
-			      gffData->qStart, 
-			      gffData->qEnd, 
-			      gffData->qStrand, 
+			      gffData->qName,
+			      gffData->qStart,
+			      gffData->qEnd,
+			      gffData->qStrand,
 			      UNSET_INT,
 			      gffData->sName,
 			      gffData->sName_orig,
-			      gffData->sStart, 
-			      gffData->sEnd, 
-			      gffData->sStrand, 
-			      gffData->sequence, 
+			      gffData->sStart,
+			      gffData->sEnd,
+			      gffData->sStrand,
+			      gffData->sequence,
                               filename,
                               lookupTable,
                               NULL,
 			      &tmpError);
 
     if (!tmpError)
-	{ 
+	{
 	  /* Get the style based on the source */
 	  msp->style = getBlxStyle(gffData->source, styles, &tmpError);
-          
+
 	  if (tmpError)
 	    {
 	      /* style errors are not critical */
@@ -704,7 +705,7 @@ static void createBlixemObject(BlxGffData *gffData,
            * the list once rather than on each iteration. */
           if (msp && msp->sSequence && msp->sSequence->mspList)
             msp->sSequence->mspList = g_list_sort(msp->sSequence->mspList, compareFuncMspPos);
-          
+
 	}
     }
 
@@ -720,15 +721,15 @@ static void createBlixemObject(BlxGffData *gffData,
 /* Parse GFF3 data */
 void parseGff3Body(const int lineNum,
                    GArray* featureLists[],
-                   MSP **lastMsp, 
-		   MSP **mspList, 
-		   BlxParserState *parserState, 
-		   GString *line_string, 
+                   MSP **lastMsp,
+		   MSP **mspList,
+		   BlxParserState *parserState,
+		   GString *line_string,
 		   GList **seqList,
                    GList *columnList,
                    GSList *supportedTypes,
                    GSList *styles,
-                   const int resFactor, 
+                   const int resFactor,
                    GKeyFile *keyFile,
                    const IntRange* const refSeqRange,
                    GHashTable *lookupTable,
@@ -739,22 +740,22 @@ void parseGff3Body(const int lineNum,
   static int num_errors = 0 ;
   const int max_errors = 20 ; /* Limit the number of errors we report in case there are, say, thousands
                                * of lines we can't read */
-  
+
   /* Parse the data into a temporary struct */
   BlxGffData gffData = {NULL, NULL, BLXMSP_NONE,
                         UNSET_INT, UNSET_INT, UNSET_INT, UNSET_INT, BLXSTRAND_NONE, UNSET_INT,
 			NULL, NULL, BLXSTRAND_NONE,
                         UNSET_INT, UNSET_INT, NULL, NULL, NULL, NULL, BLX_GAP_STRING_INVALID, 0, 0, NULL, NULL};
-		      
+
   GError *error = NULL;
   parseGffColumns(line_string, lineNum, seqList, supportedTypes, refSeqRange, &gffData, &error);
-  
+
   /* Create a blixem object based on the parsed data */
   if (!error)
     {
       createBlixemObject(&gffData, featureLists, lastMsp, mspList, seqList, columnList, styles, resFactor, keyFile, lookupTable, fetchMethods, &error);
     }
-  
+
   if (error)
     {
       ++num_errors ;
@@ -773,7 +774,7 @@ void parseGff3Body(const int lineNum,
           g_error_free(error);
         }
     }
-  
+
   //DEBUG_EXIT("parseGff3Body");
 }
 
@@ -794,11 +795,11 @@ void parseFastaSeqHeader(char *line, const int lineNum,
 {
   gboolean status = TRUE;
   char seqName[MAXLINE + 1];
-  
+
   /* Read the ref seq name (and optionally the coords) from the header line */
   int startCoord = UNSET_INT, endCoord = UNSET_INT;
   const int numFound = sscanf(line, ">%s %d %d", seqName, &startCoord, &endCoord);
-  
+
   if (numFound < 1 || !seqName[0])
     {
       /* Didn't find name - this is required */
@@ -868,7 +869,7 @@ void parseFastaSeqHeader(char *line, const int lineNum,
 static BlxStrand readStrand(char *token, GError **error)
 {
   BlxStrand result = BLXSTRAND_NONE;
-  
+
   if (!strcmp(token, "+"))
     {
       result = BLXSTRAND_FORWARD;
@@ -885,14 +886,14 @@ static BlxStrand readStrand(char *token, GError **error)
     {
       g_set_error(error, BLX_GFF3_ERROR, BLX_GFF3_ERROR_INVALID_STRAND, "Invalid strand '%s' in input file.\n", token);
     }
-  
+
   return result;
 }
 
 
 /* Parse the columns in a GFF line and populate the parsed info into the given MSP. */
-static void parseGffColumns(GString *line_string, 
-                            const int lineNum, 
+static void parseGffColumns(GString *line_string,
+                            const int lineNum,
                             GList **seqList,
                             GSList *supportedTypes,
                             const IntRange* const refSeqRange,
@@ -901,7 +902,7 @@ static void parseGffColumns(GString *line_string,
 {
     /* Split the line into its tab-separated columns. We should get 9 of them */
   char **tokens = g_strsplit_set(line_string->str, "\t", -1);   /* -1 means do all tokens. */
-  
+
   /* This error should get set if there is a fatal error reading this line. */
   GError *tmpError = NULL;
 
@@ -911,27 +912,27 @@ static void parseGffColumns(GString *line_string,
     {
       /* Reference sequence name */
       gffData->qName = tokens[0] ? g_ascii_strup(tokens[0], -1) : NULL;
-      
+
       /* Source (optional) */
       if (tokens[1] && strcmp(tokens[1], "."))
           {
             gffData->source = g_uri_unescape_string(tokens[1], NULL);
           }
-      
+
       /* Type (converted to a seqtools type) */
       gffData->mspType = getBlxType(supportedTypes, tokens[2], &tmpError);
     }
-    
+
   if (!tmpError)
     {
       /* Reference sequence coords - ignore anything not in refSeqRange.
        * Note though that we accept features that are partially in range, and
-       * also we currently accept all exons/introns. This is because we may, say, 
+       * also we currently accept all exons/introns. This is because we may, say,
        * be given the exons in a transcript and be expected to calculate the
-       * introns ourselves, but if such an intron is not entirely within range 
-       * then we need knowledge of the adjacent exon that is out of range in 
-       * order to be able to calculate that intron. Rather than get into 
-       * complicated filtering to include only those exons we need, we currently 
+       * introns ourselves, but if such an intron is not entirely within range
+       * then we need knowledge of the adjacent exon that is out of range in
+       * order to be able to calculate that intron. Rather than get into
+       * complicated filtering to include only those exons we need, we currently
        * just include all exons and introns in the input file. Ideally we would
        * at least filter out transcripts that are entirely out of range, but we
        * don't fully know the parent/child relationship at this point, so that
@@ -945,19 +946,19 @@ static void parseGffColumns(GString *line_string,
           refSeqRange && refSeqRange->isSet())
         {
           IntRange featureRange(gffData->qStart, gffData->qEnd); /* make sure min < max */
-          
+
           if (!rangesOverlap(&featureRange, refSeqRange))
             g_set_error(&tmpError, BLX_GFF3_ERROR, BLX_GFF3_ERROR_OUT_OF_RANGE, "Feature is outside the reference sequence range.\n");
         }
     }
-  
+
   if (!tmpError)
     {
       if (!stringsEqual(tokens[5], ".", TRUE))
         {
           gffData->score = g_ascii_strtod(tokens[5], NULL);
         }
-      
+
       gffData->qStrand = readStrand(tokens[6], &tmpError);
     }
 
@@ -966,7 +967,7 @@ static void parseGffColumns(GString *line_string,
       if (stringsEqual(tokens[7], ".", TRUE))
         {
           gffData->phase = 0;
-          
+
           if (gffData->mspType == BLXMSP_CDS)
             {
               g_warning("[line %d] CDS type does not have phase specified.\n", lineNum);
@@ -976,31 +977,31 @@ static void parseGffColumns(GString *line_string,
         {
           gffData->phase = convertStringToInt(tokens[7]);
         }
-  
+
       /* Parse the optional attributes */
       char *attributes = tokens[8];
-      
+
       if (attributes)
         {
           parseAttributes(attributes, seqList, lineNum, gffData, &tmpError);
         }
     }
-    
+
   if (tmpError)
     {
       g_propagate_error(error, tmpError);
     }
-  
+
   g_strfreev(tokens);
 }
 
 
 /* Parse the given text, which contains attributes of the format "tag=data". The data
- * can contain multiple values, separated by spaces. Space characters within the data must 
+ * can contain multiple values, separated by spaces. Space characters within the data must
  * be escaped. Populates the match sequence into 'sequence' if found in one of the attributes. */
-static void parseAttributes(char *attributes, 
-			    GList **seqList, 
-			    const int lineNum, 
+static void parseAttributes(char *attributes,
+			    GList **seqList,
+			    const int lineNum,
 			    BlxGffData *gffData,
 			    GError **error)
 {
@@ -1010,7 +1011,7 @@ static void parseAttributes(char *attributes,
   /* Loop through all the tags and read their data. */
   char **token = tokens;
   GError *tmpError = NULL;
-  
+
   while (token && *token && **token && !tmpError)
     {
       parseTagDataPair(*token, lineNum, seqList, gffData, &tmpError);
@@ -1022,7 +1023,7 @@ static void parseAttributes(char *attributes,
     {
       g_propagate_error(error, tmpError);
     }
-  
+
   g_strfreev(tokens);
 }
 
@@ -1030,18 +1031,18 @@ static void parseAttributes(char *attributes,
 /* Parse a tag/data pair of the format "tag=data" */
 static void parseTagDataPair(char *text,
                              const int lineNum,
-                             GList **seqList, 
-			     BlxGffData *gffData, 
+                             GList **seqList,
+			     BlxGffData *gffData,
                              GError **error)
 {
   //DEBUG_ENTER("parseTagDataPair(text='%s')", text);
-              
+
   /* Split on the "=" and check that we get 3 tokens */
   char **tokens = g_strsplit_set(text, "=", -1);
-  
+
   GError *tmpError = NULL;
   validateNumTokens(tokens, 2, 2, &tmpError);
-  
+
   if (!tmpError)
     {
       /* Call the relevant function to parse data for this tag */
@@ -1063,15 +1064,15 @@ static void parseTagDataPair(char *text,
           if (gffData->gapString)
             {
               /*! \todo For now, override the cigar_bam string because we are experiencing
-               * bugs with it. Longer term it shouldn't really matter which we use, although 
+               * bugs with it. Longer term it shouldn't really matter which we use, although
                * we may want to give preference to more informative gap strings e.g. vulgar */
               g_free(gffData->gapString);
               gffData->gapString = NULL;
               gffData->gapFormat = BLX_GAP_STRING_INVALID;
             }
-          
+
           gffData->gapString = g_strdup(tokens[1]);
-          gffData->gapFormat = BLX_GAP_STRING_GFF3; 
+          gffData->gapFormat = BLX_GAP_STRING_GFF3;
         }
       else if (!strcmp(tokens[0], "cigar_bam"))
         {
@@ -1079,7 +1080,7 @@ static void parseTagDataPair(char *text,
           if (!gffData->gapString)
             {
               gffData->gapString = g_strdup(tokens[1]);
-              gffData->gapFormat = BLX_GAP_STRING_BAM_CIGAR; 
+              gffData->gapFormat = BLX_GAP_STRING_BAM_CIGAR;
             }
         }
       else if (!strcmp(tokens[0], "gaps"))
@@ -1088,7 +1089,7 @@ static void parseTagDataPair(char *text,
           if (!gffData->gapString)
             {
               gffData->gapString = g_strdup(tokens[1]);
-              gffData->gapFormat = BLX_GAP_STRING_ACEDB; 
+              gffData->gapFormat = BLX_GAP_STRING_ACEDB;
             }
         }
       else if (!strcmp(tokens[0], "ID"))
@@ -1124,15 +1125,15 @@ static void parseTagDataPair(char *text,
           DEBUG_OUT("Unknown tag: ignorning.\n");
         }
     }
-  
+
   if (tmpError)
     {
       prefixError(tmpError, "Error processing data for tag '%s'. ", text);
       g_propagate_error(error, tmpError);
     }
-  
+
   g_strfreev(tokens);
-  
+
   //DEBUG_EXIT("parseTagDataPair");
 }
 
@@ -1141,7 +1142,7 @@ static void parseTagDataPair(char *text,
 static void parseNameTag(char *data, char **sName, const int lineNum, GError **error)
 {
   if (data)
-    { 
+    {
       if (*sName == NULL)
 	{
 	  *sName = g_ascii_strup(data, -1);
@@ -1159,10 +1160,10 @@ static void parseTargetTag(char *data, const int lineNum, GList **seqList, BlxGf
 {
   /* Split on spaces */
   char **tokens = g_strsplit_set(data, " ", -1); /* -1 means all tokens */
-  
+
   GError *tmpError = NULL;
   int numTokens = validateNumTokens(tokens, 3, 4, &tmpError);
-  
+
   if (!tmpError)
     {
       if (gffData->sName == NULL)
@@ -1179,36 +1180,36 @@ static void parseTargetTag(char *data, const int lineNum, GList **seqList, BlxGf
           g_free(gffData->sName);
           gffData->sName = tokens[0] ? g_ascii_strup(tokens[0], -1) : NULL;
         }
-      
+
       gffData->sStart = convertStringToInt(tokens[1]);
       gffData->sEnd = convertStringToInt(tokens[2]);
-      
+
       if (numTokens == 4)
         {
           gffData->sStrand = readStrand(tokens[3], &tmpError);
         }
      }
-  
+
    if (tmpError)
      {
        prefixError(tmpError, "Error parsing 'Target' tag '%s'", data);
        g_propagate_error(error, tmpError);
      }
-  
+
   g_strfreev(tokens);
 }
 
 
 /* A function to replace all occurances of substring 'from' with substring 'to' in the given
  * string. Taken from http://stackoverflow.com/questions/3418231/replace-part-of-a-string-with-another-string */
-void stringReplace(string& str, const string& from, const string& to) 
+void stringReplace(string& str, const string& from, const string& to)
 {
   if(from.empty())
     return;
 
   size_t start_pos = 0;
 
-  while((start_pos = str.find(from, start_pos)) != string::npos) 
+  while((start_pos = str.find(from, start_pos)) != string::npos)
     {
       str.replace(start_pos, from.length(), to);
       start_pos += to.length();
@@ -1299,9 +1300,9 @@ static void parseGapString(char *text,
                            MSP *msp,
                            const int resFactor,
                            GArray* featureLists[],
-                           MSP **lastMsp, 
-                           MSP **mspList, 
-                           GList **seqList, 
+                           MSP **lastMsp,
+                           MSP **mspList,
+                           GList **seqList,
                            GError **error)
 {
   if (!text || gapFormat == BLX_GAP_STRING_INVALID)
@@ -1327,18 +1328,18 @@ static void parseGapString(char *text,
    * direction is reverse) when we construct the first range. */
   int q = qForward ? msp->qRange.min() - 1 : msp->qRange.max() + 1;
   int s = sForward ? msp->sRange.min() - 1 : msp->sRange.max() + 1;
-  
+
   GError *tmpError = NULL;
 
-  GapStringData gapStringData = {gapFormat, &msp, qDirection, sDirection, resFactor, &q, &s, 
-                                 featureLists, lastMsp, mspList, seqList, NULL};  
+  GapStringData gapStringData = {gapFormat, &msp, qDirection, sDirection, resFactor, &q, &s,
+                                 featureLists, lastMsp, mspList, seqList, NULL};
 
   const char *cp = text;
-  
+
   while (cp && *cp)
     {
       const char *cp_new = parseCigarStringSection(cp, &gapStringData);
-      
+
       if (tmpError)
         {
           prefixError(tmpError, "Error parsing gap string '%s'. ", cp);
@@ -1346,7 +1347,7 @@ static void parseGapString(char *text,
 
       cp = cp_new;
     }
-  
+
   if (tmpError)
     {
       g_propagate_error(error, tmpError);
@@ -1365,7 +1366,7 @@ static int getCigarStringSectionLen(const char *text, BlxGapFormat gapFormat)
     case BLX_GAP_STRING_GFF3: /* e.g. M76 */
       result = convertStringToInt(text+1);
       break;
-      
+
     case BLX_GAP_STRING_BAM_CIGAR: /* e.g. 76M */
       result = convertStringToInt(text); /* uses atoi, which will ignore characters after */
       break;
@@ -1395,12 +1396,12 @@ static char getCigarStringSectionOperator(const char *text, BlxGapFormat gapForm
       for (++cp ; cp && *cp && !isalpha(*cp); ++cp);
 
       break;
-      
+
     case BLX_GAP_STRING_BAM_CIGAR:
       {
         for ( ; cp && *cp && !isalpha(*cp); ++cp); /* find first alphabetic character */
 
-        if (cp) 
+        if (cp)
           result = *cp;
 
         /* Move cp on to the start of the next section in the cigar, i.e. next digit */
@@ -1408,7 +1409,7 @@ static char getCigarStringSectionOperator(const char *text, BlxGapFormat gapForm
 
         break;
       }
-      
+
     default:
       g_warning("Invalid gap string format\n");
       break;
@@ -1416,7 +1417,7 @@ static char getCigarStringSectionOperator(const char *text, BlxGapFormat gapForm
 
   if (cp_out)
     *cp_out = cp;
-  
+
   return result;
 }
 
@@ -1428,19 +1429,19 @@ static void parseCigarStringMatch(GapStringData *data, const int numNucleotides,
   /* We were at the end of the previous range or gap, so move to the next coord, where our range will start */
   *data->q += data->qDirection;
   *data->s += data->sDirection;
-  
+
   /* Find the coords at the end of the range. */
   int newQ = *data->q + (data->qDirection * (numNucleotides - 1));
   int newS = *data->s + (data->sDirection * (numPeptides - 1));
-  
+
   CoordRange *newRange = new CoordRange;
   msp->gaps = g_slist_append(msp->gaps, newRange);
-  
+
   newRange->qStart = *data->q;
   newRange->qEnd = newQ;
   newRange->sStart = *data->s;
   newRange->sEnd = newS;
-  
+
   *data->q = newQ;
   *data->s = newS;
 }
@@ -1451,31 +1452,31 @@ static void parseCigarStringIntron(GapStringData *data, const int numNucleotides
    * BlxSequence but pass sort=FALSE because we'll sort the resulting msp list once we've finished. */
   MSP *msp = *data->msp;
   MSP *newMsp = copyMsp(msp, data->featureLists, data->lastMsp, data->mspList, TRUE, FALSE);
-  
+
   /* end current msp at the current coords */
   if (data->qDirection > 0)
     msp->qRange.setMax(*data->q);
   else
     msp->qRange.setMin(*data->q);
-  
+
   if (data->sDirection > 0)
     msp->sRange.setMax(*data->s);
   else
     msp->sRange.setMin(*data->s);
-  
+
   /* start new msp at new coords */
   *data->q += data->qDirection * numNucleotides;
-  
+
   if (data->qDirection > 0)
     newMsp->qRange.setMin(*data->q + 1);
   else
     newMsp->qRange.setMax(*data->q - 1);
-  
+
   if (data->sDirection > 0)
     newMsp->sRange.setMin(*data->s + 1);
   else
     newMsp->sRange.setMax(*data->s - 1);
-  
+
   *data->msp = newMsp;
 }
 
@@ -1497,7 +1498,7 @@ static void parseCigarStringInsertion(GapStringData *data, const int numNucleoti
 static gboolean validateCigarOperator(char op, BlxGapFormat gapFormat)
 {
   gboolean result = FALSE;
-  
+
   switch (op)
     {
     case 'M':    case 'm':
@@ -1506,7 +1507,7 @@ static gboolean validateCigarOperator(char op, BlxGapFormat gapFormat)
     case 'I':    case 'i':
       result = (gapFormat == BLX_GAP_STRING_GFF3 || gapFormat == BLX_GAP_STRING_BAM_CIGAR);
       break;
-      
+
     case 'X':    case 'x':
     case 'P':    case 'p':
     case 'S':    case 's':
@@ -1545,11 +1546,11 @@ static gboolean validateCigarOperator(char op, BlxGapFormat gapFormat)
  * So to translate the CIGAR strings to ranges, we do the following:
  *   M8 indicates a match of 8 places, so we increase both coords by 8;
  *   I2 indicates an insertion in the Subject sequence of 2 bases, so we increase the s coord by 2;
- *   D3 indicates a deletion from the Subject sequence of 3 bases, so we increase the q coord by 3. 
+ *   D3 indicates a deletion from the Subject sequence of 3 bases, so we increase the q coord by 3.
  *
  *  qDirection and sDirection are 1 if coords are in an increasing direction or -1 if decreasing.
  */
-static const char* parseCigarStringSection(const char *text, 
+static const char* parseCigarStringSection(const char *text,
                                      GapStringData *data)
 {
   /* Get the digit part of the string, which indicates the number of display coords (peptides in peptide matches,
@@ -1559,9 +1560,9 @@ static const char* parseCigarStringSection(const char *text,
 
   const char *cp = text;
   char op = getCigarStringSectionOperator(text, data->gapFormat, &cp);
-  
+
   /*! \todo If the operator is not valid for this type of cigar string
-   * then we should set the error and return. However, for historic 
+   * then we should set the error and return. However, for historic
    * reasons we have allowed invalid operators in the GFF Gap string,
    * so continue allowing this for now and just give a warning. */
   if (!validateCigarOperator(op, data->gapFormat))
@@ -1573,12 +1574,12 @@ static const char* parseCigarStringSection(const char *text,
     case 'm':
       parseCigarStringMatch(data, numNucleotides, numPeptides);
       break;
-      
+
     case 'N':
     case 'n':
       parseCigarStringIntron(data, numNucleotides, numPeptides);
       break;
-      
+
     case 'D':
     case 'd':
       parseCigarStringDeletion(data, numNucleotides, numPeptides);
@@ -1588,12 +1589,12 @@ static const char* parseCigarStringSection(const char *text,
     case 'i':
       parseCigarStringInsertion(data, numNucleotides, numPeptides);
       break;
-      
+
     case 'X':
     case 'x':
       /* Mismatch. For now just treat it like a match. Blixem detects mistmatches
        * anyway as long as we have the reference sequence. */
-      /*! \todo It might be useful to parse mistmatches in the gap string. This 
+      /*! \todo It might be useful to parse mistmatches in the gap string. This
        * extra info may help e.g. to calculate percentID for matches that extend
        * beyond the reference sequence range. We could do that calculation here
        * if percentID was not given in the GFF? */
@@ -1602,7 +1603,7 @@ static const char* parseCigarStringSection(const char *text,
 
     case 'P':
     case 'p':
-      /* Padding (silent deletion from the reference sequence). Not supported, but 
+      /* Padding (silent deletion from the reference sequence). Not supported, but
        * ignoring these essentially gives us the unpadded cigar. */
       break;
 
@@ -1612,7 +1613,7 @@ static const char* parseCigarStringSection(const char *text,
        * residue to the last one, but blixem detects this anyway, so we can ignore
        * this. */
       break;
-      
+
     case 'H':
     case 'h':
       /* Hard clipping - not supported */
@@ -1632,7 +1633,7 @@ static const char* parseCigarStringSection(const char *text,
       /* Frameshift operators - not supported */
       g_set_error(&data->error, BLX_GFF3_ERROR, BLX_GFF3_ERROR_INVALID_CIGAR_FORMAT, "Blixem does not handle Frameshift operators.\n");
       break;
-      
+
     default:
       g_set_error(&data->error, BLX_GFF3_ERROR, BLX_GFF3_ERROR_INVALID_CIGAR_FORMAT, "Invalid operator '%c' in cigar string.\n", op);
       break;
@@ -1642,24 +1643,24 @@ static const char* parseCigarStringSection(const char *text,
 }
 
 
-/* Validate the number of tokens in a given list. Checks that there are between 'min' and 'max' 
+/* Validate the number of tokens in a given list. Checks that there are between 'min' and 'max'
  * tokens. If not, set the error. Returns the number of tokens. */
 static int validateNumTokens(char **tokens, const int minReqd, const int maxReqd, GError **error)
 {
   char **token = tokens;
   int count = 0;
-  
+
   while (token && *token)
     {
       ++count;
-      ++token; 
+      ++token;
     }
-  
+
   if (count < minReqd || count > maxReqd)
     {
       g_set_error(error, BLX_GFF3_ERROR, BLX_GFF3_ERROR_INVALID_NUM_TOKENS, "Expected between %d and %d columns but found %d\n", minReqd, maxReqd, count);
     }
-  
+
   return count;
 }
 
@@ -1668,11 +1669,11 @@ static int validateNumTokens(char **tokens, const int minReqd, const int maxReqd
 static void addGffType(GSList **supportedTypes, const char *name, const char *soId, BlxMspType blxType)
 {
   BlxGffType *gffType = new BlxGffType;
-  
+
   gffType->name = g_strdup(name);
   gffType->soId = g_strdup(soId);
   gffType->blxType = blxType;
-  
+
   *supportedTypes = g_slist_prepend(*supportedTypes, gffType);
 }
 
@@ -1692,6 +1693,3 @@ static void destroyGffType(BlxGffType **gffType)
       *gffType = NULL;
     }
 }
-
-
-
diff --git a/src/seqtoolsUtils/blxGff3Parser.hpp b/src/seqtoolsUtils/blxGff3Parser.hpp
index cf9bfcca5177afd06246e5b7d52369bdc5d0595f..acf61d5cda0a1c331a04e12893ab0051910e61c1 100644
--- a/src/seqtoolsUtils/blxGff3Parser.hpp
+++ b/src/seqtoolsUtils/blxGff3Parser.hpp
@@ -1,5 +1,6 @@
 /*  File: blxGff3parser.h
  *  Author: Gemma Barson
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -54,49 +55,49 @@ typedef struct _BlxGffType
 
 
 
-/* This enum is to record the type of data currently being parsed by the parser. An input file can 
- * contain multiple types of data. The start of a new section of data is indicated by a header 
+/* This enum is to record the type of data currently being parsed by the parser. An input file can
+ * contain multiple types of data. The start of a new section of data is indicated by a header
  * line beginning with a hash and a known type name, e.g. "# exblx_x" or "##gff-version   3"
  *
- * FS and SFS (Feature Series) data type names have "FS" or "SFS" followed by a specific format 
- * type, e.g. "# SFS type=SEG". 
+ * FS and SFS (Feature Series) data type names have "FS" or "SFS" followed by a specific format
+ * type, e.g. "# SFS type=SEG".
  *
- * For some data types, additional data is included in the header line(s) as well as in the 'body' 
- * section below it. For these, there are two data types in the enum, one postfixed with _HEADER 
- * and one with _BODY. When the header line is detected the initial type is set to the _HEADER enum, 
+ * For some data types, additional data is included in the header line(s) as well as in the 'body'
+ * section below it. For these, there are two data types in the enum, one postfixed with _HEADER
+ * and one with _BODY. When the header line is detected the initial type is set to the _HEADER enum,
  * and when we are finished processing the header information it is set to _BODY, so that we go on
- * to process the body of the data on the next loop through. For types with no information in the 
+ * to process the body of the data on the next loop through. For types with no information in the
  * header, there is only a _BODY enum.
  */
 typedef enum
   {
     PARSER_START,                  /* indicates that we haven't started processing yet */
     PARSER_ERROR,                  /* indiates an error state */
-    
+
     GFF_3_HEADER,                  /* GFF 3 header */
     GFF_3_BODY,                    /* GFF 3 data */
-    
+
     FASTA_SEQ_HEADER,              /* FASTA sequence header */
     FASTA_SEQ_BODY,                /* Sequence data in FASTA format */
     FASTA_SEQ_IGNORE,              /* A FASTA sequence we're not interested in */
-    
+
     EXBLX_BODY,                    /* Old style sequence entries. */
     SEQBL_BODY,                    /* Old style sequence entries. */
-    EXBLX_X_BODY,                  /* New style sequence entries with gaps and match strand. (_X stands for eXtended.) */ 
+    EXBLX_X_BODY,                  /* New style sequence entries with gaps and match strand. (_X stands for eXtended.) */
     SEQBL_X_BODY,                  /* New style sequence entries with gaps and match strand. (_X stands for eXtended.) */
-    
+
     FS_HSP_BODY,                   /* feature-series HSP data */
-    
+
     FS_GSP_HEADER,                 /* feature-series GSP data header */
     FS_GSP_BODY,                   /* feature-series GSP data */
-    
+
     FS_GFF_BODY,                   /* feature-series GFF data */
-    
+
     FS_SEG_BODY,                   /* feature-series segment data */
-    
+
     FS_XY_HEADER,                  /* feature-series XY data header */
     FS_XY_BODY,                    /* feature-series XY data */
-    
+
     FS_SEQ_HEADER,                 /* feature-series sequence data header */
     FS_SEQ_BODY                    /* feature-series sequence data */
   } BlxParserState ;
@@ -105,10 +106,10 @@ typedef enum
 
 /* External functions */
 void parseGff3Header(const int lineNum,
-                     MSP **lastMsp, 
-                     MSP **mspList, 
-                     BlxParserState *parserState, 
-                     GString *line_string, 
+                     MSP **lastMsp,
+                     MSP **mspList,
+                     BlxParserState *parserState,
+                     GString *line_string,
                      GList **seqList,
                      char *refSeqName,
                      IntRange *refSeqRange,
@@ -116,10 +117,10 @@ void parseGff3Header(const int lineNum,
 
 void parseGff3Body(const int lineNum,
                    GArray* featureLists[],
-                   MSP **lastMsp, 
-		   MSP **mspList, 
-		   BlxParserState *parserState, 
-		   GString *line_string, 
+                   MSP **lastMsp,
+		   MSP **mspList,
+		   BlxParserState *parserState,
+		   GString *line_string,
 		   GList **seqList,
                    GList *columnList,
                    GSList *supportedTypes,
@@ -134,8 +135,8 @@ void parseFastaSeqHeader(char *line, const int lineNum,
                          char **refSeq, char *refSeqName, IntRange *refSeqRange,
                          char ***readSeq, int *readSeqLen, int *readSeqMaxLen,
                          BlxParserState *parserState);
-                         
-                         
+
+
 GSList*                            blxCreateSupportedGffTypeList(const BlxSeqType seqType);
 void                               blxDestroyGffTypeList(GSList **supportedTypes);
 BlxDataType*                       getBlxDataType(GQuark dataType, const char *source, GKeyFile *keyFile, GError **error);
diff --git a/src/seqtoolsUtils/blxmsp.cpp b/src/seqtoolsUtils/blxmsp.cpp
index f7026a3f2f8c3bcd6189a00e7fea3889abc1d5be..c382ea59de6d65d1cdcd76a113e87561446c8ef3 100644
--- a/src/seqtoolsUtils/blxmsp.cpp
+++ b/src/seqtoolsUtils/blxmsp.cpp
@@ -1,5 +1,6 @@
 /*  File: blxmsp.c
  *  Author: Gemma Barson, 2010-09-02
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -48,10 +49,10 @@ using namespace std;
 static int g_MaxMspLen = 0;                   /* max length in display coords of all MSPs in the detail-view */
 static BlxDataType *g_DefaultDataType = NULL; /* data type containing default values; used if sequences do not have a data-type specified */
 
-/* The config value keys for each flag in BlxDataType. 
+/* The config value keys for each flag in BlxDataType.
  * Use NULL if you don't want the value to be configurable via the config file.
  * THIS ARRAY MUST BE UPDATED IF YOU ADD ITEMS TO THE MspFlag ENUM */
-static const char* g_MspFlagConfigKeys[] = 
+static const char* g_MspFlagConfigKeys[] =
   {
     "dummy", /* dummy value for MSPFLAG_MIN */
 
@@ -60,15 +61,15 @@ static const char* g_MspFlagConfigKeys[] =
     "squash-identical-features",
     "strand-specific",
     "show-reverse-strand",
-    
+
     "dummy" /* dummy value for MSPFLAG_NUM_FLAGS */
   };
 
 
-static void addBlxSequences(const char *name, const char *name_orig, const char *idTag, 
-                            BlxStrand strand, BlxDataType *dataType, const char *source, 
-                            GArray *featureLists[], MSP **lastMsp, MSP **mspList, GList **seqList, 
-                            GList *columnList, char *sequence, 
+static void addBlxSequences(const char *name, const char *name_orig, const char *idTag,
+                            BlxStrand strand, BlxDataType *dataType, const char *source,
+                            GArray *featureLists[], MSP **lastMsp, MSP **mspList, GList **seqList,
+                            GList *columnList, char *sequence,
                             MSP *msp, GHashTable *lookupTable, BlxSequence *blxSeq, GError **error);
 static void findSequenceExtents(BlxSequence *blxSeq);
 static MSP* createMissingMsp(const BlxMspType newType,
@@ -77,10 +78,10 @@ static MSP* createMissingMsp(const BlxMspType newType,
                              const char *qname,
                              const int newFrame,
                              BlxStyle *newStyle,
-                             BlxSequence *blxSeq, 
-                             GArray* featureLists[], 
-                             MSP **lastMsp, 
-                             MSP **mspList, 
+                             BlxSequence *blxSeq,
+                             GArray* featureLists[],
+                             MSP **lastMsp,
+                             MSP **mspList,
                              GList **seqList,
                              GList *columnList,
                              GHashTable *lookupTable,
@@ -176,24 +177,24 @@ gboolean mspIsExon(const MSP* const msp)
 gboolean mspLayerIsVisible(const MSP* const msp)
 {
   gboolean result = TRUE;
-  
+
   /* Currently only applicable to exons. Show plain exons OR their CDS/UTR sections,
-   * but not both. The plan is to add some options to toggle layers on and off, but for 
+   * but not both. The plan is to add some options to toggle layers on and off, but for
    * now just hard code this. */
   if (msp->type == BLXMSP_EXON)
     {
       result = FALSE;
     }
-  
+
   return result;
 }
 
 
-/* Determine whether the given MSP is in a coding region or untranslated region. For 
+/* Determine whether the given MSP is in a coding region or untranslated region. For
  * exons, this is determined by the exon type. For introns, we have to look at the
  * adjacent exons to determine whether to show them as CDS or UTR - only show it as
  * CDS if there is a CDS exon on both sides of the intron. */
-static const GdkColor* mspGetIntronColor(const MSP* const msp, 
+static const GdkColor* mspGetIntronColor(const MSP* const msp,
                                          GArray *defaultColors,
                                          const int defaultColorId,
                                          const BlxSequence *blxSeq,
@@ -208,20 +209,20 @@ static const GdkColor* mspGetIntronColor(const MSP* const msp,
                                          const int utrLineColorId)
 {
   const GdkColor *result = NULL;
-  
+
   /* Find the nearest exons before and after this MSP */
   const MSP *prevExon = NULL;
   const MSP *nextExon = NULL;
-  
+
   GList *mspItem = blxSeq->mspList;
   for ( ; mspItem; mspItem = mspItem->next)
     {
     const MSP *curMsp = (const MSP *)(mspItem->data);
-    
+
     if (mspIsExon(curMsp) && mspLayerIsVisible(curMsp))
       {
       const int curOffset = mspGetQStart(curMsp) - mspGetQStart(msp);
-      
+
       if (curOffset < 0 && (!prevExon || curOffset > mspGetQStart(prevExon) - mspGetQStart(msp)))
 	{
 	/* Current MSP is before our MSP and is the smallest offset so far */
@@ -234,10 +235,10 @@ static const GdkColor* mspGetIntronColor(const MSP* const msp,
 	}
       }
     }
-  
+
   gboolean prevIsUtr = prevExon && prevExon->type == BLXMSP_UTR;
   gboolean nextIsUtr = nextExon && nextExon->type == BLXMSP_UTR;
-  
+
   /* if either exon is UTR, the intron is UTR */
   if (prevIsUtr)
     {
@@ -265,7 +266,7 @@ static const GdkColor* mspGetIntronColor(const MSP* const msp,
     else
       result = getGdkColor(exonLineColorId, defaultColors, selected, usePrintColors);
     }
-  
+
   return result;
 }
 
@@ -292,7 +293,7 @@ gboolean mspIsVariation(const MSP* const msp)
 gboolean mspIsZeroLenVariation(const MSP* const msp)
 {
   gboolean result = mspIsVariation(msp);
-  
+
   if (result)
     {
       const char *seq = mspGetMatchSeq(msp);
@@ -313,14 +314,14 @@ gboolean mspHasSName(const MSP* const msp)
   return TRUE;
 }
 
-/* Whether the MSP requires subject sequence coords to be set. Only matches 
+/* Whether the MSP requires subject sequence coords to be set. Only matches
  * and box features have coords on the subject sequence. (to do: is this optional for exons?) */
 gboolean mspHasSCoords(const MSP* const msp)
 {
   return mspIsBoxFeature(msp) || mspIsBlastMatch(msp);
 }
 
-/* Whether the MSP requires subject sequence strand to be set. Only matches 
+/* Whether the MSP requires subject sequence strand to be set. Only matches
  * require strand on the subject sequence, although exons may have them set. */
 gboolean mspHasSStrand(const MSP* const msp)
 {
@@ -336,7 +337,7 @@ gboolean mspHasSSeq(const MSP* const msp)
 
 
 /***********************************************************
- *		MSP data access functions		   * 
+ *		MSP data access functions		   *
  ***********************************************************/
 
 /* Get the range of coords of the alignment on the reference sequence */
@@ -386,7 +387,7 @@ int mspGetSStart(const MSP* const msp)
 }
 
 /* Get the end coord of the alignment on the match sequence. This is
- * the highest value coord if the match strand is in the same direction as the ref seq strand, 
+ * the highest value coord if the match strand is in the same direction as the ref seq strand,
  * or the lowest value coord otherwise. */
 int mspGetSEnd(const MSP* const msp)
 {
@@ -399,7 +400,7 @@ int mspGetSEnd(const MSP* const msp)
 const char *mspGetSName(const MSP* const msp)
 {
   const char *result = NULL;
-  
+
   if (msp)
     {
       if (msp->sname && msp->sname[0] != 0)
@@ -411,7 +412,7 @@ const char *mspGetSName(const MSP* const msp)
           result = blxSequenceGetName(msp->sSequence);
         }
     }
-  
+
   return result;
 }
 
@@ -419,7 +420,7 @@ const char *mspGetSName(const MSP* const msp)
 const char *mspGetSNameOrig(const MSP* const msp)
 {
   const char *result = NULL;
-  
+
   if (msp)
     {
       if (msp->sname_orig && *(msp->sname_orig))
@@ -427,7 +428,7 @@ const char *mspGetSNameOrig(const MSP* const msp)
           result = msp->sname_orig;
         }
     }
-  
+
   return result;
 }
 
@@ -442,7 +443,7 @@ int mspGetMatchSeqLen(const MSP* const msp)
 int mspGetRefFrame(const MSP* const msp, const BlxSeqType seqType)
 {
   int result = UNSET_INT;
-  
+
   if (seqType == BLXSEQ_DNA)
     {
     /* Ignore the frame in  the msp. For DNA matches we only have one frame on each strand. */
@@ -452,7 +453,7 @@ int mspGetRefFrame(const MSP* const msp, const BlxSeqType seqType)
     {
     result = msp->qFrame;
     }
-  
+
   return result;
 }
 
@@ -466,11 +467,11 @@ const char* mspGetRefName(const MSP* const msp)
 BlxStrand mspGetRefStrand(const MSP* const msp)
 {
   BlxStrand result = msp->qStrand;
-  
+
   /* If not strand specific, always return the forward strand */
   if (!mspGetFlag(msp, MSPFLAG_STRAND_SPECIFIC))
     result = BLXSTRAND_FORWARD;
-  
+
   return result;
 }
 
@@ -482,7 +483,7 @@ BlxStrand mspGetMatchStrand(const MSP* const msp)
   /* If not strand specific, always return the forward strand */
   if (!mspGetFlag(msp, MSPFLAG_STRAND_SPECIFIC))
     result = BLXSTRAND_FORWARD;
-  
+
   return result;
 }
 
@@ -505,7 +506,7 @@ static BlxColor *styleGetBlxColor(BlxStyle *style,
                                   const bool utr)
 {
   BlxColor *blxColor = NULL;
-  
+
   if (fill)
     {
       if (utr)
@@ -530,26 +531,26 @@ static BlxColor *styleGetBlxColor(BlxStyle *style,
  * Note that this function may alter BlxColor structs to override transparent colors with
  * alternative colors if allowTransparency is false. It will only do this once for each BlxColor
  * and will set the overridden flag in the color to indicate that a color has been set. */
-static const GdkColor *styleGetColor(BlxStyle *style, 
-                                     const gboolean selected, 
+static const GdkColor *styleGetColor(BlxStyle *style,
+                                     const gboolean selected,
                                      const gboolean usePrintColors,
-                                     const gboolean fill, 
+                                     const gboolean fill,
                                      const gboolean utr,
                                      GArray *defaultColors,
                                      const int defaultColorId,
                                      bool allowTransparency)
 {
   GdkColor *result = NULL;
-  
+
   BlxColor *blxColor = styleGetBlxColor(style, fill, utr);
-  
-  /* If it's transparent, use the background color instead, unless 
+
+  /* If it's transparent, use the background color instead, unless
    * selected is true in which case we need to use the highlight color */
   if (blxColor && blxColor->transparent && !selected)
     {
       if (allowTransparency)
         {
-          /* We don't really handle transparency. Instead we return the background color, 
+          /* We don't really handle transparency. Instead we return the background color,
            * so that it appears transparent */
           result = getGdkColor(defaultColorId, defaultColors, selected, usePrintColors);
           blxColor = NULL ;
@@ -562,7 +563,7 @@ static const GdkColor *styleGetColor(BlxStyle *style,
       else
         {
           /* It's a bit ambiguous what to do here. We've been told not to make it transparent
-           * (probably because in the detail view empty boxes are not much use). For now, 
+           * (probably because in the detail view empty boxes are not much use). For now,
            * if the fill is transparent then replace it with a lighter version of the
            * border colour. If the border is transparent then replace with a darker version of the
            * fill colour. */
@@ -585,15 +586,15 @@ static const GdkColor *styleGetColor(BlxStyle *style,
 
 
 /* Get the color for drawing the given MSP (If 'selected' is true, returns
- * the color when the MSP is selected.). Returns the fill color if 'fill' is 
+ * the color when the MSP is selected.). Returns the fill color if 'fill' is
  * true, otherwise the line color. If allowTransparency is true then the returned color is the
  * same as the background if transparent; otherwise it is replaced with one of the default colors. */
-const GdkColor* mspGetColor(const MSP* const msp, 
-			    GArray *defaultColors, 
+const GdkColor* mspGetColor(const MSP* const msp,
+			    GArray *defaultColors,
                             const int defaultColorId,
 			    const BlxSequence *blxSeq,
-			    const gboolean selected, 
-			    const gboolean usePrintColors, 
+			    const gboolean selected,
+			    const gboolean usePrintColors,
 			    const gboolean fill,
 			    const int exonFillColorId,
 			    const int exonLineColorId,
@@ -604,12 +605,12 @@ const GdkColor* mspGetColor(const MSP* const msp,
                             const bool allowTransparency)
 {
   const GdkColor *result = NULL;
-  
+
   if (msp->style)
     {
       result = styleGetColor(msp->style, selected, usePrintColors, fill, msp->type == BLXMSP_UTR, defaultColors, defaultColorId, allowTransparency);
     }
-  
+
   if (!result)
     {
       /* Use the default color for this MSP's type */
@@ -627,21 +628,21 @@ const GdkColor* mspGetColor(const MSP* const msp,
         case BLXMSP_UTR:
           result = getGdkColor(fill ? utrFillColorId : utrLineColorId, defaultColors, selected, usePrintColors);
           break;
-      
+
           /* to do: mspGetIntronColor() is non-trivial, because it has to work out the color
            * from the adjacent exons. Since mspGetColor() is called many times on re-draw, it
-           * would be better to work out whether an intron is CDS or UTR during initialisation 
+           * would be better to work out whether an intron is CDS or UTR during initialisation
            * and use different types (e.g. BLXMSP_INTRON_CDS) that can be queried here to quickly
            * determine what color to use. */
         case BLXMSP_INTRON:
           result = mspGetIntronColor(msp, defaultColors, defaultColorId, blxSeq, selected, usePrintColors, fill, exonFillColorId, exonLineColorId, cdsFillColorId, cdsLineColorId, utrFillColorId, utrLineColorId);
           break;
-          
+
         default:
           break;
         };
     }
-  
+
   return result;
 }
 
@@ -683,7 +684,7 @@ const char *mspGetStrain(const MSP* const msp)
 char *mspGetCoordsAsString(const MSP* const msp)
 {
   char *result = NULL;
-  
+
   if (msp)
     {
       GString *resultStr = g_string_new("");
@@ -693,10 +694,10 @@ char *mspGetCoordsAsString(const MSP* const msp)
         g_string_append_printf(resultStr, "%d,%d", msp->qRange.min(), msp->qRange.max());
       else
         g_string_append_printf(resultStr, "%d,%d[%d,%d]", msp->qRange.min(), msp->qRange.max(), msp->sRange.min(), msp->sRange.max());
-      
+
       result = g_string_free(resultStr, FALSE);
     }
-  
+
   return result;
 }
 
@@ -713,14 +714,14 @@ gchar* mspGetTreePath(const MSP* const msp, BlxModelId modelId)
 //static gboolean fsArrayFindByName(GArray *fsArray, FeatureSeries *fs, int *index_out)
 //{
 //  gboolean result = FALSE;
-//  
+//
 //  if (fsArray)
 //    {
 //    int i = 0;
 //    for ( ; i < fsArray->len; ++i)
 //      {
 //      FeatureSeries *compareFs = &g_array_index(fsArray, FeatureSeries, i);
-//      
+//
 //      if (!fsSortByNameCompareFunc(fs, compareFs))
 //	{
 //	result = TRUE;
@@ -729,26 +730,26 @@ gchar* mspGetTreePath(const MSP* const msp, BlxModelId modelId)
 //	}
 //      }
 //    }
-//  
+//
 //  return result;
 //}
 
 
 /* Comparison function to sort two Feature Series by the order number stored in the FeatureSeries
- * struct. Returns -1 if the first item is before the second, 1 if the second is first, or 0 if 
+ * struct. Returns -1 if the first item is before the second, 1 if the second is first, or 0 if
  * they are equal.  */
 gint fsSortByOrderCompareFunc(gconstpointer fs1_in, gconstpointer fs2_in)
 {
   int result = 0;
-  
+
   FeatureSeries *fs1 = (FeatureSeries *)fs1_in;
   FeatureSeries *fs2 = (FeatureSeries *)fs2_in;
-  
+
   if (fs1->order < fs2->order)
     result = -1;
   else if (fs1->order > fs2->order)
     result = 1;
-  
+
   return result;
 }
 
@@ -758,9 +759,9 @@ gint fsSortByNameCompareFunc(gconstpointer fs1_in, gconstpointer fs2_in)
 {
   FeatureSeries *fs1 = (FeatureSeries *)fs1_in;
   FeatureSeries *fs2 = (FeatureSeries *)fs2_in;
-  
+
   /*printf("%s - %s : %d\n", fs1->name, fs2->name,  strcmp(fs1->name, fs2->name));*/
-  
+
   return strcmp(fs1->name, fs2->name);
 }
 
@@ -770,20 +771,20 @@ gint fsSortByNameCompareFunc(gconstpointer fs1_in, gconstpointer fs2_in)
  * that too. */
 //void insertFS(MSP *msp, char *series)
 //{
-//  if (!fsArr) 
+//  if (!fsArr)
 //    {
 //    fsArr = g_array_sized_new(TRUE, FALSE, sizeof(FeatureSeries), 50);
 //    }
-//  
+//
 //  static int orderNum = 0; /* will increment this each time we add a feature series to the array */
-//  
+//
 //  FeatureSeries *fs = new FeatureSeries;
 //  fs->on = 1;
 //  fs->y = 0.0;
 //  fs->xy = (msp->type == BLXMSP_XY_PLOT ? 1 : 0);
-//  
+//
 //  fs->name = g_strdup(series);
-//  
+//
 //  int i;
 //  if (fsArrayFindByName(fsArr, fs, &i))
 //    {
@@ -796,10 +797,10 @@ gint fsSortByNameCompareFunc(gconstpointer fs1_in, gconstpointer fs2_in)
 //    /* Remember the order we added them so we can sort by it again later. */
 //    orderNum++;
 //    fs->order = orderNum;
-//    
+//
 //    g_array_append_val(fsArr, *fs);
 //    //      g_array_sort(fsArr, fsSortByNameCompareFunc);
-//    
+//
 //    msp->fs = fs;
 //    }
 //}
@@ -810,10 +811,10 @@ gint fsSortByNameCompareFunc(gconstpointer fs1_in, gconstpointer fs2_in)
 MSP* mspArrayIdx(const GArray* const array, const int idx)
 {
   MSP *msp = NULL;
-  
+
   if (idx >= 0 && idx < (int)array->len)
     msp = g_array_index(array, MSP*, idx);
-  
+
   return msp;
 }
 
@@ -844,12 +845,12 @@ static int getNumPolyATailBasesToCheck()
 gboolean mspHasPolyATail(const MSP* const msp)
 {
   gboolean found = FALSE;
-  
+
   /* Only matches have polyA tails. */
   if (mspIsBlastMatch(msp))
     {
       const char *seq = mspGetMatchSeq(msp);
-      
+
       if (seq)
         {
           const int numRequired = getNumPolyATailBasesToCheck();
@@ -859,7 +860,7 @@ gboolean mspHasPolyATail(const MSP* const msp)
           BlxStrand qStrand = mspGetRefStrand(msp);
           int sCoord = mspGetSEnd(msp);
 
-          if (qStrand == sStrand) 
+          if (qStrand == sStrand)
             {
               ++sCoord; /* next coord after alignment block end */
               int sMax = mspGetSStart(msp);
@@ -885,7 +886,7 @@ gboolean mspHasPolyATail(const MSP* const msp)
             {
               --sCoord; /* next coord after alignment block end */
               int sMin = 1;
-              
+
               if (numRequired > 0)
                 sMin = sCoord - numRequired;
 
@@ -905,7 +906,7 @@ gboolean mspHasPolyATail(const MSP* const msp)
             }
         }
     }
-  
+
   return found;
 }
 
@@ -915,7 +916,7 @@ gboolean mspHasPolyATail(const MSP* const msp)
 gboolean mspCoordInPolyATail(const int coord, const MSP* const msp)
 {
   gboolean result = mspHasPolyATail(msp);
-  
+
   /* See if the coord is outside the 3' end of the alignment range (i.e. is greater than the
    * max coord if we're on the forward strand or less than the min coord if on the reverse). */
   //result &= ((mspGetRefStrand(msp) == BLXSTRAND_FORWARD && coord > msp->displayRange.max) ||
@@ -927,7 +928,7 @@ gboolean mspCoordInPolyATail(const int coord, const MSP* const msp)
 
 
 /***********************************************************
- *		      BlxSequence			   * 
+ *		      BlxSequence			   *
  ***********************************************************/
 
 /* Append the contents of the given text to the GString, if the text is non-null,
@@ -947,7 +948,7 @@ static void appendTextIfNonNull(GString *gstr, const char *separator, const char
 char* blxSequenceGetSummaryInfo(const BlxSequence* const blxSeq, GList *columnList)
 {
   char *result = NULL;
-  
+
   if (blxSeq)
     {
       GString *resultStr = g_string_new("");
@@ -960,7 +961,7 @@ char* blxSequenceGetSummaryInfo(const BlxSequence* const blxSeq, GList *columnLi
       for ( ; item; item = item->next)
         {
           BlxColumnInfo *columnInfo = (BlxColumnInfo*)(item->data);
-          
+
           if (columnInfo->showSummary)
             {
               const char *valueText = blxSequenceGetValueAsString(blxSeq, columnInfo->columnId);
@@ -975,10 +976,10 @@ char* blxSequenceGetSummaryInfo(const BlxSequence* const blxSeq, GList *columnLi
                 }
             }
         }
-      
+
       result = g_string_free(resultStr, FALSE);
     }
-  
+
   return result;
 }
 
@@ -987,41 +988,41 @@ char* blxSequenceGetSummaryInfo(const BlxSequence* const blxSeq, GList *columnLi
 const char *blxSequenceGetName(const BlxSequence *seq)
 {
   const char *result = NULL;
-  
+
   if (seq)
     {
       result = blxSequenceGetValueAsString(seq, BLXCOL_SEQNAME);
-      
+
       if (!result && seq->idTag)
         result = seq->idTag;
 
       if (!result)
         g_warning("Sequence does not have a name specified.\n");
     }
-  
+
   return result;
 }
 
 /* Return the Source text of a BlxSequence, if it has one (note that it gets
- * this from the first MSP and does no checking whether other MSPs have the 
+ * this from the first MSP and does no checking whether other MSPs have the
  * same source or not). */
 const char *blxSequenceGetSource(const BlxSequence *seq)
 {
   const char *result = NULL;
-  
+
   if (seq)
     result = blxSequenceGetValueAsString(seq, BLXCOL_SOURCE);
-  
+
   return result;
 }
 
 /* Return the fetch method of a BlxSequence. If 'bulk' is true,
  * get the bulk-fetch method, otherwise the user-fetch method.
  * 'index' indicates which method to choose if multiple methods
- * are available; 0 is the first (preferred) method, 1 the second 
- * etc. If no fetch method is set, return the given default method 
+ * are available; 0 is the first (preferred) method, 1 the second
+ * etc. If no fetch method is set, return the given default method
  * instead (for index==0 only). Pass 'defaultMethod' as 0 if N/A. */
-GQuark blxSequenceGetFetchMethod(const BlxSequence *seq, 
+GQuark blxSequenceGetFetchMethod(const BlxSequence *seq,
                                  const gboolean bulk,
                                  const gboolean optionalColumns,
                                  const int index,
@@ -1039,16 +1040,16 @@ GQuark blxSequenceGetFetchMethod(const BlxSequence *seq,
         array = seq->dataType->bulkFetch;
       else
         array = seq->dataType->userFetch;
-      
+
       if (array && index >= 0 && index < (int)array->len)
         result = g_array_index(array, GQuark, index);
     }
 
-  if (!result && defaultMethods && index >= 0 && index < (int)defaultMethods->len) 
+  if (!result && defaultMethods && index >= 0 && index < (int)defaultMethods->len)
     {
       result = g_array_index(defaultMethods, GQuark, index);
     }
-  
+
   return result;
 }
 
@@ -1056,7 +1057,7 @@ GQuark blxSequenceGetFetchMethod(const BlxSequence *seq,
 int blxSequenceGetLength(const BlxSequence *seq)
 {
   int result = 0;
-  
+
   if (seq)
     {
       const char *sequence = blxSequenceGetSequence(seq);
@@ -1064,7 +1065,7 @@ int blxSequenceGetLength(const BlxSequence *seq)
       if (sequence)
         result = strlen(sequence);
     }
-  
+
   return result;
 }
 
@@ -1106,9 +1107,9 @@ const char *blxSequenceGetSequence(const BlxSequence *seq)
  * (i.e. the actual dna or peptide sequence string) */
 gboolean blxSequenceRequiresSeqData(const BlxSequence *seq)
 {
-  return (seq && 
-          (seq->type == BLXSEQUENCE_MATCH || 
-           seq->type == BLXSEQUENCE_VARIATION || 
+  return (seq &&
+          (seq->type == BLXSEQUENCE_MATCH ||
+           seq->type == BLXSEQUENCE_VARIATION ||
            seq->type == BLXSEQUENCE_REGION));
 }
 
@@ -1138,7 +1139,7 @@ gboolean blxSequenceRequiresColumnData(const BlxSequence *seq, const BlxColumnId
           result = blxSequenceRequiresSeqData(seq);
         }
     }
-  
+
   return result;
 }
 
@@ -1146,7 +1147,7 @@ gboolean blxSequenceRequiresColumnData(const BlxSequence *seq, const BlxColumnId
 GValue* blxSequenceGetValue(const BlxSequence *seq, const int columnId)
 {
   GValue *result = NULL;
-  
+
   if (seq && seq->values && columnId < (int)seq->values->len)
     result = &g_array_index(seq->values, GValue, columnId);
 
@@ -1227,7 +1228,7 @@ void blxSequenceSetValueFromString(const BlxSequence *seq, const int columnId, c
 const char* blxSequenceGetValueAsString(const BlxSequence *seq, const int columnId)
 {
   const char *result = NULL;
-  
+
   GValue *value = blxSequenceGetValue(seq, columnId);
 
   if (value)
@@ -1239,7 +1240,7 @@ const char* blxSequenceGetValueAsString(const BlxSequence *seq, const int column
       else if (G_VALUE_HOLDS_DOUBLE(value))
         result = convertDoubleToString(g_value_get_double(value), 2);
     }
-  
+
   /* Return null if it's an empty value (i.e. if it's unset) */
   if (result && *result == 0)
     result = NULL;
@@ -1254,12 +1255,12 @@ const char* blxSequenceGetColumn(const BlxSequence* const blxSeq, const BlxColum
   const char *result = NULL;
 
   GValue *value = blxSequenceGetValue(blxSeq, columnId);
-    
+
   if (value && G_VALUE_HOLDS_STRING(value))
     {
       result = g_value_get_string(value);
     }
-  
+
   return result;
 }
 
@@ -1295,23 +1296,23 @@ const char *blxSequenceGetStrain(const BlxSequence *seq)
 char *blxSequenceGetFasta(const BlxSequence *seq)
 {
   char *result = NULL;
-  
+
   if (seq)
     {
       const char *name = blxSequenceGetName(seq);
       const char *sequence = blxSequenceGetSequence(seq);
-      
+
       if (name && sequence)
         {
           result = g_strdup_printf(">%s\n%s", name, sequence);
         }
     }
-  
+
   return result;
 }
 
 
-/* Return all the stored info about a blx sequenece (description, organism, tissue type etc.) 
+/* Return all the stored info about a blx sequenece (description, organism, tissue type etc.)
  * in a single string. The result should be free'd by the caller using g_free. If 'allowNewlines'
  * is true the data is separated with newline characters, otherwise with tabs (i.e. pass as false
  * if returned string is to be shown as a single line). The dataLoaded flag should be passed as
@@ -1319,7 +1320,7 @@ char *blxSequenceGetFasta(const BlxSequence *seq)
 char *blxSequenceGetInfo(BlxSequence *blxSeq, const gboolean allowNewlines, GList *columnList)
 {
   char *result = NULL;
-  
+
   if (blxSeq)
     {
       GString *resultStr = g_string_new("");
@@ -1333,40 +1334,40 @@ char *blxSequenceGetInfo(BlxSequence *blxSeq, const gboolean allowNewlines, GLis
       for ( ; item; item = item->next)
         {
           BlxColumnInfo *columnInfo = (BlxColumnInfo*)(item->data);
-          
+
           const char *valueText = blxSequenceGetValueAsString(blxSeq, columnInfo->columnId);
           const char *text = valueText ? valueText : "";
-              
+
           if (columnInfo->columnId == BLXCOL_SEQNAME)
             g_string_append_printf(resultStr, "%-*s  %s%c%c", titleWidth, columnInfo->title, text, strand, separator);
           else
             g_string_append_printf(resultStr, "%-*s  %s%c", titleWidth, columnInfo->title, text, separator);
         }
-      
+
       /* Loop through the child features and show their coords */
       const char *title = "Coords";
       g_string_append_printf(resultStr, "%-*s  ", titleWidth, title);
       GList *mspItem = blxSeq->mspList;
-      
+
       for ( ; mspItem; mspItem = mspItem->next)
         {
           const MSP* const msp = (const MSP*)(mspItem->data);
-          
+
           /* Don't show 'exon' msps because we show the exon's
            * individual 'cds' and 'utr' instead */
           if (msp->type != BLXMSP_EXON)
             {
               char *coordsStr = mspGetCoordsAsString(msp);
               g_string_append_printf(resultStr, "%s  ", coordsStr ? coordsStr : "");
-              
+
               if (coordsStr)
                 g_free(coordsStr);
             }
         }
-      
+
       result = g_string_free(resultStr, FALSE);
     }
-  
+
   return result;
 }
 
@@ -1375,51 +1376,51 @@ static BlxSequence* blxSequenceFindByName(const char *name, GList *allSeqs)
 {
   BlxSequence *result = NULL;
   GList *listItem = allSeqs;
-  
+
   for ( ; listItem; listItem = listItem->next)
     {
       BlxSequence *curSeq = (BlxSequence*)(listItem->data);
       const char *curName = blxSequenceGetName(curSeq);
-    
+
       if (name && stringsEqual(curName, name, FALSE))
         {
           result = curSeq;
           break;
         }
     }
-  
+
   return result;
 }
 
 
 /* Get the "parent" sequence of the given protein variant. Assumes the variant
- * contains a dash '-' in the name followed by the variant number as a digit. 
+ * contains a dash '-' in the name followed by the variant number as a digit.
  * e.g. SW:P51531-2.2. The function looks for a sequence with the same name but
  * with this dash and the following digit(s) (up to the end of the name or the '.'
  * if there is one) removed. Returns NULL if no parent was found. */
 BlxSequence* blxSequenceGetVariantParent(const BlxSequence *variant, GList *allSeqs)
 {
   BlxSequence *result = NULL;
-  
+
   const char *variantName = blxSequenceGetName(variant);
-  
+
   if (variantName)
     {
       char *parentName = g_strdup(variantName);
       char *insertPoint = strchr(parentName, '-');
-      
+
       if (insertPoint)
         {
           /* Replace '-' by terminating char, in case there's nothing else to copy in. */
           *insertPoint = '\0';
-          
+
           /* The insert point is where we'll copy into. Create another pointer that we'll increment
            * until we find a '.' and then we'll copy from that point. */
           char *copyPoint = insertPoint;
           ++copyPoint;
-          
+
           gboolean foundRestartPoint = FALSE; /* set to true when we find where to start copying from again */
-          
+
           while (copyPoint && *copyPoint != '\0')
             {
               if (foundRestartPoint)
@@ -1433,17 +1434,17 @@ BlxSequence* blxSequenceGetVariantParent(const BlxSequence *variant, GList *allS
                   *insertPoint = *copyPoint;
                   ++insertPoint;
                 }
-          
+
               ++copyPoint;
             }
-        
+
           *insertPoint = '\0';
-        
+
           result = blxSequenceFindByName(parentName, allSeqs);
           g_free(parentName);
         }
     }
-  
+
   return result;
 }
 
@@ -1452,13 +1453,13 @@ BlxSequence* blxSequenceGetVariantParent(const BlxSequence *variant, GList *allS
 void destroyBlxSequenceList(GList **seqList)
 {
   GList *seqItem = *seqList;
-  
+
   for ( ; seqItem; seqItem = seqItem->next)
     {
       BlxSequence *blxSeq = (BlxSequence*)(seqItem->data);
       destroyBlxSequence(blxSeq);
     }
-  
+
   g_list_free(*seqList);
   *seqList = NULL;
 }
@@ -1472,7 +1473,7 @@ void destroyBlxSequence(BlxSequence *seq)
       if (seq->values)
         {
           /* Free all column values */
-          int i = 0;      
+          int i = 0;
           for ( ; i < (int)seq->values->len; ++i)
             {
               GValue *value = &g_array_index(seq->values, GValue, i);
@@ -1482,7 +1483,7 @@ void destroyBlxSequence(BlxSequence *seq)
 
       if (seq->idTag)
         g_free(seq->idTag);
-          
+
       delete seq;
     }
 }
@@ -1497,7 +1498,7 @@ static void destroyMspFull(MSP *msp, BlxSequence *seq, GArray *featureLists[], M
   for ( ; i < array->len; ++i)
     {
       MSP *curMsp = g_array_index(array, MSP*, i);
-      
+
       if (curMsp == msp)
         {
           array = g_array_remove_index(array, i);
@@ -1505,7 +1506,7 @@ static void destroyMspFull(MSP *msp, BlxSequence *seq, GArray *featureLists[], M
         }
     }
   featureLists[msp->type] = array;
-  
+
   /* Remove from mspList */
   MSP *curMsp = *mspList;
   MSP *prevMsp = NULL;
@@ -1515,18 +1516,18 @@ static void destroyMspFull(MSP *msp, BlxSequence *seq, GArray *featureLists[], M
         {
           if (!prevMsp)
             *mspList = curMsp->next; /* Remove msp from start of list */
-          else 
+          else
             prevMsp->next = curMsp->next; /* Remove link to msp */
-          
+
           if (*lastMsp == msp)
             *lastMsp = prevMsp;  /* Update pointer to last msp */
 
           break;
         }
-      
+
       prevMsp = curMsp;
     }
-  
+
   /* Remove from the BlxSequence, if given */
   if (seq && seq->mspList)
     {
@@ -1552,7 +1553,7 @@ static void destroyBlxSequenceFull(BlxSequence *seq, GArray *featureLists[], MSP
 {
   /* destroy each msp */
   GList *mspItem = seq->mspList;
-  
+
   for ( ; mspItem; mspItem = mspItem->next)
     {
       MSP *msp = (MSP*)(mspItem->data);
@@ -1575,7 +1576,7 @@ void blxSequenceSetColumn(BlxSequence *seq, const char *colName, const char *val
 {
   if (!colName || !value)
     return;
-  
+
   gboolean found = FALSE;
 
   /* Loop through the column list and find the one with this name */
@@ -1583,14 +1584,14 @@ void blxSequenceSetColumn(BlxSequence *seq, const char *colName, const char *val
   for ( ; item && !found; item = item->next)
     {
       BlxColumnInfo *columnInfo = (BlxColumnInfo*)(item->data);
-      
+
       if (stringsEqual(colName, columnInfo->title, FALSE))
         {
           blxSequenceSetValueFromString(seq, columnInfo->columnId, value);
           found = TRUE;
         }
     }
-  
+
   if (!found)
     g_warning("Unrecognised column '%s'\n", colName);
 }
@@ -1600,7 +1601,7 @@ void blxSequenceSetColumn(BlxSequence *seq, const char *colName, const char *val
 BlxSequence* createEmptyBlxSequence()
 {
   BlxSequence *seq = new BlxSequence;
-  
+
   seq->type = BLXSEQUENCE_UNSET;
   seq->dataType = NULL;
   seq->idTag = NULL;
@@ -1615,18 +1616,18 @@ BlxSequence* createEmptyBlxSequence()
 
 /* Copies all fields in a sequence. Copies all MSPs apart from CDSs whose name does not match the
  * given quark */
-static void copyBlxSequenceNamedCds(const BlxSequence *src, 
+static void copyBlxSequenceNamedCds(const BlxSequence *src,
                                     const GQuark cdsQuark,
-                                    GArray *featureLists[], 
-                                    MSP **lastMsp, 
+                                    GArray *featureLists[],
+                                    MSP **lastMsp,
                                     MSP **mspList,
                                     GList **seqList,
                                     GList *columnList,
-                                    GHashTable *lookupTable, 
+                                    GHashTable *lookupTable,
                                     GError **error)
 {
   GError *tmpError = NULL;
-  
+
   /* We must give the new BlxSequence a unique id - use the cds name */
   const char *idTag = g_quark_to_string(cdsQuark);
 
@@ -1634,22 +1635,22 @@ static void copyBlxSequenceNamedCds(const BlxSequence *src,
   const char *source = blxSequenceGetSource(src);
   const BlxStrand sStrand = src->strand;
   BlxDataType *dataType = src->dataType;
-  
+
   /* Copy all MSPs except CDSs whose name does not match cdsQuark */
   GList *mspItem = src->mspList;
-  
+
   for ( ; mspItem && !tmpError; mspItem = mspItem->next)
     {
       const MSP* msp = (const MSP*)(mspItem->data);
-      
+
       if (msp->type != BLXMSP_CDS || g_quark_from_string(msp->sname) == cdsQuark)
         {
           MSP *newMsp = copyMsp(msp, featureLists, lastMsp, mspList, FALSE, FALSE);
 
           /* Add the new msp to the new blx sequence (this creates it if it does not exist
            * i.e. the first time we get here for this idTag) */
-          addBlxSequence(newMsp->sname, newMsp->sname_orig, idTag, sStrand, dataType, 
-                         source, seqList, columnList, 
+          addBlxSequence(newMsp->sname, newMsp->sname_orig, idTag, sStrand, dataType,
+                         source, seqList, columnList,
                          NULL, newMsp, lookupTable, NULL, &tmpError);
         }
     }
@@ -1662,7 +1663,7 @@ static void copyBlxSequenceNamedCds(const BlxSequence *src,
 BlxDataType* createBlxDataType()
 {
   BlxDataType *result = new BlxDataType;
-  
+
   result->name = 0;
   result->bulkFetch = NULL;
   result->userFetch = NULL;
@@ -1673,7 +1674,7 @@ BlxDataType* createBlxDataType()
     {
       result->flags[flag] = FALSE;
     }
-  
+
   /* Set any specific flags that we want to be true by default */
   result->flags[MSPFLAG_SQUASH_LINKED_FEATURES] = TRUE;
   result->flags[MSPFLAG_STRAND_SPECIFIC] = TRUE;
@@ -1686,7 +1687,7 @@ void destroyBlxDataType(BlxDataType **blxDataType)
 {
   if (!blxDataType)
     return;
-  
+
   delete *blxDataType;
   *blxDataType = NULL;
 }
@@ -1702,7 +1703,7 @@ const char* getDataTypeName(BlxDataType *blxDataType)
 static gint compareMsps(const MSP* const msp1, const MSP* const msp2)
 {
   gint result = 0;
-  
+
   if (result == 0)
     {
       if (msp1->qRange.min() == msp2->qRange.min())
@@ -1710,7 +1711,7 @@ static gint compareMsps(const MSP* const msp1, const MSP* const msp2)
           /* Sort by type. Lower type numbers should appear first. */
           result = msp2->type - msp1->type;
         }
-      else 
+      else
         {
           result = msp1->qRange.min() -  msp2->qRange.min();
         }
@@ -1720,7 +1721,7 @@ static gint compareMsps(const MSP* const msp1, const MSP* const msp2)
 }
 
 /* Compare the start position in the ref seq of two MSPs. Returns a negative value if a < b; zero
- * if a = b; positive value if a > b. Secondarily sorts by type in the order that types appear in 
+ * if a = b; positive value if a > b. Secondarily sorts by type in the order that types appear in
  * the BlxMspType enum. Note that this sorts first by strand. */
 gint compareFuncMspPos(gconstpointer a, gconstpointer b)
 {
@@ -1731,7 +1732,7 @@ gint compareFuncMspPos(gconstpointer a, gconstpointer b)
 
   /* First, sort by strand */
   result = (int)msp1->qStrand - (int)msp2->qStrand;
-  
+
   if (!result)
     result = compareMsps(msp1, msp2);
 
@@ -1739,9 +1740,9 @@ gint compareFuncMspPos(gconstpointer a, gconstpointer b)
 }
 
 
-/* Same as compareFuncMspPos but accepts pointers to MSP pointers (which is 
+/* Same as compareFuncMspPos but accepts pointers to MSP pointers (which is
  * what the GArray of MSPs holds). Note that this does NOT sort first by strand,
- * unlike compareFuncMspPos. This is important for the detail-view filtering 
+ * unlike compareFuncMspPos. This is important for the detail-view filtering
  * functions. */
 gint compareFuncMspArray(gconstpointer a, gconstpointer b)
 {
@@ -1755,7 +1756,7 @@ gint compareFuncMspArray(gconstpointer a, gconstpointer b)
 /* returns true if the given msp should be output when piping features to dotter */
 static gboolean outputMsp(const MSP* const msp, IntRange *range1, IntRange *range2)
 {
-  return ((msp->type == BLXMSP_FS_SEG || mspIsBoxFeature(msp) || mspIsIntron(msp) || mspIsBlastMatch(msp)) && 
+  return ((msp->type == BLXMSP_FS_SEG || mspIsBoxFeature(msp) || mspIsIntron(msp) || mspIsBlastMatch(msp)) &&
           (rangesOverlap(&msp->qRange, range1) || rangesOverlap(&msp->qRange, range2))
          );
 }
@@ -1765,24 +1766,24 @@ static gboolean outputMsp(const MSP* const msp, IntRange *range1, IntRange *rang
 static int countMspsToOutput(const BlxSequence* const blxSeq, IntRange *range1, IntRange *range2)
 {
   int numMsps = 0;
-  
+
   GList *mspItem = blxSeq->mspList;
   for ( ; mspItem; mspItem = mspItem->next)
     {
       const MSP* const msp = (const MSP*)(mspItem->data);
-      
+
       if (outputMsp(msp, range1, range2))
         ++numMsps;
     }
-  
+
   return numMsps;
 }
 
 
 /* write data for the given transcript to the given output pipe. */
 void writeTranscriptToOutput(GIOChannel *ioChannel,
-                             const BlxSequence* const blxSeq, 
-                             IntRange *range, 
+                             const BlxSequence* const blxSeq,
+                             IntRange *range,
                              const IntRange* const refSeqRange,
                              GError **error)
 {
@@ -1795,7 +1796,7 @@ void writeTranscriptToOutput(GIOChannel *ioChannel,
   for ( ; mspItem; mspItem = mspItem->next)
     {
       const MSP* msp = (const MSP*)(mspItem->data);
-      
+
       /* Only output exons. Also, if an exon has child msps then ignore it and only output the children */
       if (mspIsBoxFeature(msp) && !msp->childMsps)
         {
@@ -1824,17 +1825,17 @@ void writeTranscriptToOutput(GIOChannel *ioChannel,
   const char* transcriptName = blxSequenceGetName(blxSeq);
   stringProtect(ioChannel, transcriptName, &tmpError);
   stringProtect(ioChannel, blxSeq->idTag, &tmpError);
-      
+
   if (!tmpError)
     g_io_channel_write_unichar(ioChannel, '\n', &tmpError);
-  
+
   mspItem = blxSeq->mspList;
   int i = 0; /* keeps track of current transcript coord */
-  
+
   for ( ; mspItem && !tmpError; mspItem = mspItem->next)
     {
       const MSP* msp = (const MSP*)(mspItem->data);
-      
+
       /* Only output exons. Also, if an exon has child msps then ignore it: we will come across
        * the child msps themselves in the list so we don't want to output both the parent and the
        * child msps. */
@@ -1847,12 +1848,12 @@ void writeTranscriptToOutput(GIOChannel *ioChannel,
               const int start = i + 1;
               const int end = start + msp->qRange.length() - 1;
 
-              char *tmpStr = g_strdup_printf("%d %f %f %d %d %d %d %d %d %d", 
+              char *tmpStr = g_strdup_printf("%d %f %f %d %d %d %d %d %d %d",
                                              msp->type,
-                                             msp->score, 
+                                             msp->score,
                                              msp->id,
                                              msp->phase,
-                                             //          msp->fsColor, 
+                                             //          msp->fsColor,
                                              start,
                                              end,
                                              msp->sRange.min(),
@@ -1884,16 +1885,16 @@ void writeTranscriptToOutput(GIOChannel *ioChannel,
 
 /* write data from the given blxsequence to the given output pipe. if the ranges
  * are given, only outputs blxsequences that overlap either range */
-void writeBlxSequenceToOutput(GIOChannel *ioChannel, const BlxSequence *blxSeq, 
-                              IntRange *range1, IntRange *range2, 
+void writeBlxSequenceToOutput(GIOChannel *ioChannel, const BlxSequence *blxSeq,
+                              IntRange *range1, IntRange *range2,
                               GError **error)
 {
   GError *tmpError = NULL;
   gboolean outputSeq = (blxSeq && (blxSeq->type == BLXSEQUENCE_TRANSCRIPT || blxSeq->type == BLXSEQUENCE_MATCH));
-  
+
   int numMsps = countMspsToOutput(blxSeq, range1, range2);
   outputSeq &= numMsps > 0; /* only output the sequence if it has some valid msps */
-  
+
   if (outputSeq)
     {
       char *tmpStr = g_strdup_printf("%d %d %d",
@@ -1908,13 +1909,13 @@ void writeBlxSequenceToOutput(GIOChannel *ioChannel, const BlxSequence *blxSeq,
 
       if (!tmpError)
         g_io_channel_write_unichar(ioChannel, '\n', &tmpError);
-      
+
       /* now output the msps */
       GList *mspItem = blxSeq->mspList;
       for ( ; mspItem && !tmpError; mspItem = mspItem->next)
         {
           const MSP* const msp = (const MSP*)(mspItem->data);
-          
+
           if (outputMsp(msp, range1, range2))
             {
               writeMspToOutput(ioChannel, msp, &tmpError);
@@ -1941,19 +1942,19 @@ BlxSequence* readBlxSequenceFromText(char *text, int *numMsps)
   DEBUG_ENTER("readBlxSequenceFromText(text=%s)", text);
 
   char *curChar = text;
-  
+
   GError *error = NULL;
   BlxSequence *blxSeq = createEmptyBlxSequence();
-  
+
   if (error)
     {
       reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
       DEBUG_EXIT("readBlxSequenceFromText returning NULL");
       return NULL;
     }
-  
+
   nextChar(&curChar);
-  
+
   blxSeq->type = (BlxSequenceType)strtol(curChar, &curChar, 10);
   nextChar(&curChar);
 
@@ -1962,13 +1963,13 @@ BlxSequence* readBlxSequenceFromText(char *text, int *numMsps)
 
   *numMsps = strtol(curChar, &curChar, 10);
   nextChar(&curChar);
-  
+
   char *fullName = stringUnprotect(&curChar, NULL);
   blxSequenceSetValueFromString(blxSeq, BLXCOL_SEQNAME, fullName);
   g_free(fullName);
 
   blxSeq->idTag = stringUnprotect(&curChar, NULL);
-  
+
   DEBUG_EXIT("readBlxSequenceFromText returning numMsps=%d", *numMsps);
   return blxSeq;
 }
@@ -1979,12 +1980,12 @@ void writeMspToOutput(GIOChannel *ioChannel, const MSP* const msp, GError **erro
 {
   GError *tmpError = NULL;
 
-  char *tmpStr = g_strdup_printf("%d %f %f %d %d %d %d %d %d %d", 
+  char *tmpStr = g_strdup_printf("%d %f %f %d %d %d %d %d %d %d",
                                  msp->type,
-                                 msp->score, 
+                                 msp->score,
                                  msp->id,
                                  msp->phase,
-                                 //          msp->fsColor, 
+                                 //          msp->fsColor,
                                  msp->qRange.min(),
                                  msp->qRange.max(),
                                  msp->sRange.min(),
@@ -2031,18 +2032,18 @@ void readMspFromText(MSP *msp, char *text)
 
   /* ref seq range */
   nextChar(&curChar);
-  const int qStart = strtol(curChar, &curChar, 10); 
+  const int qStart = strtol(curChar, &curChar, 10);
   nextChar(&curChar);
-  const int qEnd = strtol(curChar, &curChar, 10); 
+  const int qEnd = strtol(curChar, &curChar, 10);
   msp->qRange.set(qStart, qEnd);
 
   /* match seq range */
   nextChar(&curChar);
-  const int sStart = strtol(curChar, &curChar, 10); 
+  const int sStart = strtol(curChar, &curChar, 10);
   nextChar(&curChar);
-  const int sEnd = strtol(curChar, &curChar, 10); 
+  const int sEnd = strtol(curChar, &curChar, 10);
   msp->sRange.set(sStart, sEnd);
-  
+
   nextChar(&curChar);
   msp->qStrand = (BlxStrand)strtol(curChar, &curChar, 10);
 
@@ -2062,18 +2063,18 @@ void readMspFromText(MSP *msp, char *text)
 static void insertMsp(MSP *msp, MSP **mspList, MSP **lastMsp)
 {
   /* Add it to the list */
-  if (!*mspList) 
+  if (!*mspList)
     {
       /* Nothing in list yet: make this the first entry */
       *mspList = msp;
     }
-  
+
   if (*lastMsp)
     {
       /* Tag it on to the end of the list */
       (*lastMsp)->next = msp;
     }
-  
+
   /* Make the 'lastMsp' pointer point to the new end of the list */
   *lastMsp = msp;
 }
@@ -2086,37 +2087,37 @@ static void insertMsp(MSP *msp, MSP **mspList, MSP **lastMsp)
 MSP* createEmptyMsp(MSP **lastMsp, MSP **mspList)
 {
   MSP *msp = new MSP;
-  
+
   int i = 0;
   for ( ; i < BLXMODEL_NUM_MODELS; ++i)
     msp->treePaths[i] = NULL;
 
   msp->next = NULL;
   msp->childMsps = NULL;
-  
+
   msp->type = BLXMSP_INVALID;
   msp->score = 0.0;
   msp->id = 0.0;
   msp->phase = 0;
-  
+
   msp->qname = NULL;
   msp->qFrame = UNSET_INT;
-  
+
   msp->sSequence = NULL;
   msp->sname = msp->sname_orig = NULL;
-  
+
   msp->desc = NULL;
-  
+
   msp->style = NULL;
-  
+
   msp->fs = NULL;
   msp->fsShape = BLXCURVE_BADSHAPE;
-  
+
   msp->xy = NULL;
   msp->gaps = NULL;
-  
+
   insertMsp(msp, mspList, lastMsp);
-  
+
   return msp;
 }
 
@@ -2140,7 +2141,7 @@ void destroyMspList(MSP **mspList)
     {
       destroyMspData(msp);
     }
-  
+
   /* Now free the MSPs themselves. */
   MSP *fmsp = NULL;
   for (msp = *mspList; msp; )
@@ -2149,9 +2150,9 @@ void destroyMspList(MSP **mspList)
       msp = msp->next;
       delete fmsp;
     }
-  
+
   *mspList = NULL;
-  
+
   return ;
 }
 
@@ -2163,7 +2164,7 @@ void destroyMspData(MSP *msp)
   freeStringPointer(&msp->sname);
   freeStringPointer(&msp->sname_orig);
   freeStringPointer(&msp->desc);
-  
+
   if (msp->gaps)
     {
       /* free the child msp list */
@@ -2180,11 +2181,11 @@ void destroyMspData(MSP *msp)
           CoordRange *range = (CoordRange*)(item->data);
           delete range;
         }
-      
+
       g_slist_free(msp->gaps);
       msp->gaps = NULL;
     }
-  
+
   if (msp->xy)
     {
       g_array_free(msp->xy, TRUE);
@@ -2198,10 +2199,10 @@ void destroyMspData(MSP *msp)
  * ('lastMsp') point to the new end of the list. We will hopefully get rid of mspList eventually
  * and replace it by featureLists. The new msp is added to the relevant list in the featureLists
  * array according to its type. Returns a pointer to the newly-created MSP. Also creates a BlxSequence
- * for this MSP's sequence name (or adds the MSP to the existing one, if it exists already), 
+ * for this MSP's sequence name (or adds the MSP to the existing one, if it exists already),
  * and adds that BlxSequence to the given seqList. Takes ownership of 'sequence'. */
 MSP* createNewMsp(GArray* featureLists[],
-                  MSP **lastMsp, 
+                  MSP **lastMsp,
                   MSP **mspList,
                   GList **seqList,
                   GList *columnList,
@@ -2224,50 +2225,50 @@ MSP* createNewMsp(GArray* featureLists[],
                   BlxStrand sStrand,
                   char *sequence,
                   const GQuark filename,
-                  GHashTable *lookupTable, 
+                  GHashTable *lookupTable,
                   BlxSequence *blxSeq,
                   GError **error)
 {
   MSP *msp = createEmptyMsp(lastMsp, mspList);
-  
+
   msp->type = mspType;
-  msp->score = score; 
-  msp->id = percentId; 
+  msp->score = score;
+  msp->id = percentId;
   msp->phase = phase;
   msp->filename = filename;
-  
+
   msp->qname = qName ? g_strdup(qName) : NULL;
-  
+
   msp->qFrame = qFrame;
   msp->qStrand = qStrand;
-  
+
   msp->sname = sName ? g_strdup(sName) : NULL;
   msp->sname_orig = sName_orig ? g_strdup(sName_orig) : NULL;
 
-  
-  msp->qRange.set(qStart, qEnd);  
+
+  msp->qRange.set(qStart, qEnd);
   msp->sRange.set(sStart, sEnd);
 
   /* For exons, introns and basic features, the s strand is not applicable. We always want the exon
-   * to be in the same direction as the ref sequence, so set the match seq strand to be 
+   * to be in the same direction as the ref sequence, so set the match seq strand to be
    * the same as the ref seq strand */
   if (mspIsBoxFeature(msp) || mspIsIntron(msp))
     {
       sStrand = qStrand;
     }
-  
+
   /* Add it to the relevant feature list. */
   featureLists[msp->type] = g_array_append_val(featureLists[msp->type], msp);
 
   /* For main feature types, add a new (or add to an existing) BlxSequence */
   if (typeIsBasic(mspType) ||
-      typeIsExon(mspType) || 
-      typeIsIntron(mspType) || 
-      typeIsMatch(mspType) || 
-      typeIsVariation(mspType) || 
+      typeIsExon(mspType) ||
+      typeIsIntron(mspType) ||
+      typeIsMatch(mspType) ||
+      typeIsVariation(mspType) ||
       typeIsRegion(mspType))
     {
-      addBlxSequences(msp->sname, msp->sname_orig, idTag, sStrand, dataType, source, 
+      addBlxSequences(msp->sname, msp->sname_orig, idTag, sStrand, dataType, source,
                       featureLists, lastMsp, mspList, seqList,
                       columnList, sequence, msp, lookupTable, blxSeq, error);
     }
@@ -2277,7 +2278,7 @@ MSP* createNewMsp(GArray* featureLists[],
       prefixError(*error, "Error creating MSP (ref seq='%s' [%d - %d], match seq = '%s' [%d - %d]). ",
                   qName, qStart, qEnd, sName, sStart, sEnd);
     }
-  
+
   return msp;
 }
 
@@ -2288,30 +2289,30 @@ MSP* createNewMsp(GArray* featureLists[],
  * if 'sort' is false (this is to avoid having to sort it every time if the caller intends to
  * re-sort the list later anyway) */
 MSP* copyMsp(const MSP* const src,
-             GArray* featureLists[],             
-             MSP **lastMsp, 
+             GArray* featureLists[],
+             MSP **lastMsp,
              MSP **mspList,
              const gboolean addToParent,
              const gboolean sort)
 {
   MSP *msp = createEmptyMsp(lastMsp, mspList);
-  
+
   msp->type = src->type;
-  msp->score = UNSET_INT; 
-  msp->id = UNSET_INT; 
+  msp->score = UNSET_INT;
+  msp->id = UNSET_INT;
   msp->phase = src->phase;
-  
+
   msp->qname = src->qname ? g_strdup(src->qname) : NULL;
-  
+
   msp->qFrame = src->qFrame;
   msp->qStrand = src->qStrand;
-  
+
   msp->sname = src->sname ? g_strdup(src->sname) : NULL;
   msp->sname_orig = src->sname_orig ? g_strdup(src->sname_orig) : NULL;
-  
-  msp->qRange.set(src->qRange);  
+
+  msp->qRange.set(src->qRange);
   msp->sRange.set(src->sRange);
-  
+
   /* For matches, exons and introns, add (or add to if already exists) a BlxSequence */
   if (addToParent && src->sSequence)
     {
@@ -2325,7 +2326,7 @@ MSP* copyMsp(const MSP* const src,
 
   /* Add it to the relevant feature list. */
   featureLists[msp->type] = g_array_append_val(featureLists[msp->type], msp);
-  
+
   return msp;
 }
 
@@ -2335,9 +2336,9 @@ MSP* copyMsp(const MSP* const src,
  * (and frees it if exon is null).
  * Exons and UTRs don't have phase, but we want to display them in the same reading frame
  * as the CDS in the same exon, if there is one; this function copies it to its siblings. */
-static void setExonChildList(MSP *exon, 
+static void setExonChildList(MSP *exon,
                              GList *childList,
-                             GArray* featureLists[], 
+                             GArray* featureLists[],
                              MSP **lastMsp,
                              MSP **mspList,
                              GList **seqList,
@@ -2354,20 +2355,20 @@ static void setExonChildList(MSP *exon,
   /* Take ownership of the child list */
   if (exon->childMsps)
     g_list_free(exon->childMsps);
-  
+
   exon->childMsps = childList;
-  
+
   /* Loop through and see if there's a CDS */
   GError *tmpError = NULL;
   int frame = UNSET_INT;
   int phase = UNSET_INT;
   gboolean found = FALSE;
-  
+
   GList *childItem = exon->childMsps;
   for ( ; childItem; childItem = childItem->next)
     {
       MSP *cds = (MSP*)(childItem->data);
-      
+
       if (cds->type == BLXMSP_CDS)
         {
           frame = cds->qFrame;
@@ -2384,7 +2385,7 @@ static void setExonChildList(MSP *exon,
               /* Replace the original cds with a new one truncated to this exon */
               int start = max(cds->qRange.min(), exon->qRange.min());
               int end = min(cds->qRange.max(), exon->qRange.max());
-              MSP *newCds = createMissingMsp(BLXMSP_CDS, start, end, cds->qname, cds->qFrame, cds->style, cds->sSequence, 
+              MSP *newCds = createMissingMsp(BLXMSP_CDS, start, end, cds->qname, cds->qFrame, cds->style, cds->sSequence,
                                              featureLists, lastMsp, mspList, seqList, columnList, lookupTable, &tmpError);
               reportAndClearIfError(&tmpError, G_LOG_LEVEL_WARNING);
 
@@ -2396,13 +2397,13 @@ static void setExonChildList(MSP *exon,
           break;
         }
     }
-  
+
   if (found)
     {
       /* Update the exon */
       exon->qFrame = frame;
       exon->phase = phase;
-      
+
       /* Loop through and update the other msps (i.e. exon and UTR get the same frame/phase info
          as the CDS) */
       for (childItem = exon->childMsps; childItem; childItem = childItem->next)
@@ -2422,40 +2423,40 @@ static MSP* createMissingMsp(const BlxMspType newType,
                              const char *qname,
                              const int newFrame,
                              BlxStyle *newStyle,
-                             BlxSequence *blxSeq, 
-                             GArray* featureLists[], 
-                             MSP **lastMsp, 
-                             MSP **mspList, 
+                             BlxSequence *blxSeq,
+                             GArray* featureLists[],
+                             MSP **lastMsp,
+                             MSP **mspList,
                              GList **seqList,
                              GList *columnList,
                              GHashTable *lookupTable,
                              GError **error)
 {
   MSP *result = NULL;
-  
+
   if (newType != BLXMSP_INVALID)
     {
       /* Create the new exon/cds/utr */
       DEBUG_OUT("Creating MSP for transcript '%s' of type %d.\n", blxSequenceGetName(blxSeq), newType);
-      
+
       GError *tmpError = NULL;
-      
+
       result = createNewMsp(featureLists, lastMsp, mspList, seqList, columnList, newType, NULL, blxSequenceGetSource(blxSeq),
                             UNSET_INT, UNSET_INT, UNSET_INT, blxSeq->idTag,
                             qname, newStart, newEnd, blxSeq->strand, newFrame,
                             blxSequenceGetName(blxSeq), blxSequenceGetName(blxSeq),
                             UNSET_INT, UNSET_INT, blxSeq->strand, NULL,
                             0, lookupTable, blxSeq, &tmpError);
-      
+
       result->style = newStyle;
-      
+
       if (tmpError)
         {
           prefixError(tmpError, "Error constructing missing exon/cds/utr [type='%d']", newType);
           g_propagate_error(error, tmpError);
         }
     }
-  
+
   return result;
 }
 
@@ -2464,18 +2465,18 @@ static MSP* createMissingMsp(const BlxMspType newType,
  * at the startor end of the exon and, if so, construct a CDS/UTR to fill it. */
 static void createMissingCdsUtr(MSP *exon,
                                 GList **childList,
-                                BlxSequence *blxSeq, 
-                                GArray* featureLists[], 
-                                MSP **lastMsp, 
-                                MSP **mspList, 
-                                GList **seqList, 
+                                BlxSequence *blxSeq,
+                                GArray* featureLists[],
+                                MSP **lastMsp,
+                                MSP **mspList,
+                                GList **seqList,
                                 GList *columnList,
                                 GHashTable *lookupTable,
                                 GError **error)
 {
   MSP *startMsp = (MSP*)(g_list_first(*childList)->data);
   MSP *endMsp = (MSP*)(g_list_last(*childList)->data);
-  
+
   if (exon->qRange.min() < startMsp->qRange.min())
     {
       const BlxMspType type = (startMsp->type == BLXMSP_CDS ? BLXMSP_UTR : BLXMSP_CDS);
@@ -2495,11 +2496,11 @@ static void createMissingCdsUtr(MSP *exon,
 /* Create a UTR that spans the given exon, and add it to the given childList */
 static void createMissingUtr(MSP *exon,
                              GList **childList,
-                             BlxSequence *blxSeq, 
-                             GArray* featureLists[], 
-                             MSP **lastMsp, 
-                             MSP **mspList, 
-                             GList **seqList, 
+                             BlxSequence *blxSeq,
+                             GArray* featureLists[],
+                             MSP **lastMsp,
+                             MSP **mspList,
+                             GList **seqList,
                              GList *columnList,
                              GHashTable *lookupTable,
                              GError **error)
@@ -2512,11 +2513,11 @@ static void createMissingUtr(MSP *exon,
 /* Create an exon that spans the given child CDSs/UTRs. Must not be called with
  * an empty childList. */
 static MSP* createMissingExon(GList *childList,
-                              BlxSequence *blxSeq, 
-                              GArray* featureLists[], 
-                              MSP **lastMsp, 
-                              MSP **mspList, 
-                              GList **seqList, 
+                              BlxSequence *blxSeq,
+                              GArray* featureLists[],
+                              MSP **lastMsp,
+                              MSP **mspList,
+                              GList **seqList,
                               GList *columnList,
                               GHashTable *lookupTable,
                               GError **error)
@@ -2525,24 +2526,24 @@ static MSP* createMissingExon(GList *childList,
    * of increasing coords and should not overlap etc. */
   MSP *startMsp = (MSP*)(g_list_first(childList)->data);
   MSP *endMsp = (MSP*)(g_list_last(childList)->data);
-  
+
   MSP *result = createMissingMsp(BLXMSP_EXON, startMsp->qRange.min(), endMsp->qRange.max(), startMsp->qname, startMsp->qFrame, startMsp->style, blxSeq, featureLists, lastMsp, mspList, seqList, columnList, lookupTable, error);
   return result;
 }
 
 
-/* Utility used by constructExonData to create a missing exon/cds/utr given 
+/* Utility used by constructExonData to create a missing exon/cds/utr given
  * two others out of the three - i.e. if we have an overlapping exon and cds we can
- * construct the corresponding utr. If created, the new msp is added to the given 
+ * construct the corresponding utr. If created, the new msp is added to the given
  * BlxSequence and the  MSP list. If a CDS is given and no UTR exists, assume the exon
  * spans the entire CDS (and similarly if a UTR is given but no CDS exists) */
-static void createMissingExonCdsUtr(MSP **exon, 
+static void createMissingExonCdsUtr(MSP **exon,
                                     GList **childList,
-                                    BlxSequence *blxSeq, 
-                                    GArray* featureLists[], 
-                                    MSP **lastMsp, 
-                                    MSP **mspList, 
-                                    GList **seqList, 
+                                    BlxSequence *blxSeq,
+                                    GArray* featureLists[],
+                                    MSP **lastMsp,
+                                    MSP **mspList,
+                                    GList **seqList,
                                     GList *columnList,
                                     GHashTable *lookupTable,
                                     GError **error)
@@ -2569,8 +2570,8 @@ static void createMissingExonCdsUtr(MSP **exon,
 /* Construct any missing exon data, i.e.
  *   - if we have a transcript and exons we can construct the introns;
  *   - if we have exons and CDSs we can construct the UTRs */
-static void constructExonData(BlxSequence *blxSeq, 
-                              GArray* featureLists[], 
+static void constructExonData(BlxSequence *blxSeq,
+                              GArray* featureLists[],
                               MSP **lastMsp,
                               MSP **mspList,
                               GList **seqList,
@@ -2578,31 +2579,31 @@ static void constructExonData(BlxSequence *blxSeq,
                               GHashTable *lookupTable)
 {
   GError *tmpError = NULL;
-  
+
   const MSP *prevMsp = NULL;
   const MSP *prevExon = NULL;
-  
+
   MSP *curExon = NULL;          /* the current exon we're looking at */
   GList *curChildMsps = NULL;   /* the child CDS/UTRs of the current exon */
   MSP *spanningCds = NULL;      /* hack to support invalid GFF used by zmap where a single CDS
                                  * spanning the entire range is given, rather than a separate CDS
                                  * feature for each exon */
-  
+
   /* Loop through all MSPs on this sequence (which must be sorted by position on the
-   * ref seq - createNewMsp automatically sorts them for us) and create any missing 
+   * ref seq - createNewMsp automatically sorts them for us) and create any missing
    * exon/cds/utr/introns. */
   GList *mspItem = blxSeq->mspList;
   gboolean finished = FALSE;
-  
+
   while (!finished)
     {
       MSP *msp = mspItem ? (MSP*)(mspItem->data) : NULL;
-      
+
       /* Only consider exons and introns */
       if (mspIsExon(msp) || mspIsIntron(msp) || !msp)
         {
           /* See if there was a gap between this exon and the previous one. There's a gap if
-           * we have two exons with space between them, or if we're at the first or last exon 
+           * we have two exons with space between them, or if we're at the first or last exon
            * and there's a gap to the end of the transcript. */
           gboolean foundGap = FALSE;
 
@@ -2623,22 +2624,22 @@ static void constructExonData(BlxSequence *blxSeq,
                * there's a gap between it and the start of the transcript */
               foundGap = blxSequenceGetStart(blxSeq, blxSeq->strand) < msp->qRange.min();
             }
-          
+
           if (foundGap || msp == NULL)
             {
               /* We've found a gap between exons, or reached the end. First, see if the current exon/cds or utr
                * is missing and construct it if possible. Also do this if we're at the last MSP. */
               createMissingExonCdsUtr(&curExon, &curChildMsps, blxSeq, featureLists, lastMsp, mspList, seqList, columnList, lookupTable, &tmpError);
               reportAndClearIfError(&tmpError, G_LOG_LEVEL_CRITICAL);
-              
+
               IntRange newRange;
-              
+
               if (prevExon && curExon && !mspIsIntron(msp) && !mspIsIntron(prevMsp))
                 {
                   /* Create an intron to span the gap */
                   newRange.set(prevExon->qRange.max() + 1, curExon->qRange.min() - 1);
                 }
-              else if (!prevExon && curExon && blxSequenceGetStart(blxSeq, blxSeq->strand) < curExon->qRange.min() && 
+              else if (!prevExon && curExon && blxSequenceGetStart(blxSeq, blxSeq->strand) < curExon->qRange.min() &&
 		       !mspIsIntron(msp) && !mspIsIntron(prevMsp))
                 {
                   /* Create an intron at the start */
@@ -2650,19 +2651,19 @@ static void constructExonData(BlxSequence *blxSeq,
                   /* Create an intron at the end */
                   newRange.set(curExon->qRange.max() + 1, blxSequenceGetEnd(blxSeq, blxSeq->strand));
                 }
-              
+
               if (curExon && newRange.isSet())
                 {
-                  createNewMsp(featureLists, lastMsp, mspList, seqList, columnList, BLXMSP_INTRON, NULL, blxSequenceGetSource(blxSeq), 
-                               curExon->score, curExon->id, 0, blxSeq->idTag, 
-                               curExon->qname, newRange.min(), newRange.max(), blxSeq->strand, curExon->qFrame, 
+                  createNewMsp(featureLists, lastMsp, mspList, seqList, columnList, BLXMSP_INTRON, NULL, blxSequenceGetSource(blxSeq),
+                               curExon->score, curExon->id, 0, blxSeq->idTag,
+                               curExon->qname, newRange.min(), newRange.max(), blxSeq->strand, curExon->qFrame,
                                blxSequenceGetName(blxSeq), blxSequenceGetName(blxSeq),
-                               UNSET_INT, UNSET_INT, blxSeq->strand, NULL, 
+                               UNSET_INT, UNSET_INT, blxSeq->strand, NULL,
                                0, lookupTable, blxSeq, &tmpError);
-                  
+
                   reportAndClearIfError(&tmpError, G_LOG_LEVEL_CRITICAL);
                 }
-              
+
               /* We're done with this exon, so set the exon's list of child msps
                * and reset the pointers */
               setExonChildList(curExon, curChildMsps, featureLists, lastMsp, mspList, seqList, columnList, lookupTable, &spanningCds);
@@ -2671,7 +2672,7 @@ static void constructExonData(BlxSequence *blxSeq,
               curExon = NULL;
               curChildMsps = NULL;
             }
-          
+
           if (msp && msp->type == BLXMSP_EXON)
             {
               curExon = msp;
@@ -2684,16 +2685,16 @@ static void constructExonData(BlxSequence *blxSeq,
             {
               curChildMsps = g_list_append(curChildMsps, msp);
             }
-          
+
           /* Remember the last MSP we saw */
           prevMsp = msp;
-          
+
           /* Proceed to the next MSP. We allow an extra loop with a NULL mspItem at the end, and then finish. */
           if (mspItem)
             mspItem = mspItem->next;
           else
             finished = TRUE;
-        } 
+        }
       else
         {
           /* Something that's not an exon/intron. Skip this BlxSequence. */
@@ -2710,7 +2711,7 @@ static void constructExonData(BlxSequence *blxSeq,
  *   - if we have multiple CDSs, copy the transcript so we can show each variant;
  *   - if we have a transcript and exons we can construct the introns;
  *   - if we have exons and CDSs we can construct the UTRs */
-static void constructTranscriptData(GArray* featureLists[], 
+static void constructTranscriptData(GArray* featureLists[],
                                     MSP **lastMsp,
                                     MSP **mspList,
                                     GList **seqList,
@@ -2750,7 +2751,7 @@ static void constructTranscriptData(GArray* featureLists[],
         {
           /* More than one variant: create copies of the transcript for each variant */
           GList *cdsItem = cdsList;
-  
+
           for ( ; cdsItem && !tmpError; cdsItem = cdsItem->next)
             {
               GQuark cdsQuark = GPOINTER_TO_INT(cdsItem->data);
@@ -2785,10 +2786,10 @@ static void adjustMspCoordsByOffset(MSP *msp, const int offset)
        * that we're dealing with) to "real" coords (i.e. coords that the user will see). */
       msp->qRange.set(msp->qRange.min() + offset,
                       msp->qRange.max() + offset);
-      
+
       /* Gap coords are also 1-based, so convert those too */
       GSList *rangeItem = msp->gaps;
-      
+
       for ( ; rangeItem; rangeItem = rangeItem->next)
         {
           CoordRange *curRange = (CoordRange*)(rangeItem->data);
@@ -2818,36 +2819,36 @@ static void findSequenceExtents(BlxSequence *blxSeq)
 }
 
 
-/* Get the offset required from the given base to give the coord that is the first base in 
+/* Get the offset required from the given base to give the coord that is the first base in
  * the first codon of reading frame 1 (or the last codon in reading frame 3 for the reverse strand) */
 static int getOffsetToCodonStart(const int coord, const int numFrames, const BlxStrand strand)
 {
   int offset = 0;
-  
+
   if (strand == BLXSTRAND_FORWARD)
     {
-      /* If the sequence is 
+      /* If the sequence is
        *     1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ...
        * then the calculated base below will be
        *     0, 1, 2, 0, 1, 2, 0, 1, 2, 0,  1, ...
        * so we have to offset the coords by the following values to get to a base1 coord
        *     0, 2, 1, 0, 2, 1, 0, 2, 1, 0,  2, ...
        */
-      
+
       int base = ((coord - 1) % numFrames); /* 0, 1 or 2 */
       offset = numFrames - base;            /* 3, 2 or 1 */
-      
+
       if (offset >= numFrames)
 	offset -= numFrames;                /* 0, 2 or 1 */
     }
   else
     {
       /* I'm not sure if there is a convention for where the reading frame starts in the reverse
-       * strand, so I've made up my own convention. It essentially means that we want the first 
+       * strand, so I've made up my own convention. It essentially means that we want the first
        * coord in the reversed sequence to be the last base in the last reading frame, i.e. base 3 in frame 3.
        *
        * If the forward strand coords are
-       *             1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 
+       *             1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
        * then the have the following base numbers for each frame
        * frame 1:    1, 2, 3, 1, 2, 3, 1, 2, 3, 1,  2
        * frame 2:    3, 1, 2, 3, 1, 2, 3, 1, 2, 3,  1
@@ -2861,11 +2862,11 @@ static int getOffsetToCodonStart(const int coord, const int numFrames, const Blx
        * to get to a frame1-base2 coord are:
        *              0,  2, 1, 0, 2, 1, 0, 2, 1, 0, 2
        */
-      
+
       int base = (coord + 1) % numFrames;   /* 0, 2 or 1 */
       offset = base;
     }
-  
+
   return offset;
 }
 
@@ -2875,7 +2876,7 @@ static int getOffsetToCodonStart(const int coord, const int numFrames, const Blx
  * assumes a phase of 0 and gives a warning. */
 static void calcReadingFrame(MSP *msp, const BlxSeqType seqType, const int numFrames, const IntRange* const refSeqRange)
 {
-  /* For matches and exons, calculate frame if the phase is known, because the old code that 
+  /* For matches and exons, calculate frame if the phase is known, because the old code that
    * used to pass the reading frame in exblx files seemed to occasionally pass an incorrect reading frame. */
   if (!mspIsIntron(msp))
     {
@@ -2883,14 +2884,14 @@ static void calcReadingFrame(MSP *msp, const BlxSeqType seqType, const int numFr
        * plus (or minus) the phase (if non-zero), which initially gets stored in the qFrame field in the MSP... */
       const int direction = (msp->qStrand == BLXSTRAND_FORWARD ? 1 : -1);
       const int coord = mspGetQStart(msp) + (direction * msp->phase);
-      
+
       /* Find the reading frame that this coord belongs in. This is the same as the base number within
        * reading frame 1. */
       int frame = UNSET_INT;
       const gboolean invertCoords = (mspGetRefStrand(msp) == BLXSTRAND_REVERSE);
-      
+
       convertDnaIdxToDisplayIdx(coord, seqType, 1, numFrames, invertCoords, refSeqRange, &frame);
-      
+
       if (frame > 0)
 	{
 	  if (msp->qFrame > 0 && mspIsExon(msp))
@@ -2902,12 +2903,12 @@ static void calcReadingFrame(MSP *msp, const BlxSeqType seqType, const int numFr
 	      const int startCoord = (msp->qStrand == BLXSTRAND_REVERSE ? refSeqRange->max() : refSeqRange->min());
 	      const int offset = getOffsetToCodonStart(startCoord, numFrames, msp->qStrand);
 	      msp->qFrame += offset;
-	      
+
 	      if (msp->qFrame > numFrames)
 		{
 		  msp->qFrame -= numFrames;
 		}
-	      
+
 	      if (msp->qFrame != frame && seqType == BLXSEQ_PEPTIDE)
 		{
 		  g_warning("MSP '%s' (q=%d-%d; s=%d-%d) has reading frame '%d' but calculated frame was '%d'\n", mspGetSName(msp), msp->qRange.min(), msp->qRange.max(), msp->sRange.min(), msp->sRange.max(), msp->qFrame, frame);
@@ -2915,12 +2916,12 @@ static void calcReadingFrame(MSP *msp, const BlxSeqType seqType, const int numFr
 	    }
 	  else
 	    {
-	      /* We either have the new file format which provides phase or it's not an exon so phase 
+	      /* We either have the new file format which provides phase or it's not an exon so phase
 	       * is not applicable, so we can trust the calculated value. */
 	      msp->qFrame = frame;
 	    }
 	}
-      
+
       if (msp->qFrame == UNSET_INT)
 	{
 	  g_warning("Reading frame could not be calculated for MSP '%s' (q=%d-%d; s=%d-%d) - setting to 1.\n", mspGetSName(msp), msp->qRange.min(), msp->qRange.max(), msp->sRange.min(), msp->sRange.max());
@@ -2932,12 +2933,12 @@ static void calcReadingFrame(MSP *msp, const BlxSeqType seqType, const int numFr
 
 /* Should be called after all parsed data has been added to a BlxSequence. Calculates summary
  * data and the introns etc. */
-void finaliseBlxSequences(GArray* featureLists[], 
-			  MSP **mspList, 
-			  GList **seqList, 
+void finaliseBlxSequences(GArray* featureLists[],
+			  MSP **mspList,
+			  GList **seqList,
                           GList *columnList,
 			  const int offset,
-			  const BlxSeqType seqType, 
+			  const BlxSeqType seqType,
 			  const int numFrames,
 			  const IntRange* const refSeqRange,
 			  const gboolean calcFrame,
@@ -2953,26 +2954,26 @@ void finaliseBlxSequences(GArray* featureLists[],
   while (msp)
     {
       adjustMspCoordsByOffset(msp, offset);
-    
+
       if (calcFrame)
 	calcReadingFrame(msp, seqType, numFrames, refSeqRange);
-    
+
       msp = msp->next;
       if (msp)
         lastMsp = msp;
     }
-  
+
   /* Loop through all BlxSequences */
   GList *seqItem = *seqList;
-  
+
   for ( ; seqItem; seqItem = seqItem->next)
     {
-      /* So far we only have the forward strand version of each sequence. We must complement any 
+      /* So far we only have the forward strand version of each sequence. We must complement any
        * that need the reverse strand */
       BlxSequence *blxSeq = (BlxSequence*)(seqItem->data);
 
-      if (blxSeq && 
-          blxSeq->strand == BLXSTRAND_REVERSE && 
+      if (blxSeq &&
+          blxSeq->strand == BLXSTRAND_REVERSE &&
           blxSequenceGetFlag(blxSeq, MSPFLAG_STRAND_SPECIFIC) &&
           blxSequenceGetFlag(blxSeq, MSPFLAG_SHOW_REVERSE_STRAND) &&
           blxSequenceGetSequence(blxSeq))
@@ -3011,15 +3012,15 @@ int findMspListQExtent(GList *mspList, const gboolean findMin, const BlxStrand s
 {
   int result = UNSET_INT;
   gboolean first = TRUE;
-  
+
   GList *mspItem = mspList;
-  
+
   for ( ; mspItem; mspItem = mspItem->next)
     {
       const MSP* const msp = (const MSP*)(mspItem->data);
-    
+
       if (msp->qStrand == strand || strand == BLXSTRAND_NONE)
-	{      
+	{
 	  if (first)
 	    {
 	      result = findMin ? msp->qRange.min() : msp->qRange.max();
@@ -3035,7 +3036,7 @@ int findMspListQExtent(GList *mspList, const gboolean findMin, const BlxStrand s
 	    }
 	}
     }
-  
+
   return result;
 }
 
@@ -3045,13 +3046,13 @@ int findMspListSExtent(GList *mspList, const gboolean findMin)
 {
   int result = UNSET_INT;
   gboolean first = TRUE;
-  
+
   GList *mspItem = mspList;
-  
+
   for ( ; mspItem; mspItem = mspItem->next)
     {
       const MSP* const msp = (const MSP*)(mspItem->data);
-      
+
       if (first)
 	{
 	  result = findMin ? msp->sRange.min() : msp->sRange.max();
@@ -3066,7 +3067,7 @@ int findMspListSExtent(GList *mspList, const gboolean findMin)
 	  result = msp->sRange.max();
 	}
     }
-  
+
   return result;
 }
 
@@ -3075,7 +3076,7 @@ int findMspListSExtent(GList *mspList, const gboolean findMin)
 gboolean mspFlagGetDefault(const MspFlag flag)
 {
   gboolean result = FALSE;
-  
+
   if (flag > MSPFLAG_MIN && flag < MSPFLAG_NUM_FLAGS)
     {
       /* The defaults are populated when we create a BlxDataType,
@@ -3083,7 +3084,7 @@ gboolean mspFlagGetDefault(const MspFlag flag)
        * is made a global so that we can also change the defaults. */
       if (!g_DefaultDataType)
         g_DefaultDataType = createBlxDataType();
-      
+
       if (g_DefaultDataType)
         result = g_DefaultDataType->flags[flag];
       else
@@ -3093,7 +3094,7 @@ gboolean mspFlagGetDefault(const MspFlag flag)
     {
       g_critical("Program error: attempt to use unknown MSP flag '%d'\n", flag);
     }
-  
+
   return result;
 }
 
@@ -3107,7 +3108,7 @@ void mspFlagSetDefault(const MspFlag flag, const gboolean value)
        * so create a dummy one so that we can access and set them. */
       if (!g_DefaultDataType)
         g_DefaultDataType = createBlxDataType();
-      
+
       if (g_DefaultDataType)
         g_DefaultDataType->flags[flag] = value;
     }
@@ -3123,8 +3124,8 @@ ColinearityType mspIsColinear(const MSP* const msp1, const MSP* const msp2)
 {
   ColinearityType result = COLINEAR_INVALID;
 
-  if (msp1 && msp2 && msp1->qStrand == msp2->qStrand && 
-      msp1->sSequence && msp2->sSequence && 
+  if (msp1 && msp2 && msp1->qStrand == msp2->qStrand &&
+      msp1->sSequence && msp2->sSequence &&
       msp1->sSequence->strand == msp2->sSequence->strand)
     {
       if (msp2->sRange.min() < msp1->sRange.max())
@@ -3145,7 +3146,7 @@ gboolean dataTypeGetFlag(const BlxDataType* const dataType, const MspFlag flag)
   gboolean result = mspFlagGetDefault(flag);
 
   if (flag > MSPFLAG_MIN && flag < MSPFLAG_NUM_FLAGS)
-    {  
+    {
       if (dataType)
         result = dataType->flags[flag];
     }
@@ -3153,7 +3154,7 @@ gboolean dataTypeGetFlag(const BlxDataType* const dataType, const MspFlag flag)
     {
       g_critical("Program error: attempt to use unknown MSP flag '%d'\n", flag);
     }
-  
+
   return result;
 }
 
@@ -3162,10 +3163,10 @@ gboolean dataTypeGetFlag(const BlxDataType* const dataType, const MspFlag flag)
 gboolean blxSequenceGetFlag(const BlxSequence* const blxSeq, const MspFlag flag)
 {
   gboolean result = mspFlagGetDefault(flag);
-  
+
   if (blxSeq)
     result = dataTypeGetFlag(blxSeq->dataType, flag);
-    
+
   return result;
 }
 
@@ -3174,10 +3175,10 @@ gboolean blxSequenceGetFlag(const BlxSequence* const blxSeq, const MspFlag flag)
 gboolean mspGetFlag(const MSP* const msp, const MspFlag flag)
 {
   gboolean result = mspFlagGetDefault(flag);
-  
+
   if (msp)
     result = blxSequenceGetFlag(msp->sSequence, flag);
-  
+
   return result;
 }
 
@@ -3185,7 +3186,7 @@ gboolean mspGetFlag(const MSP* const msp, const MspFlag flag)
 const char* mspFlagGetConfigKey(const MspFlag flag)
 {
   const char *result = NULL;
-  
+
   if (flag > MSPFLAG_MIN && flag < MSPFLAG_NUM_FLAGS)
     {
       /* To make sure we don't access the array out of bounds, loop
@@ -3205,14 +3206,14 @@ const char* mspFlagGetConfigKey(const MspFlag flag)
             {
               result = g_MspFlagConfigKeys[i];
               break;
-            }          
+            }
         }
     }
   else
     {
       g_critical("Program error: Tried to use an unknown MSP flag '%d'\n", flag);
     }
-  
+
   return result;
 }
 
@@ -3221,7 +3222,7 @@ const char* mspFlagGetConfigKey(const MspFlag flag)
 static BlxSequenceType getBlxSequenceTypeForMsp(const BlxMspType mspType)
 {
   BlxSequenceType result = BLXSEQUENCE_UNSET;
-  
+
   if (mspType == BLXMSP_MATCH)
     {
       result = BLXSEQUENCE_MATCH;
@@ -3249,15 +3250,15 @@ static GQuark getLookupKey(const char *text, const BlxStrand strand)
   char *keyStr = g_strdup_printf("%s%c", text, (strand == BLXSTRAND_FORWARD ? '+' : '-'));
   GQuark key = g_quark_from_string(keyStr);
   g_free(keyStr);
-  
+
   return key;
 }
 
 
-/* Utility to find a blxsequence with the given name/id/strand in the 
+/* Utility to find a blxsequence with the given name/id/strand in the
  * given hash table. Returns null if it is not there. */
 static BlxSequence* findBlxSequence(GHashTable *lookupTable,
-                                    const char *name, 
+                                    const char *name,
                                     const char *idTag,
                                     const BlxStrand strand,
                                     const gboolean linkFeaturesByName)
@@ -3304,7 +3305,7 @@ static gint columnIdCompareFunc(gconstpointer a, gconstpointer b)
 
 /* Create a new sequence with the given name and/or ID tag */
 static BlxSequence* createBlxSequence(const char *name,
-                                      const char *idTag, 
+                                      const char *idTag,
                                       const BlxStrand strand,
                                       BlxDataType *dataType,
                                       const char *source,
@@ -3327,7 +3328,7 @@ static BlxSequence* createBlxSequence(const char *name,
   /* Sort the columns by column ID (NOT column index) so that we
    * can easily index on the ID when looking up values in the array */
   columnList = g_list_sort(columnList, columnIdCompareFunc);
-  
+
   GList *item = columnList;
   for ( ; item; item = item->next)
     {
@@ -3336,13 +3337,13 @@ static BlxSequence* createBlxSequence(const char *name,
        * the display order, which is not relevant here. */
       BlxColumnInfo * columnInfo = (BlxColumnInfo*)(item->data);
       GType type = columnInfo->type;
-      
+
       /* Bit of a hack; the sequence column type is pointer because we
        * pass a pointer to the msp to the cell renderer, but here we want to
        * store the actual sequence string */
       if (columnInfo->columnId == BLXCOL_SEQUENCE)
         type = G_TYPE_STRING;
-      
+
       GValue value = {0};
       g_value_init(&value, type);
 
@@ -3363,19 +3364,19 @@ static BlxSequence* createBlxSequence(const char *name,
 /* Wrapper for addBlxSequence to add multiple sequences. The idTag might be a comma-separated
  * list of parent IDs, in which case we need to add the msp to multiple BlxSequences (creating
  * those BlxSequences if they don't exist. */
-static void addBlxSequences(const char *name, 
-                            const char *name_orig, 
-                            const char *idTag, 
+static void addBlxSequences(const char *name,
+                            const char *name_orig,
+                            const char *idTag,
                             BlxStrand strand,
                             BlxDataType *dataType,
                             const char *source,
                             GArray *featureLists[],
                             MSP **lastMsp,
                             MSP **mspList,
-                            GList **seqList, 
+                            GList **seqList,
                             GList *columnList,
-                            char *sequence, 
-                            MSP *msp_in, 
+                            char *sequence,
+                            MSP *msp_in,
                             GHashTable *lookupTable,
                             BlxSequence *blxSeq,
                             GError **error)
@@ -3396,10 +3397,10 @@ static void addBlxSequences(const char *name,
       char **tokens = g_strsplit_set(idTag, ",", -1);   /* -1 means do all tokens. */
       char **token = tokens;
       gboolean usedMsp = FALSE;
-      
+
       while (token && *token && **token && !tmpError)
         {
-          /* If we've already used the passed-in msp, then we need to make a copy of it to 
+          /* If we've already used the passed-in msp, then we need to make a copy of it to
            * add to the next BlxSequence (because the msp points to its BlxSequence so can't
            * be added to multiple BlxSequences, at least at the moment) */
           if (usedMsp)
@@ -3427,19 +3428,19 @@ static void addBlxSequences(const char *name,
 
 /* Add or create a BlxSequence struct, creating the BlxSequence if one does not
  * already exist for the MSP's sequence name. Seperate BlxSequence structs are created
- * for the forward and reverse strands of the same sequence. The passed-in sequence 
- * should always be forwards, and we reverse complement it here if we need the 
+ * for the forward and reverse strands of the same sequence. The passed-in sequence
+ * should always be forwards, and we reverse complement it here if we need the
  * reverse strand. Returns the new BlxSequence */
-BlxSequence* addBlxSequence(const char *name, 
-                            const char *name_orig, 
-			    const char *idTag, 
+BlxSequence* addBlxSequence(const char *name,
+                            const char *name_orig,
+			    const char *idTag,
 			    BlxStrand strand,
 			    BlxDataType *dataType,
                             const char *source,
-			    GList **seqList, 
+			    GList **seqList,
                             GList *columnList,
-			    char *sequence, 
-			    MSP *msp, 
+			    char *sequence,
+			    MSP *msp,
                             GHashTable *lookupTable,
                             BlxSequence *blxSeq_in,
                             GError **error)
@@ -3448,25 +3449,25 @@ BlxSequence* addBlxSequence(const char *name,
 
   if (blxSeq || name || idTag)
     {
-      /* If this is an exon, intron or basic feature the match strand is not applicable. The exon should 
+      /* If this is an exon, intron or basic feature the match strand is not applicable. The exon should
        * be in the same direction as the ref seq, so use the ref seq strand. */
       if (msp && (mspIsBoxFeature(msp) || mspIsIntron(msp)))
         {
           strand = msp->qStrand;
         }
-    
+
       /* See if this sequence already exists. This matches on name (if linkFeaturesByName is
        * true) or on tag, and strand. */
       gboolean linkFeaturesByName = dataTypeGetFlag(dataType, MSPFLAG_LINK_FEATURES_BY_NAME);
 
       if (!blxSeq)
         blxSeq = findBlxSequence(lookupTable, name, idTag, strand, linkFeaturesByName);
-      
+
       if (!blxSeq)
         {
           /* Create a new BlxSequence, and take ownership of the passed in sequence (if any) */
           blxSeq = createBlxSequence(name, idTag, strand, dataType, source, columnList);
-          
+
           /* Add it to the return sequence list (must append it because this function can be
            * called from within a loop which relies on new sequences being appended) */
           *seqList = g_list_prepend(*seqList, blxSeq);
@@ -3485,7 +3486,7 @@ BlxSequence* addBlxSequence(const char *name,
             blxSeq->dataType = dataType;
           else if (dataType && blxSeq->dataType != dataType)
             g_warning("Duplicate sequences have different data types [name=%s, ID=%s, strand=%d, orig type=%s, new type=%s].\n", name, idTag, strand, g_quark_to_string(blxSeq->dataType->name), g_quark_to_string(dataType->name));
-          
+
           const char *oldSource = blxSequenceGetSource(blxSeq);
 
           if (source && !oldSource)
@@ -3493,7 +3494,7 @@ BlxSequence* addBlxSequence(const char *name,
           else if (source && !stringsEqual(oldSource, source, FALSE))
             g_warning("Duplicate sequences have different sources [name=%s, ID=%s, strand=%d, orig source=%s, new source=%s].\n", name, idTag, strand, oldSource, source);
         }
-      
+
       if (name && !blxSequenceGetName(blxSeq))
 	{
 	  /* It's possible that the BlxSequence was created without a name if we found an
@@ -3504,24 +3505,24 @@ BlxSequence* addBlxSequence(const char *name,
           if (linkFeaturesByName)
             g_hash_table_insert(lookupTable, GINT_TO_POINTER(getLookupKey(name, strand)), blxSeq);
 	}
-      
+
       if (msp)
         {
           /* Add the MSP to the BlxSequence's list. Keep it sorted by position. */
           blxSeq->mspList = g_list_insert_sorted(blxSeq->mspList, msp, compareFuncMspPos);
           msp->sSequence = blxSeq;
-          
+
           if (blxSeq->type == BLXSEQUENCE_UNSET)
             {
               blxSeq->type = getBlxSequenceTypeForMsp(msp->type);
             }
           else if (blxSeq->type != getBlxSequenceTypeForMsp(msp->type))
             {
-              g_warning("Adding MSP of type %d to parent of type %d (expected parent type to be %d)\n", 
+              g_warning("Adding MSP of type %d to parent of type %d (expected parent type to be %d)\n",
 			msp->type, blxSeq->type, getBlxSequenceTypeForMsp(msp->type));
             }
         }
-      
+
       /* Add the sequence data */
       addBlxSequenceData(blxSeq, sequence, error);
     }
@@ -3529,14 +3530,14 @@ BlxSequence* addBlxSequence(const char *name,
     {
       g_set_error(error, BLX_ERROR, 1, "Sequence name or parent ID must be set.\n");
     }
-  
+
   return blxSeq;
 }
 
 
 /* Add the given sequence data to a BlxSequence. Validates that the existing sequence data is
  * either null or is the same as the new data; sets the given error if not. We claim ownership
- * of the given sequence data (either the BlxSequence owns it, or we delete it if it is not 
+ * of the given sequence data (either the BlxSequence owns it, or we delete it if it is not
  * required). The given sequence should always be the forward strand; we complement it ourselves
  * here if this BlxSequence requires the reverse strand. */
 void addBlxSequenceData(BlxSequence *blxSeq, char *sequence, GError **error)
@@ -3545,11 +3546,11 @@ void addBlxSequenceData(BlxSequence *blxSeq, char *sequence, GError **error)
     {
       return;
     }
-  
+
   gboolean sequenceUsed = FALSE;
 
   const char *oldSequence = blxSequenceGetSequence(blxSeq);
-  
+
   if (blxSeq && blxSequenceRequiresSeqData(blxSeq))
     {
       if (!oldSequence)
@@ -3566,8 +3567,8 @@ void addBlxSequenceData(BlxSequence *blxSeq, char *sequence, GError **error)
               g_set_error(error, BLX_ERROR, BLX_ERROR_SEQ_DATA_MISMATCH, "Sequence data for '%s' does not match previously-found data.\n", blxSequenceGetName(blxSeq));
             }
         }
-    }      
-  
+    }
+
   if (!sequenceUsed)
     {
       g_free(sequence);
@@ -3580,7 +3581,7 @@ void addBlxSequenceData(BlxSequence *blxSeq, char *sequence, GError **error)
  ***********************************************************/
 
 /* Creates a data "column" from the given info and adds it to the columnList. */
-void blxColumnCreate(BlxColumnId columnId, 
+void blxColumnCreate(BlxColumnId columnId,
                      const gboolean createHeader,
                      const char *title,
                      GType type,
@@ -3598,17 +3599,17 @@ void blxColumnCreate(BlxColumnId columnId,
 {
   /* Create a simple label for the header (unless told not to) */
   GtkWidget *headerWidget = NULL;
-  
+
   if (createHeader)
     {
       headerWidget = createLabel(title, 0.0, 1.0, TRUE, TRUE, TRUE);
       gtk_widget_set_size_request(headerWidget, defaultWidth, -1);
     }
-  
+
   /* Create the column info */
   BlxColumnInfo *columnInfo = new BlxColumnInfo;
 
-  static int columnIdx = 0;  
+  static int columnIdx = 0;
   columnInfo->columnIdx = columnIdx;
   ++columnIdx;
 
@@ -3627,7 +3628,7 @@ void blxColumnCreate(BlxColumnId columnId,
   columnInfo->canShowSummary = canShowSummary;
   columnInfo->searchable = searchable;
   columnInfo->type = type;
-  
+
   /* Place it in the list. List must be sorted in the same order
    * as the GtkListStore or gtk_list_store_set fails */
   *columnList = g_list_insert_sorted(*columnList, columnInfo, columnIdxCompareFunc);
@@ -3650,7 +3651,7 @@ GList* blxSequenceConstructCdsList(BlxSequence *seq)
       for ( ; mspItem; mspItem = mspItem->next)
         {
           const MSP *msp = (const MSP*)(mspItem->data);
-          
+
           if (msp->type == BLXMSP_CDS)
             {
               GQuark name = 0;
@@ -3669,13 +3670,13 @@ GList* blxSequenceConstructCdsList(BlxSequence *seq)
 
 
 /***********************************************************
- *              Sequence manipulation                      * 
+ *              Sequence manipulation                      *
  ***********************************************************/
 
 /* Get the spliced sequence for a given transcript. The result should be free'd by the caller
  * with g_free. Returns null and sets the error if there was a problem. */
-char *blxSequenceGetSplicedSequence(const BlxSequence* const blxSeq, 
-                                    const char *refSeq, 
+char *blxSequenceGetSplicedSequence(const BlxSequence* const blxSeq,
+                                    const char *refSeq,
                                     const IntRange* const refSeqRange,
                                     GError **error)
 {
@@ -3684,13 +3685,13 @@ char *blxSequenceGetSplicedSequence(const BlxSequence* const blxSeq,
 
   GString *resultStr = g_string_new(NULL);
   const int refSeqLen = strlen(refSeq);
-  
+
   GList *mspItem = blxSeq->mspList;
-  
+
   for ( ; mspItem; mspItem = mspItem->next)
     {
       const MSP* msp = (const MSP*)(mspItem->data);
-      
+
       /* Ignore msps that have child msps (we just want to export the child msps) */
       if (mspIsBoxFeature(msp) && !msp->childMsps)
         {
@@ -3699,7 +3700,7 @@ char *blxSequenceGetSplicedSequence(const BlxSequence* const blxSeq,
           /* It's possible that some exons may be out of bounds: clip them. */
           if (i < 0)
             i = 0;
-          
+
           int iMax = msp->qRange.max() - refSeqRange->min();
           if (iMax >= refSeqLen)
             iMax = refSeqLen - 1;
@@ -3736,4 +3737,3 @@ char *blxSequenceGetSplicedSequence(const BlxSequence* const blxSeq,
 
   return result;
 }
-
diff --git a/src/seqtoolsUtils/blxmsp.hpp b/src/seqtoolsUtils/blxmsp.hpp
index f5436e4114bb9d422493dcbe62564a5ad610be36..064946d9505d105196886126339df2aeea4d299c 100644
--- a/src/seqtoolsUtils/blxmsp.hpp
+++ b/src/seqtoolsUtils/blxmsp.hpp
@@ -1,5 +1,6 @@
 /*  File: blxmsp.h
  *  Author: Gemma Barson, 2010-09-02
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -28,14 +29,14 @@
  *      Roy Storey        (Sanger Institute, UK)  <rds@sanger.ac.uk>
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
- * Description: Defines the MSP data struct and related functions. I think 
+ * Description: Defines the MSP data struct and related functions. I think
  *              MSP stood for Matching Segment Pair and originally represented
  *              an alignment. However, it is now used for other feature
  *              types too, so should be renamed to "BlxFeature" or something.
  *              Ideally also it would be separated out into a base feature and
  *              derived features for the different features types.
  *----------------------------------------------------------------------------
- */ 
+ */
 
 #ifndef _blxmsp_included_
 #define _blxmsp_included_
@@ -77,11 +78,11 @@ typedef enum
 
 
 /* Supported types of MSP */
-typedef enum 
+typedef enum
 {
   BLXMSP_NONE,                   /* Not set yet */
   BLXMSP_INVALID,                /* Invalid type (cannot be displayed by blixem) */
-  
+
   BLXMSP_MATCH,                  /* A match (i.e. alignment) */
   BLXMSP_MATCH_SET,              /* The parent of a set of matches. Can be used to specify generic properties such as color. */
   BLXMSP_CDS,                    /* CDS (coding) region of an exon */
@@ -90,12 +91,12 @@ typedef enum
   BLXMSP_EXON,                   /* Exon (should appear AFTER CDS and UTR for sorting, as required by constructTranscriptData) */
   BLXMSP_POLYA_SITE,             /* polyA tail site */
   BLXMSP_POLYA_SIGNAL,           /* polyA signal */
-  
+
   BLXMSP_VARIATION,              /* SNP, substitution, deletion, insertion */
-  
+
   BLXMSP_HSP,                    /* obsolete? */
   BLXMSP_GSP,                    /* obsolete? */
-  
+
   BLXMSP_FS_SEG,                 /* Feature Series Segment - obsolete? */
   BLXMSP_XY_PLOT,                /* x/y coordinates - for plotting feature-series curves - obsolete? */
 
@@ -103,11 +104,11 @@ typedef enum
   BLXMSP_GAP,                    /* Gap, e.g. assembly gap */
 
   BLXMSP_BASIC,                  /* Basic feature (just drawn as a simple box) */
-  
-  
+
+
   BLXMSP_NUM_TYPES,               /* the number of valid MSP types - any types following this may be used
                                    * e.g. for parsing, but no real MSP will be created from them */
-  
+
   BLXMSP_TRANSCRIPT              /* Transcript */
 } BlxMspType;
 
@@ -129,7 +130,7 @@ typedef enum
   {
     BLXMODEL_NORMAL,                /* the normal model, where each row contains one feature */
     BLXMODEL_SQUASHED,              /* the "squashed" model, where all MSPs from the same sequence appear on the same row */
-    
+
     BLXMODEL_NUM_MODELS             /* the number of model IDs. MUST BE LAST IN LIST */
   } BlxModelId;
 
@@ -138,7 +139,7 @@ typedef enum
 typedef enum
   {
     MSPFLAG_MIN,                        /* Start index for looping through flags */
-  
+
     MSPFLAG_LINK_FEATURES_BY_NAME,      /* whether features with the same name are part of the same parent */
     MSPFLAG_SQUASH_LINKED_FEATURES,     /* whether features with the same parent should be compressed onto the same line when you do 'squash matches' */
     MSPFLAG_SQUASH_IDENTICAL_FEATURES,  /* whether alignments that are identical should be compressed onto the same line when you do 'squash matches' */
@@ -217,7 +218,7 @@ typedef struct _BlxColumnInfo
     const char *sortName;       /* the name to display in the sort-by drop-down box (NULL if the view is not sortable on this column) */
 
     GQuark emblId;              /* 2-char embl line ID, e.g. 'SQ' for sequence or 'OS' for organism */
-    GQuark emblTag;             /* tag name within an embl line, e.g. the 'tissue_type' tag within the 'FT' section. 
+    GQuark emblTag;             /* tag name within an embl line, e.g. the 'tissue_type' tag within the 'FT' section.
                                  * Only supports tags of the following format (i.e. like those in the 'FT' section):
                                  *     /tissue_type="testis"    */
 
@@ -238,14 +239,14 @@ typedef struct _BlxSequence
   char *idTag;                     /* Unique identifier e.g. from ID tag in GFF files */
 
   GArray* values;                  /* Array of values (as GValue) for the columns */
- 
+
   BlxStrand strand;                /* which strand of the sequence this is */
   gboolean sequenceReqd;           /* whether the sequence data is required (e.g. it is not needed for exons/introns etc.) */
 
-  IntRange qRangeFwd;              /* the extent of alignments from this sequence on the ref sequence forward strand */ 
-  IntRange qRangeRev;              /* the extent of alignments from this sequence on the ref sequence reverse strand */ 
+  IntRange qRangeFwd;              /* the extent of alignments from this sequence on the ref sequence forward strand */
+  IntRange qRangeRev;              /* the extent of alignments from this sequence on the ref sequence reverse strand */
   char *organismAbbrev;            /* internally-calculated abbreviation for the Organism column value, if set */
-  
+
   GList *mspList;                  /* list of MSPs from this sequence */
 } BlxSequence;
 
@@ -263,9 +264,9 @@ typedef struct _FeatureSeries
 
 /* Shapes of XY curves */
 typedef enum
-{ 
-  BLXCURVE_PARTIAL, 
-  BLXCURVE_INTERPOLATE, 
+{
+  BLXCURVE_PARTIAL,
+  BLXCURVE_INTERPOLATE,
   BLXCURVE_BADSHAPE
 } BlxCurveShape;
 
@@ -278,24 +279,24 @@ typedef struct _MSP
 
   struct _MSP       *next;
   GList             *childMsps;    /* Child MSPs of this MSP if it has them, e.g. an exon has CDS and UTR children (part_of relationship). */
-  
+
   BlxMspType        type;          /* The type of the MSP, e.g. match, exon, SNP etc. */
   gdouble           score;         /* Score as a percentage. Technically this should be a weighted score taking into account gaps, length of the match etc., but for unknown reasons the ID has always been passed instead of score and the ID gets stored in here */
   gdouble           id;            /* Identity as a percentage. A simple comparison of bases within the match, ignoring gaps etc. Currently this is calculated internally by blixem. */
   int               phase;         /* phase: q start coord is offset by this amount to give the first base in the first complete codon (only relevant to CDSs) */
   GQuark            filename;      /* optional filename, e.g. for features used to fetch data from a bam file */
-  
+
   char              *qname;        /* For Dotter, the MSP can belong to either sequence */
   IntRange          qRange;        /* the range of coords on the ref sequence where the alignment lies */
   BlxStrand         qStrand;       /* which strand on the reference sequence the match is on */
   int               qFrame;        /* which frame on the reference sequence the match is on */
-  
+
   BlxSequence       *sSequence;    /* pointer to a struct holding info about the sequence/strand this match is from */
   char              *sname;        /* sequence name (could be different to the sequence name in
                                       the blxSequence e.g. exons have a postfixed 'x') */
   char              *sname_orig;   /* sequence name, original case version of sname. */
   IntRange          sRange;        /* the range of coords on the match sequence where the alignment lies */
-  
+
   /* The following ranges are all calculated from the above but are
    * cached in the MSP because they are used a lot. Note that these
    * these are not current used by dotter so dotter does not bother to
@@ -303,13 +304,13 @@ typedef struct _MSP
   IntRange          displayRange;  /* the same range as qRange but in display coords */
   IntRange          fullRange;     /* the full range of display coords to show this match against (includes any unaligned portions of sequence that we're showing) */
   IntRange          fullSRange;    /* the full range of coords on the match sequence that we're showing (including any unaligned portions of sequence) */
-  
+
   char              *desc;         /* Optional description text for the MSP */
   GSList            *gaps;         /* Array of "gaps" in this homolgy (this is a bit of a misnomer because the array
                                     * gives the ranges of the bits that align rather than the ranges of the gaps in between */
-  
+
   BlxStyle          *style;        /* Specifies drawing style for this MSP, e.g. fill color and line color */
-  
+
   /* obsolete? */
   FeatureSeries     *fs;           /* Feature series that this MSP belongs to */
   GdkColor          fsColor;       /* Color to draw this MSP in the feature series */
@@ -350,12 +351,12 @@ int                   mspGetQRangeLen(const MSP* const msp);
 int                   mspGetSRangeLen(const MSP* const msp);
 int                   mspGetMatchSeqLen(const MSP* const msp);
 
-const GdkColor*       mspGetColor(const MSP* const msp, 
+const GdkColor*       mspGetColor(const MSP* const msp,
                                   GArray *defaultColors,
                                   const int defaultColorId,
-                                  const BlxSequence *blxSeq, 
-                                  const gboolean selected, 
-                                  const gboolean usePrintColors, 
+                                  const BlxSequence *blxSeq,
+                                  const gboolean selected,
+                                  const gboolean usePrintColors,
                                   const gboolean fill,
                                   const int exonFillColorId,
                                   const int exonLineColorId,
@@ -421,9 +422,9 @@ MSP*                  createNewMsp(GArray* featureLists[],
                                    const gdouble score, const gdouble percentId, const int phase, const char *idTag,
                                    const char *qName, const int qStart, const int qEnd,
                                    const BlxStrand qStrand, const int qFrame,
-                                   const char *sName, const char *const sName_orig, int sStart, const int sEnd, 
+                                   const char *sName, const char *const sName_orig, int sStart, const int sEnd,
                                    const BlxStrand sStrand, char *sequence,
-                                   const GQuark filename, GHashTable *lookupTable, BlxSequence *blxSeq, GError **error);  
+                                   const GQuark filename, GHashTable *lookupTable, BlxSequence *blxSeq, GError **error);
 MSP*                  copyMsp(const MSP* const src, GArray* featureLists[], MSP **lastMsp, MSP **mspList, const gboolean addToParent, const gboolean sort);
 
 //void                  insertFS(MSP *msp, char *series);
@@ -495,11 +496,3 @@ void                  blxColumnCreate(BlxColumnId columnId, const gboolean creat
 gboolean              dataTypeGetFlag(const BlxDataType* const dataType, const MspFlag flag);
 
 #endif /* _blxmsp_included_ */
-
-
-
-
-
-
-
-
diff --git a/src/seqtoolsUtils/blxparser.cpp b/src/seqtoolsUtils/blxparser.cpp
index 78ae72cb615f21c327f040fe1b80e4d379be8240..9d9be652a1bf3e630b64acea9bd2964405bd7d3f 100644
--- a/src/seqtoolsUtils/blxparser.cpp
+++ b/src/seqtoolsUtils/blxparser.cpp
@@ -1,5 +1,6 @@
 /*  File: blxparser.c
  *  Author: Erik Sonnhammer, 1993-05-17
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -63,7 +64,7 @@ typedef enum {
 } BlxDotterError;
 
 
-typedef struct 
+typedef struct
 {
   GString *seqName;
   GString *seq;
@@ -77,10 +78,10 @@ static char *	    nextLineOfBuffer(const char **buffer_inout, GString *line_stri
 
 static gboolean	    parseHeaderLine(char *line, BlxBlastMode *blastMode, MSP *msp, IntRange *seq1Range, BlxParserState *parserState);
 
-static void	    parseBody(char *line, const int lineNum, BlxBlastMode blastMode, const int resFactor, MSP **msp, GString *line_string, char **seq1, 
-                              char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name, 
-                              BlxParserState *parserState, GArray* featureLists[], MSP **mspList, GList **seqList, GList *columnList, 
-                              GSList *supportedTypes, GSList *styles, char ***readSeq, int *readSeqLen, int *readSeqMaxLen, 
+static void	    parseBody(char *line, const int lineNum, BlxBlastMode blastMode, const int resFactor, MSP **msp, GString *line_string, char **seq1,
+                              char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name,
+                              BlxParserState *parserState, GArray* featureLists[], MSP **mspList, GList **seqList, GList *columnList,
+                              GSList *supportedTypes, GSList *styles, char ***readSeq, int *readSeqLen, int *readSeqMaxLen,
                               GKeyFile *keyFile, GHashTable *lookupTable, GHashTable *fetchMethods);
 
 static void	    parseEXBLXSEQBL(GArray* featureLists[], MSP **lastMsp, MSP **mspList, const BlxParserState parserState, BlxBlastMode blastMode, GString *line_string, GList **seqList, GList *columnList, GHashTable *lookupTable);
@@ -110,7 +111,7 @@ static void         checkReversedSubjectAllowed(const MSP *msp, BlxBlastMode bla
  *  Globals
  */
 
-/* These colors match those declared in systags, they must appear in the same order */	
+/* These colors match those declared in systags, they must appear in the same order */
 /* If you use more than 256 colours, code WILL break (see for instance the   */
 /* 'priority/colour' packing code in griddisp.c). This should not be a       */
 /* problem because that's a lot of colours and these colours are NOT used    */
@@ -142,9 +143,9 @@ static int getResFactorFromMode(const BlxBlastMode blastMode)
 
 
 static void parseLine(char *line, const int lineNum, BlxBlastMode *blastMode, const int resFactor, MSP **msp, GString *line_string,
-                      char **seq1, char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name, 
+                      char **seq1, char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name,
                       BlxParserState *parserState, GArray *featureLists[], MSP **mspList, GList **seqList, GList *columnList, GSList *supportedTypes,
-                      GSList *styles, char ***readSeq, int *readSeqLen, int *readSeqMaxLen, GKeyFile *keyFile, GHashTable *lookupTable, 
+                      GSList *styles, char ***readSeq, int *readSeqLen, int *readSeqMaxLen, GKeyFile *keyFile, GHashTable *lookupTable,
                       GHashTable *fetchMethods, GError **error)
 {
   if (!line)
@@ -155,7 +156,7 @@ static void parseLine(char *line, const int lineNum, BlxBlastMode *blastMode, co
     {
       return; /* empty file??? */
     }
-  
+
   /* get rid of any trailing '\n', there may not be one if the last line of the file
    * didn't have one. */
   char *charPtr = strchr(line, '\n');
@@ -163,13 +164,13 @@ static void parseLine(char *line, const int lineNum, BlxBlastMode *blastMode, co
     {
       *charPtr = 0;
     }
-  
+
   /* Check for header info first */
   if (parseHeaderLine(line, blastMode, *msp, seq1Range, parserState))
     {
-      return; 
+      return;
     }
-  
+
   if (*parserState == PARSER_START)
     {
       /* If first line was not a valid header, it's an error */
@@ -178,14 +179,14 @@ static void parseLine(char *line, const int lineNum, BlxBlastMode *blastMode, co
     }
   else
     {
-      parseBody(line, lineNum, *blastMode, resFactor, msp, line_string, 
+      parseBody(line, lineNum, *blastMode, resFactor, msp, line_string,
                 seq1, seq1name, seq1Range, seq2, seq2name, parserState, featureLists, mspList, seqList, columnList, supportedTypes,
                 styles, readSeq, readSeqLen, readSeqMaxLen, keyFile, lookupTable, fetchMethods);
     }
 }
 
 
-/* Utility to determine if we're at the end of a file stream (if given) or the 
+/* Utility to determine if we're at the end of a file stream (if given) or the
  * end of the buffer (if given) */
 static gboolean endOfFileOrBuffer(FILE *file, const char *buffer)
 {
@@ -195,7 +196,7 @@ static gboolean endOfFileOrBuffer(FILE *file, const char *buffer)
     result = feof(file);
   else if (buffer)
     result = (*buffer == 0 && *buffer == '\0');
-  
+
   return result;
 }
 
@@ -203,14 +204,14 @@ static gboolean endOfFileOrBuffer(FILE *file, const char *buffer)
  * parseFS or parseBuffer) */
 static void parseFileOrBuffer(MSP **MSPlist, FILE *file, const char *buffer_in, BlxBlastMode *blastMode,
                               GArray* featureLists[], GList **seqList, GList *columnList, GSList *supportedTypes, GSList *styles,
-                              char **seq1, char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name, 
+                              char **seq1, char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name,
                               GKeyFile *keyFile, GHashTable *lookupTable, GHashTable *fetchMethods, GError **error)
 {
   g_return_if_fail(file || buffer_in);
 
   const int resFactor = getResFactorFromMode(*blastMode);
   const char *buffer = buffer_in;
-  
+
   /* Find the last MSP in the list - new MSPs will be tagged on to the end of this. We also
    * want to keep a record of the last MSP that was added in case additional information needs
    * be be added to the same MSP (e.g. for XY plot information, where we have multiple lines that
@@ -218,36 +219,36 @@ static void parseFileOrBuffer(MSP **MSPlist, FILE *file, const char *buffer_in,
   MSP *msp = NULL;
   if (*MSPlist)
     {
-      msp = *MSPlist;  
+      msp = *MSPlist;
       while(msp->next)
 	msp = msp->next;
     }
 
   /* Allocate reusable/extendable string as our buffer..*/
-  GString *line_string = g_string_sized_new(MAXLINE + 1); 
+  GString *line_string = g_string_sized_new(MAXLINE + 1);
   int lineNum = 0;
 
   BlxParserState parserState = PARSER_START;
-  
+
   /* Variables for reading in SEQ data */
   char **readSeq = NULL;            /* buffer to hold the sequence we're reading in */
   int readSeqMaxLen = UNSET_INT;    /* current max length of the buffer */
   int readSeqLen = UNSET_INT;       /* current end pos of the data in the buffer */
 
   while (!endOfFileOrBuffer(file, buffer) && parserState != PARSER_ERROR)
-    { 
+    {
       ++lineNum;
-      
+
       line_string = g_string_truncate(line_string, 0) ;	    /* Reset buffer pointer. */
 
       char *line = NULL;
-      
+
       if (file)
         line = nextLineOfFile(file, line_string);
       else
         line = nextLineOfBuffer(&buffer, line_string);
-  
-      parseLine(line, lineNum, blastMode, resFactor, &msp, line_string, 
+
+      parseLine(line, lineNum, blastMode, resFactor, &msp, line_string,
                 seq1, seq1name, seq1Range, seq2, seq2name, &parserState, featureLists, MSPlist, seqList, columnList, supportedTypes,
                 styles, &readSeq, &readSeqLen, &readSeqMaxLen, keyFile, lookupTable, fetchMethods, error);
     }
@@ -276,7 +277,7 @@ static void parseFileOrBuffer(MSP **MSPlist, FILE *file, const char *buffer_in,
 	    }
 	}
     }
-  
+
   return ;
 }
 
@@ -292,7 +293,7 @@ static void parseFileOrBuffer(MSP **MSPlist, FILE *file, const char *buffer_in,
  */
 void parseFS(MSP **MSPlist, FILE *file, BlxBlastMode *blastMode,
              GArray* featureLists[], GList **seqList, GList *columnList, GSList *supportedTypes, GSList *styles,
-	     char **seq1, char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name, 
+	     char **seq1, char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name,
              GKeyFile *keyFile, GHashTable *lookupTable, GHashTable *fetchMethods, GError **error)
 {
   parseFileOrBuffer(MSPlist, file, NULL, blastMode, featureLists, seqList, columnList, supportedTypes,
@@ -303,7 +304,7 @@ void parseFS(MSP **MSPlist, FILE *file, BlxBlastMode *blastMode,
 /* Parse file contents from a string buffer */
 void parseBuffer(MSP **MSPlist, const char *buffer, BlxBlastMode *blastMode,
                  GArray* featureLists[], GList **seqList, GList *columnList, GSList *supportedTypes, GSList *styles,
-                 char **seq1, char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name, 
+                 char **seq1, char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name,
                  GKeyFile *keyFile, GHashTable *lookupTable, GError **error)
 {
   parseFileOrBuffer(MSPlist, NULL, buffer, blastMode, featureLists, seqList, columnList, supportedTypes,
@@ -336,33 +337,33 @@ static char *readFastaSeqFromStdin(FILE *seqfile, char *seqName, int *startCoord
 {
   char *resultSeq = NULL;
   char line[MAXLINE+1];
-  
+
   if (!fgets(line, MAXLINE, seqfile))
     {
       g_error("Error reading seqFile.\n") ;
     }
-  
+
   sscanf(line, "%s", seqName);
-  
+
   /* Loop through the input text and copy into an auto-expandable string */
   GString *resultStr = g_string_sized_new(5000);
   char currentChar = fgetc(seqfile);
-  
-  while (currentChar != '\n') 
+
+  while (currentChar != '\n')
     {
       /* Ignore whitespace/newlines */
-      if (!isWhitespaceChar(currentChar) && !isNewlineChar(currentChar)) 
+      if (!isWhitespaceChar(currentChar) && !isNewlineChar(currentChar))
         {
           validateIupacChar(&currentChar, seqType);
           g_string_append_c(resultStr, currentChar);
-        }      
-      
+        }
+
       currentChar = fgetc(seqfile);
     }
-  
+
   /* Set the result string and free the GString (but don't free its data) */
   resultSeq = g_string_free(resultStr, FALSE);
-  
+
   return resultSeq;
 }
 
@@ -382,11 +383,11 @@ static GArray *readFastaSeqsFromFile(FILE *seqfile, char *seqName, int *startCoo
   while (!feof(seqfile))
     {
       /* Get the next line */
-      if (!fgets(line, MAXLINE, seqfile)) 
+      if (!fgets(line, MAXLINE, seqfile))
         {
           break;
         }
-      
+
       if (*line == '>')
         {
           /* This line contains the sequence name (and possibly coords), so start a new sequence */
@@ -395,12 +396,12 @@ static GArray *readFastaSeqsFromFile(FILE *seqfile, char *seqName, int *startCoo
 
           ++curIdx;
           currentSeqPtr = &g_array_index(resultArr, SeqStruct, curIdx);
-          
+
           char *linePos = line + 1;
-          
+
           for ( ; *linePos && *linePos != ' ' && *linePos != '\n'; ++linePos)
             g_string_append_c(currentSeqPtr->seqName, *linePos);
-	
+
 	  if (startCoord && endCoord)
 	    {
 	      /* See if there coords specified on the line (format is ">seq_name start end") */
@@ -412,7 +413,7 @@ static GArray *readFastaSeqsFromFile(FILE *seqfile, char *seqName, int *startCoo
         {
           /* Ok, this must be a line containing sequence data. Loop through each char in the line. */
           char *linePos = line;
-          
+
           for ( ; *linePos; linePos++)
             {
               /* Ignore whitespace/newlines */
@@ -422,7 +423,7 @@ static GArray *readFastaSeqsFromFile(FILE *seqfile, char *seqName, int *startCoo
                   g_string_append_c(currentSeqPtr->seq, *linePos);
                 }
             }
-        }      
+        }
     }
 
   return resultArr;
@@ -434,17 +435,17 @@ static GArray *readFastaSeqsFromFile(FILE *seqfile, char *seqName, int *startCoo
 static char *concatenateFastaSeqs(FILE *seqfile, char *seqName, int *startCoord, int *endCoord, const BlxSeqType seqType)
 {
   GString *resultStr = g_string_new(NULL);
-  
+
   GArray *resultArr = readFastaSeqsFromFile(seqfile, seqName, startCoord, endCoord, seqType);
-  
+
   int i = 0;
   for ( ; i < (int)resultArr->len; ++i)
     {
       SeqStruct *curSeq = &g_array_index(resultArr, SeqStruct, i);
-      
+
       if (curSeq && curSeq->seq)
         g_string_append(resultStr, curSeq->seq->str);
-      
+
       if (seqName[0] == 0 && curSeq && curSeq->seqName)
         strcpy(seqName, curSeq->seqName->str);
 
@@ -454,19 +455,19 @@ static char *concatenateFastaSeqs(FILE *seqfile, char *seqName, int *startCoord,
 
   g_array_unref(resultArr);
   char *result = g_string_free(resultStr, FALSE);
-  
+
   return result;
 }
 
 
 /* Read in a FASTA sequence from an input, which can be a file or stdin.
- * 
- * Format: 
+ *
+ * Format:
  * >seq_name [start end] more words
  *
  *
  * Example with coords (e.g. for blixem):
- * 
+ *
  * >chr4-04 43747 43996 more words
  * aaatatgccattttagtattccacaattatgccaccatttggaaagaaag
  * gattgttgacagcaaaagatacccctactaaatatgggtcacagatattt
@@ -476,7 +477,7 @@ static char *concatenateFastaSeqs(FILE *seqfile, char *seqName, int *startCoord,
  *
  *
  * Example without coords (e.g. for belvu where coords are included in the name):
- * 
+ *
  * >5H1A_HUMAN/53-400 more words
  * GNACVVAAIAL...........ERSLQ.....NVANYLIG..S.LAVTDL
  * MVSVLV..LPMAAL.........YQVL..NKWTL......GQVT.CDL..
@@ -487,7 +488,7 @@ static char *concatenateFastaSeqs(FILE *seqfile, char *seqName, int *startCoord,
  */
 char *readFastaSeq(FILE *seqfile, char *seqName, int *startCoord, int *endCoord, const BlxSeqType seqType)
 {
-  if (seqfile == stdin) 
+  if (seqfile == stdin)
     return readFastaSeqFromStdin(seqfile, seqName, startCoord, endCoord, seqType);
   else
     return concatenateFastaSeqs(seqfile, seqName, startCoord, endCoord, seqType);
@@ -500,13 +501,13 @@ char *readFastaSeq(FILE *seqfile, char *seqName, int *startCoord, int *endCoord,
  *************************************************/
 
 /* Parse a line that contains shape information about a curve. */
-static BlxCurveShape parseShape(char *s) 
+static BlxCurveShape parseShape(char *s)
 {
-    if (!strcasecmp(s, "interpolate")) 
+    if (!strcasecmp(s, "interpolate"))
       return BLXCURVE_INTERPOLATE;
-    else if (!strcasecmp(s, "partial")) 
+    else if (!strcasecmp(s, "partial"))
       return BLXCURVE_PARTIAL;
-    else 
+    else
       return BLXCURVE_BADSHAPE;
 }
 
@@ -529,9 +530,9 @@ static void parseLook(MSP *msp, char *s)
 	else if (parseShape(cp) != BLXCURVE_BADSHAPE) {
 	    msp->fsShape = parseShape(cp);
 	}
-	else 
+	else
 	    g_critical("Unrecognised Look: %s\n", cp);
-	
+
 	cp = strtok(0, "," );
     }
     g_free(s2);
@@ -542,7 +543,7 @@ static void parseLook(MSP *msp, char *s)
 static void getDesc(MSP *msp, const char *s1, const char *s2)
 {
     const char *cp;
-    
+
     if (!(cp = strstr(s1, s2))) {
 	g_critical("Can't find back %s in %s", s2, s1);
 	return;
@@ -562,12 +563,12 @@ static void getDesc(MSP *msp, const char *s1, const char *s2)
 static char* prepSeq(const int sStart, char *inputSeq, BlxBlastMode blastMode)
 {
   char *result = NULL;
-  
-  if (blastMode == BLXMODE_TBLASTN || blastMode == BLXMODE_TBLASTX) 
+
+  if (blastMode == BLXMODE_TBLASTN || blastMode == BLXMODE_TBLASTX)
     {
       result = g_strdup(inputSeq) ;
     }
-  else 
+  else
     {
       result = (char*)g_malloc(sStart + strlen(inputSeq)+1);
       memset(result, SEQUENCE_CHAR_PAD,sStart); /* Fill up with dashes */
@@ -580,30 +581,30 @@ static char* prepSeq(const int sStart, char *inputSeq, BlxBlastMode blastMode)
 
 
 /* This routine parses MSP files that have either the exblx or seqbl format.
- * 
+ *
  * Format for both exblx and seqbl files is seven tab separated fields:
- * 
+ *
  * score reference_strand_and_frame reference_start reference_end match_start match_end match_name
- * 
+ *
  * For exblx this is optionally followed by:
- * 
+ *
  *             [match_description]
- * 
+ *
  * and optionally for seqbl by:
- * 
+ *
  *             [match_sequence]
- * 
+ *
  * e.g. for exblx
- * 
+ *
  *    11 (+2) 49052 49783 102 328 SW:YCF2_MARPO some description or other
- * 
+ *
  */
 static void parseEXBLXSEQBL(GArray* featureLists[],
                             MSP **lastMsp,
-                            MSP **mspList, 
-                            BlxParserState parserState, 
-                            BlxBlastMode blastMode, 
-                            GString *line_string, 
+                            MSP **mspList,
+                            BlxParserState parserState,
+                            BlxBlastMode blastMode,
+                            GString *line_string,
                             GList **seqList,
                             GList *columnList,
                             GHashTable *lookupTable)
@@ -611,7 +612,7 @@ static void parseEXBLXSEQBL(GArray* featureLists[],
   char *cp;
   char *line ;
   char *seq_pos = NULL ;
-  
+
   char sName[MAXLINE+1];
   char qframe[8] = "(+1)";
   int score = UNSET_INT;
@@ -625,8 +626,8 @@ static void parseEXBLXSEQBL(GArray* featureLists[],
   /* NOTE that sscanf will fail if the sequence name as spaces in it. The name
    * shouldn't have spaces but some do. If it does this function will probably fail
    * in trying to parse the MSP gap data. */
-  if (sscanf(line, "%d%s%d%d%d%d%s", 
-	     &score, qframe, &qStart, &qEnd, 
+  if (sscanf(line, "%d%s%d%d%d%d%s",
+	     &score, qframe, &qStart, &qEnd,
 	     &sStart, &sEnd, sName) != 7)
     {
       g_error("Incomplete MSP data in input file.\n");
@@ -637,16 +638,16 @@ static void parseEXBLXSEQBL(GArray* featureLists[],
     {
       strcpy(qframe, "(+1)");
     }
-  
+
   BlxStrand qStrand = BLXSTRAND_NONE;
   int qFrame = UNSET_INT;
   getStrandAndFrameFromString(qframe, &qStrand, &qFrame);
-  
+
   const BlxMspType mspType = getMspTypeFromScore(score);
 
   /* Create the new MSP */
   GError *error = NULL;
-  
+
   /* Hack for backwards compatibility: remove the 'i' or 'x' postfix from
    * intron and exon names. */
   int len = strlen(sName);
@@ -662,20 +663,20 @@ static void parseEXBLXSEQBL(GArray* featureLists[],
                           0, lookupTable, NULL, &error);
 
   reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
-  
-  /* Convert subject names to fetchable ones if from NCBI server 
-         
+
+  /* Convert subject names to fetchable ones if from NCBI server
+
   Rule 1: If there is a gi, use that.
   Rule 2: If no gi, use the first and last non-blank field as db:id.
   */
   if (strchr(msp->sname, '|'))
     {
       char *p, *src;
-  	
+
       src = g_strdup(msp->sname);
-  	
+
       p = strtok(src, "|");
-  	
+
       if (!strcasecmp(p, "GI"))
 	{
 	  /* Use only GI number */
@@ -688,7 +689,7 @@ static void parseEXBLXSEQBL(GArray* featureLists[],
 	{
 	  /* Try to make a proper db:name.  Use last non-blank field */
           char *db=p, *last=NULL;
-  	    
+
 	  p = strtok(0, "|");
 	  while (p) {
 	    if (*p && *p != ' ') last = p;
@@ -698,57 +699,57 @@ static void parseEXBLXSEQBL(GArray* featureLists[],
 	  strcat(msp->sname, ":");
 	  strcat(msp->sname, last);
 	}
-  	
+
       g_free(src);
     }
-  
+
   if (!(cp = strstr(line, sName)))
     {
       g_error("Line does not include %s\n", sName);
     }
-      
+
   seq_pos = cp + strlen(sName) ;
-            
+
   /* Parse the sequence, if applicable */
   char *sequence = NULL;
-  
+
   if (parserState == EXBLX_BODY)
     {
       /* skip over description */
-      while (*seq_pos && (*seq_pos == ' ' || *seq_pos == '\t')) 
+      while (*seq_pos && (*seq_pos == ' ' || *seq_pos == '\t'))
 	seq_pos++;
       if (*seq_pos && !isdigit(*seq_pos))
 	{
 	  while (*seq_pos && *seq_pos != ' ' && *seq_pos != '\t')
 	    seq_pos++;
-	  while (*seq_pos && (*seq_pos == ' ' || *seq_pos == '\t')) 
+	  while (*seq_pos && (*seq_pos == ' ' || *seq_pos == '\t'))
 	    seq_pos++;
 	}
     }
   else if (parserState == SEQBL_BODY)
     {
       /* Line contains chars other than sequence so get the starter data...not sure this test
-       * is necessary any more now we have a better mechanism of getting a whole line 
+       * is necessary any more now we have a better mechanism of getting a whole line
        * from a file. All this is a horrible mixture of strtok and sscanf but what else
        * to do.... */
       if (strcspn(line, "acgt") != 0)
 	{
 	  sequence = (char*)g_malloc(line_string->len + 1) ;
-	  
+
 	  if (sscanf(seq_pos, "%s", sequence) != 1)
 	    {
 	      g_error("Error parsing %s\n", line);
 	    }
-          
-          while (*seq_pos && (*seq_pos == ' ' || *seq_pos == '\t')) 
+
+          while (*seq_pos && (*seq_pos == ' ' || *seq_pos == '\t'))
             seq_pos++;
           while (*seq_pos && *seq_pos != ' ' && *seq_pos != '\t')
             seq_pos++;
-	  while (*seq_pos && (*seq_pos == ' ' || *seq_pos == '\t')) 
+	  while (*seq_pos && (*seq_pos == ' ' || *seq_pos == '\t'))
 	    seq_pos++;
 	}
     }
-  
+
   if (sequence)
     {
       addBlxSequenceData(msp->sSequence, sequence, &error);
@@ -763,12 +764,12 @@ static void parseEXBLXSEQBL(GArray* featureLists[],
           g_error("Incomplete MSP gap data for MSP '%s' [%d - %d]\n", msp->sname, msp->sRange.min(), msp->sRange.max()) ;
         }
     }
-  
+
   if (parserState == SEQBL_BODY)
-    { 
+    {
       checkReversedSubjectAllowed(msp, blastMode);
     }
-  
+
   return;
 }
 
@@ -782,46 +783,46 @@ static void parseEXBLXSEQBL(GArray* featureLists[],
  * "# seqbl_x"  or  "# exblx_x"
  *
  * Format for both exblx_x and seqbl_x files is eight tab separated fields:
- * 
+ *
  * score reference_strand_frame reference_start reference_end match_start match_end match_strand match_name
- * 
+ *
  * For exblx_x this is optionally followed by:
- * 
+ *
  *             [gaps data] [match_description]
- * 
+ *
  * and for seqbl_x by:
- * 
+ *
  *             [gaps data] [match_sequence]
- * 
+ *
  * The format of these extra fields is "tag value(s) ;", i.e.
- * 
+ *
  * "Gaps [ref_start ref_end match_start match_end]+ ;"
- * 
+ *
  * "Description the sequence description ;"
- * 
+ *
  * "Sequence aaagggtttttcccccc ;"
- * 
+ *
  * Currently acedb & ZMap export this format but other programs could also use it.
- * 
+ *
  */
 static void parseEXBLXSEQBLExtended(GArray* featureLists[],
-                                    MSP **lastMsp, 
-                                    MSP **mspList, 
-                                    BlxParserState parserState, 
-                                    BlxBlastMode blastMode, 
-                                    GString *line_string, 
+                                    MSP **lastMsp,
+                                    MSP **mspList,
+                                    BlxParserState parserState,
+                                    BlxBlastMode blastMode,
+                                    GString *line_string,
                                     GList **seqList,
                                     GList *columnList,
                                     GHashTable *lookupTable)
 {
   DEBUG_ENTER("parseEXBLXSEQBLExtended");
-  
+
   gboolean result = FALSE ;
   char *cp;
   char *line ;
   char *seq_pos = NULL;
   char *first_pos ;
-  
+
   char sName[MAXLINE+1];
   char qframe[8] ;
   char sframe[8] ;
@@ -836,9 +837,9 @@ static void parseEXBLXSEQBLExtended(GArray* featureLists[],
   /* NOTE that sscanf will fail if the sequence name as spaces in it. The name
    * shouldn't have spaces but some do. If it does this function will probably fail
    * in trying to parse the MSP gap data. */
-  if (sscanf(line, "%d%s%d%d%s%d%d%s", 
+  if (sscanf(line, "%d%s%d%d%s%d%d%s",
 	     &score,
-	     qframe, &qStart, &qEnd, 
+	     qframe, &qStart, &qEnd,
 	     sframe, &sStart, &sEnd, sName) != 8)
     {
       g_error("Incomplete MSP data in input file.\n");
@@ -847,9 +848,9 @@ static void parseEXBLXSEQBLExtended(GArray* featureLists[],
   /* MSPcrunch gives sframe for tblastn - restore qframe */
   if (blastMode == BLXMODE_TBLASTN)
     strcpy(qframe, "(+1)");
-  
+
   const BlxMspType mspType = getMspTypeFromScore(score) ;
-  
+
   /* Extract frame and strand from qframe/sframe text */
   BlxStrand qStrand = BLXSTRAND_NONE;
   int qFrame = UNSET_INT;
@@ -868,28 +869,28 @@ static void parseEXBLXSEQBLExtended(GArray* featureLists[],
     sName[len - 1] = '\0';
   else if (len && typeIsIntron(mspType) && toupper(sName[len - 1]) == 'I')
     sName[len - 1] = '\0';
-  
+
   MSP *msp = createNewMsp(featureLists, lastMsp, mspList, seqList, columnList, mspType, NULL, NULL,
                           score, UNSET_INT, 0,
-                          NULL, NULL, qStart, qEnd, qStrand, qFrame, 
+                          NULL, NULL, qStart, qEnd, qStrand, qFrame,
                           sName, NULL, sStart, sEnd, sStrand, NULL,
                           0, lookupTable, NULL, &error);
-  
+
   reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
-  
-  
-  /* Convert subject names to fetchable ones if from NCBI server 
+
+
+  /* Convert subject names to fetchable ones if from NCBI server
    *  Rule 1: If there is a gi, use that.
    *  Rule 2: If no gi, use the first and last non-blank field as db:id.
    */
   if (strchr(msp->sname, '|'))
     {
       char *p, *src;
-  	
+
       src = g_strdup(msp->sname);
-  	
+
       p = strtok(src, "|");
-  	
+
       if (!strcasecmp(p, "GI"))
 	{
 	  /* Use only GI number */
@@ -902,7 +903,7 @@ static void parseEXBLXSEQBLExtended(GArray* featureLists[],
 	{
 	  /* Try to make a proper db:name.  Use last non-blank field */
           char *db=p, *last=NULL;
-  	    
+
 	  p = strtok(0, "|");
 	  while (p) {
 	    if (*p && *p != ' ') last = p;
@@ -912,20 +913,20 @@ static void parseEXBLXSEQBLExtended(GArray* featureLists[],
 	  strcat(msp->sname, ":");
 	  strcat(msp->sname, last);
 	}
-  	
+
       g_free(src);
     }
-  
+
   if (!(cp = strstr(line, sName)))
     {
       g_error("Line does not include %s\n", sName);
     }
 
   seq_pos = cp + strlen(sName) ;
-            
+
   /* Now read attributes. */
   char *sequence = NULL;
-  
+
   if (seq_pos && *seq_pos)
     {
       first_pos = seq_pos ;
@@ -940,7 +941,7 @@ static void parseEXBLXSEQBLExtended(GArray* featureLists[],
 	  else
 	    {
 	      first_pos = NULL ;
-              
+
 	      /* Get first word and then parse.... */
 	      if ((strstr(seq_pos, BLX_GAPS_TAG)))
 		{
@@ -950,7 +951,7 @@ static void parseEXBLXSEQBLExtended(GArray* featureLists[],
 	      else if (parserState == EXBLX_BODY && (strstr(seq_pos, BLX_DESCRIPTION_TAG)))
 		{
 		  result = parseDescription(&seq_pos, msp);
-                  
+
 		  if (!result)
                     {
                       g_error("Bad description data\n");
@@ -960,28 +961,28 @@ static void parseEXBLXSEQBLExtended(GArray* featureLists[],
 		{
                   sequence = parseSequence(&seq_pos, msp, blastMode);
                   result = (sequence != NULL);
-                  
+
 		  if (!result)
                     {
                       g_error("Bad sequence data\n");
                     }
 		}
-              
+
 	    }
 	}
     }
-  
+
   if (sequence)
     {
       addBlxSequenceData(msp->sSequence, sequence, &error);
       reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
     }
-  
+
   if (parserState == SEQBL_X_BODY)
-    { 
+    {
       checkReversedSubjectAllowed(msp, blastMode);
     }
-  
+
   DEBUG_EXIT("parseEXBLXSEQBLExtended");
   return ;
 }
@@ -995,13 +996,13 @@ static char *nextLineOfBuffer(const char **buffer_inout, GString *line_string)
 
   const char *buffer = *buffer_inout;
   const char *cp = strchr(buffer, '\n');
-  
+
   if (cp)
     {
       /* Append the text up to the newline */
       int len = cp - buffer;
       g_string_append_len(line_string, buffer, len);
-      
+
       /* Chop off the bit before the newline, so buffer is ready for the next iteration */
       *buffer_inout = cp + 1;
     }
@@ -1072,7 +1073,7 @@ static char *nextLineOfFile(FILE *file, GString *line_string)
 
 /* Expects a string in the format "Gaps [ref_start ref_end match_start match_end]+ ; more text....."
  * and parses out the coords. Only spaces allowed in the string, not tabs. Moves text
- * to first char after ';'. 
+ * to first char after ';'.
  * The hasGapsTag is a bit of a hack to also allow this function to work with the old style
  * exblx file format that does not have a "Gaps" tag on the front of the gaps data. (In this case
  * we need to do something slightly different with strtok to start reading in the correct place
@@ -1103,7 +1104,7 @@ gboolean blxParseGaps(char **text, MSP *msp, const gboolean hasGapsTag)
 	      finished = TRUE;
 	      break;
 	    }
-	     
+
 	  switch (i)
 	  {
 	    case 0:
@@ -1114,7 +1115,7 @@ gboolean blxParseGaps(char **text, MSP *msp, const gboolean hasGapsTag)
 	      currentGap->sStart = convertStringToInt(currentGapStr);
 	      break;
 	    }
-	      
+
 	    case 1:
 	    {
 	      /* Second value is end of subject sequence range. Order values so that
@@ -1123,14 +1124,14 @@ gboolean blxParseGaps(char **text, MSP *msp, const gboolean hasGapsTag)
 	      sortValues(&currentGap->sStart, &currentGap->sEnd, mspGetMatchStrand(msp) == BLXSTRAND_FORWARD);
 	      break;
 	    }
-	      
+
 	    case 2:
 	    {
 	      /* Third value is start of reference sequence range */
 	      currentGap->qStart = convertStringToInt(currentGapStr);
 	      break;
 	    }
-	      
+
 	    case 3:
 	    {
 	      /* Fourth value is end of reference sequence range. Order values so that
@@ -1140,8 +1141,8 @@ gboolean blxParseGaps(char **text, MSP *msp, const gboolean hasGapsTag)
 	    }
 	  }
 
-	  currentGapStr = strtok(NULL, "\t ,") ; 
-	}  
+	  currentGapStr = strtok(NULL, "\t ,") ;
+	}
     }
 
   return result ;
@@ -1149,9 +1150,9 @@ gboolean blxParseGaps(char **text, MSP *msp, const gboolean hasGapsTag)
 
 
 /* Description, should just be plain text, format is:
- * 
+ *
  * "Description text ; more text....."
- * 
+ *
  * text following Description must not contain ';'. Moves text to first
  * char after ';'. */
 static gboolean parseDescription(char **text, MSP *msp)
@@ -1174,7 +1175,7 @@ static gboolean parseDescription(char **text, MSP *msp)
 static BlxSeqType getSeqTypeFromBlastMode(const BlxBlastMode blastMode, GError **error)
 {
   BlxSeqType result = BLXSEQ_NONE;
-  
+
   switch (blastMode)
     {
       case BLXMODE_BLASTP: /* fall through */
@@ -1182,25 +1183,25 @@ static BlxSeqType getSeqTypeFromBlastMode(const BlxBlastMode blastMode, GError *
       case BLXMODE_TBLASTX:
         result = BLXSEQ_PEPTIDE;
         break;
-        
+
       case BLXMODE_BLASTN: /* fall through */
       case BLXMODE_TBLASTN:
         result = BLXSEQ_DNA;
         break;
-        
+
       default:
         g_set_error(error, BLX_ERROR, 1, "Unknown blast mode '%d'.\n", blastMode);
         break;
     };
-  
+
   return result;
 }
 
 
 /* Description, should just be plain text, format is:
- * 
+ *
  * "Sequence text ; "
- * 
+ *
  * text following Sequence must not contain ';'. Moves text to first
  * char after ';'. */
 static char* parseSequence(char **text, MSP *msp, const BlxBlastMode blastMode)
@@ -1211,20 +1212,20 @@ static char* parseSequence(char **text, MSP *msp, const BlxBlastMode blastMode)
   startPtr = strtok(NULL, "\t ") ;				    /* skip "Sequence" */
 
   const int origLen = (int)strlen(startPtr);
-  
+
   int validLen = 0;
   char *cp = startPtr;
-  
+
   GError *tmpError = NULL;
   BlxSeqType seqType = getSeqTypeFromBlastMode(blastMode, &tmpError);
   reportAndClearIfError(&tmpError, G_LOG_LEVEL_ERROR);
-  
+
   while (isValidIupacChar(*cp, seqType))
     {
       ++cp;
       ++validLen;
     }
-  
+
   if (validLen < 1 || validLen < (int)strlen(startPtr))
     {
       g_error("Error parsing sequence data for MSP '%s'; sequence is only valid up to %d (out of length %d).\n",
@@ -1233,7 +1234,7 @@ static char* parseSequence(char **text, MSP *msp, const BlxBlastMode blastMode)
   else
     {
       result = (char*)g_malloc(validLen + 1) ;
-	  
+
       if (sscanf(startPtr, "%s", result) != 1)
 	{
 	  g_error("Error parsing sequence data '%s' for MSP '%s'\n", startPtr, mspGetSName(msp)) ;
@@ -1249,9 +1250,9 @@ static char* parseSequence(char **text, MSP *msp, const BlxBlastMode blastMode)
 static gboolean parseHeaderLine(char *line, BlxBlastMode *blastMode, MSP *msp, IntRange *seq1Range, BlxParserState *parserState)
 {
   //DEBUG_ENTER("parseHeaderLine(parserState=%d)", *parserState);
-  
+
   gboolean processed = FALSE;
-  
+
   if (!strncasecmp(line, "##gff-version", 13))
     {
       /* Check it's GFF version 3. Loop past any whitespace first. */
@@ -1259,8 +1260,8 @@ static gboolean parseHeaderLine(char *line, BlxBlastMode *blastMode, MSP *msp, I
       while (cp && (*cp == ' ' || *cp == '\t'))
 	{
 	  ++cp;
-	} 
-    
+	}
+
       if (*cp != '3')
 	{
 	  *parserState = PARSER_ERROR;
@@ -1299,13 +1300,13 @@ static gboolean parseHeaderLine(char *line, BlxBlastMode *blastMode, MSP *msp, I
       *parserState = EXBLX_BODY ;
       processed = TRUE ;
     }
-  else if (!strncasecmp(line, "# FS type=HSP", 13) || 
+  else if (!strncasecmp(line, "# FS type=HSP", 13) ||
 	   !strncasecmp(line, "# SFS type=HSP", 14))
     {
       *parserState = FS_HSP_BODY;
       processed = TRUE ;
     }
-  else if (!strncasecmp(line, "# FS type=GSP", 13) || 
+  else if (!strncasecmp(line, "# FS type=GSP", 13) ||
 	   !strncasecmp(line, "# SFS type=GSP", 14))
     {
       *parserState = FS_GSP_HEADER;
@@ -1318,7 +1319,7 @@ static gboolean parseHeaderLine(char *line, BlxBlastMode *blastMode, MSP *msp, I
       *parserState = FS_SEG_BODY;
       processed = TRUE ;
     }
-  else if (!strncasecmp(line, "# FS type=GFF", 13) || 
+  else if (!strncasecmp(line, "# FS type=GFF", 13) ||
 	   !strncasecmp(line, "# SFS type=GFF", 14))
     {
       *parserState = FS_GFF_BODY;
@@ -1375,7 +1376,7 @@ static gboolean parseHeaderLine(char *line, BlxBlastMode *blastMode, MSP *msp, I
 	  /* unused */
 	}
       else if (!strncasecmp(line, "# DESC ", 7) &&
-	       (*parserState == FS_HSP_BODY || *parserState == FS_GSP_HEADER || 
+	       (*parserState == FS_HSP_BODY || *parserState == FS_GSP_HEADER ||
 		*parserState == SEQBL_BODY))
 	{
 	  if (msp)
@@ -1388,7 +1389,7 @@ static gboolean parseHeaderLine(char *line, BlxBlastMode *blastMode, MSP *msp, I
           char qName[MAXLINE + 1];
           int qStart = UNSET_INT;
           int qEnd = UNSET_INT;
-          
+
           if (sscanf(line, "# sequence-region%s%d%d", qName, &qStart, &qEnd) < 3)
             {
               g_warning("Error parsing sequence-region line in input file. Sequence range was not set. \"%s\"\n", line);
@@ -1398,18 +1399,18 @@ static gboolean parseHeaderLine(char *line, BlxBlastMode *blastMode, MSP *msp, I
               seq1Range->set(qStart, qEnd);
             }
         }
-	
+
       processed = TRUE;
     }
-  else if (*line == '>' && 
+  else if (*line == '>' &&
            (*parserState == FASTA_SEQ_BODY || *parserState == FASTA_SEQ_IGNORE))
     {
       /* We can have multiple fasta sequences after the ##FASTA comment line.
-       * They don't have another ##FASTA comment so we need to look for the 
+       * They don't have another ##FASTA comment so we need to look for the
        * '>' which indicates the header line of the fasta data. Only do this if
        * we've already seen the ##FASTA comment, though. */
       *parserState = FASTA_SEQ_HEADER;
-      processed = FALSE; /* more info exists on the header line that we need to parse out */      
+      processed = FALSE; /* more info exists on the header line that we need to parse out */
     }
 
   //DEBUG_EXIT("parseHeaderLine returning processed = %d, (parserState = %d)", processed, *parserState);
@@ -1418,9 +1419,9 @@ static gboolean parseHeaderLine(char *line, BlxBlastMode *blastMode, MSP *msp, I
 
 
 /* Parse data from the given line into an MSP of type FS_HSP */
-static void parseFsHsp(char *line, 
+static void parseFsHsp(char *line,
                        BlxBlastMode blastMode,
-                       GArray* featureLists[], 
+                       GArray* featureLists[],
                        MSP **lastMsp,
                        MSP **mspList,
                        GList **seqList,
@@ -1437,17 +1438,17 @@ static void parseFsHsp(char *line,
   int qEnd = UNSET_INT;
   int sEnd = UNSET_INT;
   int score = UNSET_INT;
-  
+
   /* <score> <qname> <qframe> <qstart> <qend> <sname> <sframe> <sstart> <ssend> <sequence> [annotation] */
-  if (sscanf(line, "%d%s%s%d%d%s%s%d%d%s", 
-	     &score, 
-	     qName, qframe+1, &qStart, &qEnd, 
+  if (sscanf(line, "%d%s%s%d%d%s%s%d%d%s",
+	     &score,
+	     qName, qframe+1, &qStart, &qEnd,
 	     sName, sframe+1, &sStart, &sEnd,
 	     seq) != 10)
     {
       g_error("Error parsing data, type FS_HSP: \"%s\"\n", line);
     }
-  
+
   /* Get the strand and frame from the frame strings */
   BlxStrand qStrand = BLXSTRAND_NONE;
   int qFrame = UNSET_INT;
@@ -1464,8 +1465,8 @@ static void parseFsHsp(char *line,
   GError *error = NULL;
 
   MSP *msp = createNewMsp(featureLists, lastMsp, mspList, seqList, columnList, BLXMSP_HSP, NULL,  NULL,
-                          score, UNSET_INT, 0, 
-                          NULL, qName, qStart, qEnd, qStrand, qFrame, 
+                          score, UNSET_INT, 0,
+                          NULL, qName, qStart, qEnd, qStrand, qFrame,
                           sName, NULL, sStart, sEnd, sStrand, sSeq, 0, lookupTable, NULL, &error);
 
   reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
@@ -1474,12 +1475,12 @@ static void parseFsHsp(char *line,
 
 
 /* Parse data from the given line, which contains feature-series GSP header info */
-static void parseFsGspHeader(char *line, 
-                             BlxBlastMode blastMode, 
-                             GArray* featureLists[], 
-                             MSP **lastMsp, 
-                             MSP **mspList, 
-                             BlxParserState *parserState, 
+static void parseFsGspHeader(char *line,
+                             BlxBlastMode blastMode,
+                             GArray* featureLists[],
+                             MSP **lastMsp,
+                             MSP **mspList,
+                             BlxParserState *parserState,
                              GList **seqList,
                              GList *columnList)
 {
@@ -1488,7 +1489,7 @@ static void parseFsGspHeader(char *line,
 
   /* Will write this as soon as MSPcrunch generates it */
   g_warning("Parser for GSP data not implemented\n");
-  
+
   /* Start parsing the GSP data next */
   *parserState = FS_GSP_BODY ;
 }
@@ -1502,11 +1503,11 @@ static void parseFsGspData(char *line, MSP *msp)
 
 
 /* Parse data from the given line into an MSP of type FS_SEG (Feature Series Segment) */
-static void parseFsSeg(char *line, 
-                       BlxBlastMode blastMode, 
-                       GArray* featureLists[], 
-                       MSP **lastMsp, 
-                       MSP **mspList, 
+static void parseFsSeg(char *line,
+                       BlxBlastMode blastMode,
+                       GArray* featureLists[],
+                       MSP **lastMsp,
+                       MSP **mspList,
                        GList **seqList,
                        GList *columnList,
                        GHashTable *lookupTable)
@@ -1517,38 +1518,38 @@ static void parseFsSeg(char *line,
   int score = UNSET_INT;
   int qStart = UNSET_INT;
   int qEnd = UNSET_INT;
-  
+
   /* <score> <sequencename> <seriesname> <start> <end> <look> [annotation] */
   if (sscanf(line, "%d%s%s%d%d%s",
 	     &score, qName, series, &qStart, &qEnd, look) != 6)
     {
       g_error("Error parsing data, type FS_SEG: \"%s\"\n", line);
     }
-  
-  
+
+
   /* Create the new MSP */
   GError *error = NULL;
-  
+
   MSP *msp = createNewMsp(featureLists, lastMsp, mspList, seqList, columnList, BLXMSP_FS_SEG, NULL, NULL,
-                          UNSET_INT, UNSET_INT, 0, 
-                          NULL, qName, qStart, qStart, BLXSTRAND_NONE, 1, 
+                          UNSET_INT, UNSET_INT, 0,
+                          NULL, qName, qStart, qStart, BLXSTRAND_NONE, 1,
                           series, NULL, qStart, qStart, BLXSTRAND_NONE, NULL, 0, lookupTable, NULL, &error);
 
   /* Parse in additional feature-series info */
   parseLook(msp, look);
   getDesc(msp, line, look);
 //  insertFS(msp, series);
-  
+
   reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
 }
 
 
 /* Parse data from a line of text that contains feature-series data in GFF format */
-static void parseFsGff(char *line, 
-                       BlxBlastMode blastMode, 
-                       GArray* featureLists[], 
-                       MSP **lastMsp, 
-                       MSP **mspList, 
+static void parseFsGff(char *line,
+                       BlxBlastMode blastMode,
+                       GArray* featureLists[],
+                       MSP **lastMsp,
+                       MSP **mspList,
                        GList **seqList,
                        GList *columnList,
                        GHashTable *lookupTable)
@@ -1560,86 +1561,86 @@ static void parseFsGff(char *line,
   char qframe[8] = "(+1)";
   int qStart = UNSET_INT;
   int qEnd = UNSET_INT;
-  
+
   /* <sequencename> <seriesname> <look> <start> <end> <score> <strand> <transframe> [annotation] */
   if (sscanf(line, "%s%s%s%d%d%s%s%s",
-	     qName, series, look, &qStart, &qEnd, scorestring, 
+	     qName, series, look, &qStart, &qEnd, scorestring,
 	     qframe+1, qframe+2) != 8)
     {
       g_error("Error parsing data, type FS_GFF: \"%s\"\n", line);
     }
-  
+
   int score = UNSET_INT;
-  if (!strcmp(scorestring, ".")) 
+  if (!strcmp(scorestring, "."))
     {
       score = 100;
     }
-  else 
+  else
     {
       score = 50.0*atof(scorestring);
     }
-  
+
   BlxStrand qStrand = BLXSTRAND_NONE;
   int qFrame = UNSET_INT;
   getStrandAndFrameFromString(qframe, &qStrand, &qFrame);
-  
+
   /* Create the new MSP */
   GError *error = NULL;
-  
+
   MSP *msp = createNewMsp(featureLists, lastMsp, mspList, seqList, columnList, BLXMSP_FS_SEG, NULL, NULL,
-                          score, UNSET_INT, 0, 
-                          NULL, qName, qStart, qEnd, qStrand, qFrame, 
+                          score, UNSET_INT, 0,
+                          NULL, qName, qStart, qEnd, qStrand, qFrame,
                           series, NULL, qStart, qEnd, BLXSTRAND_FORWARD, NULL, 0, lookupTable, NULL, &error);
-  
+
 
   /* Parse additional feature-series information */
   msp->desc = g_strdup(series);
   parseLook(msp, look);
 //  insertFS(msp, series);
-  
+
   reportAndClearIfError(&error, G_LOG_LEVEL_ERROR);
 }
 
 
 /* Parse data from the given line, which contains header info for Feature-Series XY-plot data */
-static void parseFsXyHeader(char *line, 
-                            BlxBlastMode blastMode, 
+static void parseFsXyHeader(char *line,
+                            BlxBlastMode blastMode,
                             GArray* featureLists[],
-                            MSP **lastMsp, 
-                            MSP **mspList, 
-                            char **seq1, 
-                            char *seq1name, 
+                            MSP **lastMsp,
+                            MSP **mspList,
+                            char **seq1,
+                            char *seq1name,
                             char **seq2,
-                            char *seq2name, 
+                            char *seq2name,
                             BlxParserState *parserState,
                             GList **seqList,
                             GList *columnList,
                             GHashTable *lookupTable)
 {
   int i, seqlen;
-  
+
   char series[MAXLINE+1];
   char qName[MAXLINE+1];
   char look[MAXLINE+1];
-  
+
   /* # FS type=XY <sequencename> <seriesname> <look> [annotation] */
   if (sscanf(line+13, "%s%s%s", qName, series, look) != 3)
     {
       g_error("Error parsing data, type XY: \"%s\"\n", line);
     }
-  
+
   if (!seq1name || !seq2name)
     {
       g_error("Sequencenames not provided\n");
     }
-  
+
   if (!strcasecmp(qName, seq1name) || !strcmp(qName, "@1"))
     {
       if (!seq1 || !*seq1)
         {
           g_error("Sequence for %s not provided\n", qName);
         }
-        
+
       seqlen = strlen(*seq1);
     }
   else if (!strcasecmp(qName, seq2name) || !strcmp(qName, "@2"))
@@ -1655,37 +1656,37 @@ static void parseFsXyHeader(char *line,
     {
       g_error("Invalid sequence name: %s\n", qName);
     }
-  
+
   if (!seqlen)
-    { 
+    {
       g_error("Sequence for %s is empty\n", qName);
     }
 
   /* Create an MSP to put the data in */
   GError *error = NULL;
-  
+
   MSP *msp = createNewMsp(featureLists, lastMsp, mspList, seqList, columnList, BLXMSP_XY_PLOT, NULL, NULL,
-                          UNSET_INT, UNSET_INT, 0, 
+                          UNSET_INT, UNSET_INT, 0,
                           NULL, qName, UNSET_INT, UNSET_INT, BLXSTRAND_FORWARD, 1,
                           series, NULL, UNSET_INT, UNSET_INT, BLXSTRAND_FORWARD, NULL, 0, lookupTable, NULL, &error);
-  
+
   reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL);
 
   /* Add additional MSP information */
   msp->xy = g_array_sized_new(TRUE, FALSE, sizeof(int), seqlen);
-  
+
   for (i = 0; i < seqlen; i++)
     {
       int *iPtr = (int*)g_malloc(sizeof(int));
       *iPtr = XY_NOT_FILLED;
       g_array_append_val(msp->xy, *iPtr);
     }
-  
+
   msp->fsShape = BLXCURVE_INTERPOLATE; /* default */
   parseLook(msp, look);
   getDesc(msp, line, look);
-//  insertFS(msp, series); 
-  
+//  insertFS(msp, series);
+
   /* Start parsing the actual XY data next */
   *parserState = FS_XY_BODY;
 }
@@ -1697,47 +1698,47 @@ static void parseFsXyData(char *line, MSP *msp)
 {
   /* XY coordinates go in to the XY list in the current MSP. */
   int x, y;
-  if (sscanf(line, "%d%d", &x, &y) != 2) 
+  if (sscanf(line, "%d%d", &x, &y) != 2)
     {
       g_error("Error parsing data file, type FS_XY_BODY: \"%s\"\n", line);
     }
-    
+
   int *xyVal = &g_array_index(msp->xy, int, x - 1);
   *xyVal = y;
 }
 
 
 /* Parse a line that contains feature-series sequence header info */
-static void parseFsSeqHeader(char *line, 
+static void parseFsSeqHeader(char *line,
                              char **seq1, char *seq1name, char **seq2, char *seq2name,
                              char ***readSeq, int *readSeqLen, int *readSeqMaxLen, BlxParserState *parserState)
 {
   /* We have a header for sequence data. Read in the sequence name from the header line. */
   char series[MAXLINE+1];
   char qname[MAXLINE+1];
-  
-  if (sscanf(line+14, "%s%s", qname, series) != 2) 
+
+  if (sscanf(line+14, "%s%s", qname, series) != 2)
     {
       g_error("Error parsing data file, type FS_SEQ_HEADER: \"%s\"\n", line);
     }
-  
+
   /* We need to allocate a string to read the seqeunce data in to. We want to allocate the releavant
    * return pointer (seq1 or seq2) depending on which string was indicated in the header line. */
-  if (!strcmp(qname, "@1")) 
+  if (!strcmp(qname, "@1"))
     {
       *readSeq = seq1;
       strcpy(seq1name, series);
     }
-  else if (!strcmp(qname, "@2")) 
+  else if (!strcmp(qname, "@2"))
     {
       *readSeq = seq2;
       strcpy(seq2name, series);
     }
-  
+
   *readSeqMaxLen = MAXLINE;
   **readSeq = (char*)g_malloc(*readSeqMaxLen + 1);
   *readSeqLen = 0;
-  
+
   /* Update the parser state so that we proceed to parse the sequence data next */
   *parserState = FS_SEQ_BODY;
 }
@@ -1753,19 +1754,19 @@ static void parseSeqData(char *line, char ***readSeq, int *readSeqLen, int *read
       /* Not initialised for reading in sequence; do nothing */
       return;
     }
-  
+
   /* Read in the actual sequence data. It may span several lines, so concatenate each
    * one on to the end of our result. */
-  
+
   /* First, validate that we have valid input */
   char *cp = line;
   for ( ; cp && *cp; ++cp)
     {
       validateIupacChar(cp, seqType);
     }
-  
+
   /* Also reealloc memory if necessary */
-  if (*readSeqLen + (int)strlen(line) > *readSeqMaxLen) 
+  if (*readSeqLen + (int)strlen(line) > *readSeqMaxLen)
     {
       char *tmp;
       *readSeqMaxLen += MAXLINE + strlen(line);
@@ -1774,10 +1775,10 @@ static void parseSeqData(char *line, char ***readSeq, int *readSeqLen, int *read
       g_free(**readSeq);
       **readSeq = tmp;
     }
-  
+
   /* Copy in the contents of the line */
   strcpy(**readSeq + *readSeqLen, line);
-  
+
   /* Update the length counter */
   *readSeqLen += strlen(line);
 }
@@ -1785,23 +1786,23 @@ static void parseSeqData(char *line, char ***readSeq, int *readSeqLen, int *read
 
 /* Utility to call the relevant parser function to parse the current data type */
 static void parseBody(char *line, const int lineNum, BlxBlastMode blastMode, const int resFactor, MSP **lastMsp, GString *line_string,
-                      char **seq1, char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name, 
+                      char **seq1, char *seq1name, IntRange *seq1Range, char **seq2, char *seq2name,
                       BlxParserState *parserState, GArray *featureLists[], MSP **mspList, GList **seqList, GList *columnList, GSList *supportedTypes,
                       GSList *styles, char ***readSeq, int *readSeqLen, int *readSeqMaxLen, GKeyFile *keyFile, GHashTable *lookupTable, GHashTable *fetchMethods)
 {
   //DEBUG_ENTER("parseBody(parserState=%d, line=%d)", *parserState, lineNum);
 
   GError *tmpError = NULL;
-  
+
   /* Call the relevant function for the current type of data being parsed */
   switch (*parserState)
   {
     case GFF_3_HEADER:
       parseGff3Header(lineNum, lastMsp, mspList, parserState, line_string, seqList, seq1name, seq1Range, &tmpError);
       break;
-      
+
     case GFF_3_BODY:
-      parseGff3Body(lineNum, featureLists, lastMsp, mspList, parserState, line_string, 
+      parseGff3Body(lineNum, featureLists, lastMsp, mspList, parserState, line_string,
                     seqList, columnList, supportedTypes, styles, resFactor, keyFile, seq1Range, lookupTable, fetchMethods);
       break;
 
@@ -1809,7 +1810,7 @@ static void parseBody(char *line, const int lineNum, BlxBlastMode blastMode, con
     case EXBLX_BODY:
       parseEXBLXSEQBL(featureLists, lastMsp, mspList, *parserState, blastMode, line_string, seqList, columnList, lookupTable) ;
       break;
-      
+
     case SEQBL_X_BODY: /* fall through */
     case EXBLX_X_BODY:
       parseEXBLXSEQBLExtended(featureLists, lastMsp, mspList, *parserState, blastMode, line_string, seqList, columnList, lookupTable) ;
@@ -1826,7 +1827,7 @@ static void parseBody(char *line, const int lineNum, BlxBlastMode blastMode, con
     case FS_GSP_BODY:
       parseFsGspData(line, *lastMsp);
       break;
-      
+
     case FS_GFF_BODY:
       parseFsGff(line, blastMode, featureLists, lastMsp, mspList, seqList, columnList, lookupTable);
       break;
@@ -1834,11 +1835,11 @@ static void parseBody(char *line, const int lineNum, BlxBlastMode blastMode, con
     case FS_SEG_BODY:
       parseFsSeg(line, blastMode, featureLists, lastMsp, mspList, seqList, columnList, lookupTable);
       break;
-      
+
     case FS_XY_HEADER:
       parseFsXyHeader(line, blastMode, featureLists, lastMsp, mspList, seq1, seq1name, seq2, seq2name, parserState, seqList, columnList, lookupTable);
       break;
-      
+
     case FS_XY_BODY:
       parseFsXyData(line, *lastMsp);
       break;
@@ -1859,7 +1860,7 @@ static void parseBody(char *line, const int lineNum, BlxBlastMode blastMode, con
     case FASTA_SEQ_IGNORE:
       /* ignore this line of fasta sequence */
       break;
-      
+
     case PARSER_ERROR:
       break;
 
@@ -1868,7 +1869,7 @@ static void parseBody(char *line, const int lineNum, BlxBlastMode blastMode, con
       *parserState = PARSER_ERROR;
       break;
   };
-  
+
   if (tmpError)
     {
       reportAndClearIfError(&tmpError, G_LOG_LEVEL_CRITICAL);
@@ -1884,7 +1885,7 @@ static void parseBody(char *line, const int lineNum, BlxBlastMode blastMode, con
 static BlxMspType getMspTypeFromScore(const int score)
 {
   BlxMspType result = BLXMSP_INVALID;
-  
+
   if (score >= 0)
     {
       result = BLXMSP_MATCH;
@@ -1902,7 +1903,7 @@ static BlxMspType getMspTypeFromScore(const int score)
       result = BLXMSP_VARIATION;
     }
 
-  return result;  
+  return result;
 }
 
 
@@ -1941,7 +1942,3 @@ static void checkReversedSubjectAllowed(const MSP *msp, BlxBlastMode blastMode)
       g_error("Reversed subjects are not allowed in modes blastp or blastx.\n");
     }
 }
-
-
-
-
diff --git a/src/seqtoolsUtils/blxparser.hpp b/src/seqtoolsUtils/blxparser.hpp
index 7daabfbbf184e7f90759ce7a703ab3b016fb11d6..d478578ebcb6eb642bd77ca0d18c8622ca859b22 100644
--- a/src/seqtoolsUtils/blxparser.hpp
+++ b/src/seqtoolsUtils/blxparser.hpp
@@ -1,5 +1,6 @@
 /*  File: blxparser.h
  *  Author: Gemma Barson, 2010-09-02
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -29,10 +30,10 @@
  *      Malcolm Hinsley   (Sanger Institute, UK)  <mh17@sanger.ac.uk>
  *
  *  Description: Parser for Blixem and Dotter feature input files.
- *               
+ *
  *               GFF v3 is the preferred input file format. This parser also
  *               includes code to parse the old exblx or feature-series file
- *               types (e.g. as output from the MSPcrunch program). 
+ *               types (e.g. as output from the MSPcrunch program).
  *----------------------------------------------------------------------------
  */
 
diff --git a/src/seqtoolsUtils/iupac.hpp b/src/seqtoolsUtils/iupac.hpp
index fe2528918f49db4d2db4ad5b3dc6730384d96118..9dba3358574e0896787e8ae212a370f93b14b827 100644
--- a/src/seqtoolsUtils/iupac.hpp
+++ b/src/seqtoolsUtils/iupac.hpp
@@ -1,5 +1,6 @@
 /*  File: iupac.h
  *  Author: Fred Wobus, 1999-08-26
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -39,7 +40,7 @@
 
 int PAM120[23][23] =
   {
-    /*A   R   N   D   C   Q   E   G   H   I   L   K   M   F   P   S   T   W   Y   V   B   Z   X */ 
+    /*A   R   N   D   C   Q   E   G   H   I   L   K   M   F   P   S   T   W   Y   V   B   Z   X */
     { 3, -3, -1,  0, -3, -1,  0,  1, -3, -1, -3, -2, -2, -4,  1,  1,  1, -7, -4,  0,  1,  0, -1},
     {-3,  6, -1, -3, -4,  1, -3, -4,  1, -2, -4,  2, -1, -5, -1, -1, -2,  1, -5, -3, -1,  0, -1},
     {-1, -1,  4,  2, -5,  0,  1,  0,  2, -2, -4,  1, -3, -4, -2,  1,  0, -4, -2, -3,  4,  1, -1},
@@ -83,7 +84,7 @@ int aa_atob[]	/* ASCII-to-binary translation table */
 	NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
 	NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
 	NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
-	NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA 
+	NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
 };
 
 
@@ -150,7 +151,7 @@ struct iupactype
  * H = A/C/T (all but G)    D = T/G/A
  * V = G/C/A (all but T)    B = C/G/T
  * N = A/G/C/T (any)        N = A/G/C/T
- */ 
+ */
 #define IUPACSYMNUM 17
 struct iupactype iupac[IUPACSYMNUM] =
   {
diff --git a/src/seqtoolsUtils/seqtoolsFetch.cpp b/src/seqtoolsUtils/seqtoolsFetch.cpp
index a57bf57f1734fe0d4afdee2038891ca7a1f8740f..ae20a8df97ac766ce568fe479d8c505022133532 100644
--- a/src/seqtoolsUtils/seqtoolsFetch.cpp
+++ b/src/seqtoolsUtils/seqtoolsFetch.cpp
@@ -1,5 +1,6 @@
 /*  File: seqtoolsFetch.cpp
  *  Author: Gemma Guest, 2015-12-21
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
diff --git a/src/seqtoolsUtils/seqtoolsFetch.hpp b/src/seqtoolsUtils/seqtoolsFetch.hpp
index e45ab402753e0a1bbdd7bbe72822861155523010..4dfa08aab17e53edf3d7baf5ac8c2b50cd8f8e8a 100644
--- a/src/seqtoolsUtils/seqtoolsFetch.hpp
+++ b/src/seqtoolsUtils/seqtoolsFetch.hpp
@@ -1,5 +1,6 @@
 /*  File: seqtoolsFetch.hpp
  *  Author: Gemma Guest, 2015-12-21
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -40,7 +41,7 @@
 /* These are the supported fetch modes. ***If you add anything here, also add it in fetchModeStr*** */
 typedef enum
   {
-#ifdef PFETCH_HTML 
+#ifdef PFETCH_HTML
     BLXFETCH_MODE_HTTP,
     BLXFETCH_MODE_PIPE,
 #endif
@@ -76,7 +77,7 @@ typedef struct _BlxFetchMethod
 {
   GQuark name;                      /* fetch method name */
   BlxFetchMode mode;                /* the type of fetch method */
-  
+
   char *location;                   /* e.g. url, script, command, db location etc. */
   char *node;                       /* for socket fetch mode */
   int port;                         /* for socket and http/pipe fetch modes */
diff --git a/src/seqtoolsUtils/seqtoolsWebBrowser.cpp b/src/seqtoolsUtils/seqtoolsWebBrowser.cpp
index 314f4ead4960f18b7bde27b01b458e8f18acfeea..35a8ecc3ee6009e6b45cd1c9acf7a772cbbc4537 100644
--- a/src/seqtoolsUtils/seqtoolsWebBrowser.cpp
+++ b/src/seqtoolsUtils/seqtoolsWebBrowser.cpp
@@ -1,5 +1,6 @@
 /*  File: seqtoolsWebBrowser.c
  *  Author: Gemma Barson
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -59,22 +60,22 @@ static gboolean seqtools_g_string_replace(GString *string, const char *target, c
 /* Records information for running a specific browser. The intent here is to add enough
  * information to allow us to use stuff like Netscapes "open" subcommand which opens the
  * url in an already running netscape if there is one, otherwise in a new netscape.
- * 
+ *
  * (see w2/graphgdkremote.c in acedb for some useful stuff.)
- * 
+ *
  * (See manpage for more options for "open" on the Mac, e.g. we could specify to always
  * use Safari via the -a flag...which would also deal with badly specified urls...)
- * 
+ *
  * In the open_command the %U is substituted with the URL.
- * 
+ *
  * Note that if open_command is NULL then the executable name is simply combined with
  * the URL in the expected way to form the command:    "executable  URL"
- * 
- * 
+ *
+ *
  * Here's one from gnome...this will start in a new window or start a new browser as required.
  * /usr/bin/gnome-moz-remote --newwin www.acedb.org
- * 
- * 
+ *
+ *
  *  */
 #define BROWSER_PATTERN "%U"
 
@@ -100,7 +101,7 @@ static GQuark err_domain_G = 0 ;
 
 
 /*! @addtogroup seqtoolsutils
- * @{ || 
+ * @{ ||
  *  */
 
 
@@ -109,13 +110,13 @@ static GQuark err_domain_G = 0 ;
  * from an internal list of browsers for different machines. As so much can go
  * wrong this function returns FALSE and a GError struct when an error occurs.
  * You should call this function like this:
- * 
+ *
  *     GError *error = NULL ;
- * 
+ *
  *     if (!(seqtoolsLaunchWebBrowser("www.acedb.org", &error)))
- *       { || 
+ *       { ||
  *         printf("Error: %s\n", error->message) ;
- * 
+ *
  *         g_error_free(error) ;
  *       }
  *
@@ -128,61 +129,61 @@ gboolean seqtoolsLaunchWebBrowser(const char *link, GError **error)
   gboolean result = FALSE ;
   BrowserConfig best_browser = NULL ;
   char *browser = NULL ;
-  
-  g_assert(link && *link && error && !(*error)) ; 
-  
+
+  g_assert(link && *link && error && !(*error)) ;
+
   if (!err_domain_G)
     err_domain_G = g_quark_from_string(domain_G) ;
-  
-  
+
+
   /* Check we have a registered browser for this system. */
   browser = findBrowser(browsers_G, &best_browser, error) ;
-  
-  
-  
+
+
+
   /* Run the browser in a separate process. */
   if (browser)
     {
       char *url ;
       GString *sys_cmd ;
       int sys_rc ;
-      
+
       /* Translate troublesome chars to their url escape sequences, see translateURLChars() for explanation. */
-      url = translateURLChars(link) ;  
-      
+      url = translateURLChars(link) ;
+
       sys_cmd = g_string_sized_new(1024) ;		    /* Should be long enough for most urls. */
-      
+
       if (best_browser->open_command)
 	{
 	  makeBrowserCmd(sys_cmd, best_browser, url) ;
 	}
-      else 
+      else
 	{
 	  g_string_printf(sys_cmd, "%s \"%s\"", browser, url) ;
 	}
-      
+
       /* Make sure browser is run in background by the shell so we do not wait.
        * NOTE that because we do not wait for the command to be executed,
        * we cannot tell if the command actually worked, only that the shell
        * got exec'd */
-      g_string_append(sys_cmd, " &") ;    
-      
+      g_string_append(sys_cmd, " &") ;
+
       /* We could do much more to interpret what exactly failed here... */
       if ((sys_rc = system(sys_cmd->str)) == EXIT_SUCCESS)
 	{
 	  result = TRUE ;
 	}
-      else   
+      else
 	{
 	  *error = g_error_new(err_domain_G, BROWSER_COMMAND_FAILED,
 			       "Failed to run command \"%s\".", sys_cmd->str) ;
 	}
-      
+
       g_string_free(sys_cmd, TRUE) ;
       g_free(url) ;
     }
-  
-  
+
+
   return result ;
 }
 
@@ -194,14 +195,14 @@ gboolean seqtoolsLaunchWebBrowser(const char *link, GError **error)
 
 
 
-/* 
+/*
  *                Internal functions.
  */
 
 
 
 
-/* Gets the system name and then finds browsers for that system from our || 
+/* Gets the system name and then finds browsers for that system from our ||
  * our internal list, if it finds the browser is in the users path then
  * returns the path otherwise returns NULL and sets error to give details
  * of what went wrong. */
@@ -210,35 +211,35 @@ static char *findBrowser(BrowserConfig browsers_in, BrowserConfig *browser_out,
   char *browser = NULL ;
   struct utsname unamebuf ;
   gboolean browser_in_list = FALSE ;
-  
+
   if (uname(&unamebuf) == -1)
     {
       *error = g_error_new_literal(err_domain_G, BROWSER_UNAME_FAILED,
 				   "uname() call to find system name failed") ;
     }
-  else 
+  else
     {
       BrowserConfig curr_browser = browsers_in ;
-      
+
       while (curr_browser->system != NULL)
 	{
 	  if (g_ascii_strcasecmp(curr_browser->system, unamebuf.sysname) == 0)
 	    {
-	      browser_in_list = TRUE ; 
-              
+	      browser_in_list = TRUE ;
+
 	      /* Look for the browser in the users path. */
 	      if ((browser = g_find_program_in_path(curr_browser->executable)))
 		{
 		  *browser_out = curr_browser ;
-                  
+
 		  break ;
 		}
 	    }
-          
+
 	  curr_browser++ ;
 	}
     }
-  
+
   if (!browser)
     {
       if (browser_in_list)
@@ -253,7 +254,7 @@ static char *findBrowser(BrowserConfig browsers_in, BrowserConfig *browser_out,
 			       "No browser registered for system %s", unamebuf.sysname) ;
 	}
     }
-  
+
   return browser ;
 }
 
@@ -261,13 +262,13 @@ static char *findBrowser(BrowserConfig browsers_in, BrowserConfig *browser_out,
 static void makeBrowserCmd(GString *cmd, BrowserConfig best_browser, char *url)
 {
   gboolean found ;
-  
+
   cmd = g_string_append(cmd, best_browser->open_command) ;
-  
+
   found = seqtools_g_string_replace(cmd, BROWSER_PATTERN, url) ;
-  
+
   g_assert(found) ;					    /* Must find at least one pattern. */
-  
+
   return ;
 }
 
@@ -280,15 +281,15 @@ static void makeBrowserCmd(GString *cmd, BrowserConfig best_browser, char *url)
  * syntax for this command is: "OpenURL(URL[,new-window])" and stupid
  * netscape/mozilla will think that any "," in the url (i.e. lots of cgi links have
  * "," to separate args !) is the "," for its OpenURL command and will then
- * usually report a syntax error in the OpenURL command.                   
- *                                                                         
- * To get round this we translate any "," into "%2C" which is the standard 
+ * usually report a syntax error in the OpenURL command.
+ *
+ * To get round this we translate any "," into "%2C" which is the standard
  * code for a "," in urls (thanks to Roger Pettet for this)....YUCH.
- * 
+ *
  * Some urls have single quotes in them, if you pass the whole string through
  * to the shell these get wrongly interpreted by the shell in its normal
  * string fashion so we translate them all to "%27".
- * 
+ *
  * mh17: for security we need to patch out other shell special characters such as '|', ';', '`'. >,< should be harmless
  * Anything that allows a user to run another command is a no-no
  * This gets inefficient (perl and php might do this better)
@@ -301,42 +302,42 @@ static void makeBrowserCmd(GString *cmd, BrowserConfig best_browser, char *url)
 static char *translateURLChars(const char *orig_link)
 {
   char *url = NULL ;
-  
+
 #if TRANSLATE
-  
+
   GString *link ;
   char *target, *source ;
-  
+
   link = g_string_new(orig_link) ;
-  
+
   target = " " ;
   source = "%20" ;
   seqtools_g_string_replace(link, target, source) ;
-  
+
   target = ";" ;
   source = "%3B" ;
   seqtools_g_string_replace(link, target, source) ;
-  
+
   target = "," ;
   source = "%2C" ;
   seqtools_g_string_replace(link, target, source) ;
-  
+
   target = "'" ;
   source = "%27" ;
   seqtools_g_string_replace(link, target, source) ;
-  
+
   target = "&" ;
   source = "%26" ;
   seqtools_g_string_replace(link, target, source) ;
-  
+
   target = "|" ;
   source = "%7C" ;
   seqtools_g_string_replace(link, target, source) ;
-  
+
   target = "`" ;
   source = "%60" ;
   seqtools_g_string_replace(link, target, source) ;
-  
+
   url = g_string_free(link, FALSE) ;
 #else
   url = g_strdup(orig_link);
@@ -366,24 +367,24 @@ static gboolean seqtools_g_string_replace(GString *string, const char *target, c
   int target_len ;
   int target_pos ;
   char *template_ptr ;
-  
-  
+
+
   target_len = strlen(target) ;
   source_len = strlen(source) ;
-  
+
   template_ptr = string->str ;
   while ((template_ptr = strstr(template_ptr, target)))
     {
       result = TRUE ;
-      
+
       target_pos = template_ptr - string->str ;
-      
+
       string = g_string_erase(string, target_pos, target_len) ;
-      
+
       string = g_string_insert(string, target_pos, source) ;
-      
+
       template_ptr = string->str + target_pos + source_len ; /* Shouldn't go off the end. */
     }
-  
+
   return result ;
 }
diff --git a/src/seqtoolsUtils/translate.cpp b/src/seqtoolsUtils/translate.cpp
index 632ce4eba54b53f93d569185696ef0f8b196208b..80aa8c8c4726f5236ba38c49dc4a62e788cc6e99 100644
--- a/src/seqtoolsUtils/translate.cpp
+++ b/src/seqtoolsUtils/translate.cpp
@@ -1,5 +1,6 @@
 /*  File: translate.c
  *  Author: sre, 1993-01-12
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -57,10 +58,10 @@ typedef enum
 /* THIS FILE NEEDS RENAMING TO SOMETHING LIKE utils.c */
 
 /* Function: Translate(char *seq, char **code)
- * 
+ *
  * Given a ptr to the start of a nucleic acid sequence, and a genetic code, translate the sequence
  * into amino acid sequence.
- * 
+ *
  * code is an array of 65 strings, representing the translations of the 64 codons, arranged in
  * order AAA, AAC, AAG, AAU, ..., UUA, UUC, UUG, UUU.  '*' or '***' is used to represent
  * termination codons, usually. The final string, code[64], is the code for an ambiguous amino
@@ -69,7 +70,7 @@ typedef enum
  * Because of the way space is allocated for the amino acid sequence, the amino acid strings
  * cannot be longer than 3 letters each. (I don't foresee using anything but the single- and
  * triple- letter codes.)
- * 
+ *
  * Returns a ptr to the translation string on success, or NULL on failure.
  */
 char *blxTranslate(const char *seq, char **code)
@@ -78,7 +79,7 @@ char *blxTranslate(const char *seq, char **code)
   int   codon;						    /* index for codon         */
   char *aaptr;						    /* ptr into aaseq */
   int   i;
-  
+
   if (seq && *seq)
     {
       aaseq = (char *)g_malloc(strlen(seq) + 1) ;
@@ -108,7 +109,7 @@ char *blxTranslate(const char *seq, char **code)
 	  strcpy(aaptr, code[codon]);
 	  aaptr += strlen(code[codon]);
 	}
-    }  
+    }
 
   return aaseq ;
 }
@@ -123,9 +124,9 @@ char complementChar(const char inputChar, GError **error)
   char result = '\0';
   char c = toupper(inputChar);
   int idx = 0;
-  
+
   for ( ; c != iupac[idx].sym && idx < IUPACSYMNUM; idx++);
-  
+
   if (idx >= IUPACSYMNUM)
     {
       /* not found; return original char */
@@ -135,11 +136,11 @@ char complementChar(const char inputChar, GError **error)
   else
     {
       result = iupac[idx].symcomp;
-      
+
       if (islower(inputChar))
         result = tolower(result);
     }
-  
+
   return result;
 }
 
@@ -147,9 +148,9 @@ char complementChar(const char inputChar, GError **error)
 /* All these calls need rationalising into a single function with options. */
 
 /* revComplement.c
- * 
+ *
  * Reverse complement of a IUPAC character string
- * 
+ *
  */
 /* Ratinalise this with my func. below..... */
 char *revComplement(char *comp, char *seq)
@@ -177,12 +178,12 @@ char *revComplement(char *comp, char *seq)
 
   return comp;
 }
-  
+
 
 /* blxComplement.c
- * 
+ *
  * Just complement of a IUPAC character string
- * 
+ *
  * Note that it overwrites calling string!!!! (revcomp doesn't)
  */
 void blxComplement(char *seq)
@@ -204,6 +205,3 @@ void blxComplement(char *seq)
 
   return ;
 }
-  
-
-
diff --git a/src/seqtoolsUtils/utilities.cpp b/src/seqtoolsUtils/utilities.cpp
index e8fade230676709f2b7c2c48a8500c1ee3e1fb76..4992c3a90fcedb2658b582676a1a3d5aeb0f79c7 100644
--- a/src/seqtoolsUtils/utilities.cpp
+++ b/src/seqtoolsUtils/utilities.cpp
@@ -1,5 +1,6 @@
 /*  File: utilities.c
  *  Author: Gemma Barson, 2010-01-05
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -109,14 +110,14 @@ static gboolean        onSetUseScrolledMessages(GtkWidget *button, const gint re
 static gboolean        onSetUsePopupMessages(GtkWidget *button, const gint responseId, gpointer data);
 static const char*     getDialogIcon(GLogLevelFlags log_level);
 static void            printMessageToStatusbar(const gchar *message, gpointer data);
-static void            blxColorOverrideColor(BlxColor *blxColor, 
-                                             const gboolean selected, 
-                                             const gboolean usePrintColors, 
+static void            blxColorOverrideColor(BlxColor *blxColor,
+                                             const gboolean selected,
+                                             const gboolean usePrintColors,
                                              const GdkColor *color) ;
 
 
 /***********************************************************
- *                       Widgets                           * 
+ *                       Widgets                           *
  ***********************************************************/
 
 
@@ -132,7 +133,7 @@ static void onDestroyCustomWidget(GtkWidget *widget)
       drawable = NULL;
       g_object_set_data(G_OBJECT(widget), "drawable", NULL);
     }
-  
+
   CallbackData *callbackData = widgetGetCallbackData(widget);
   if (callbackData)
     {
@@ -148,7 +149,7 @@ GdkDrawable* widgetGetDrawable(GtkWidget *widget)
   /* if the drawable has been marked as invalid, return null */
   if (result && !widgetGetDrawableValid(widget))
     result = NULL;
-  
+
   return result;
 }
 
@@ -161,7 +162,7 @@ static GdkDrawable* widgetGetDrawableAllowInvalid(GtkWidget *widget)
 void widgetSetDrawable(GtkWidget *widget, GdkDrawable *drawable)
 {
   if (widget)
-    { 
+    {
       /* Delete the old one first, if there is one */
       GdkDrawable *oldDrawable = widgetGetDrawableAllowInvalid(widget);
       if (oldDrawable)
@@ -181,9 +182,9 @@ void widgetSetDrawable(GtkWidget *widget, GdkDrawable *drawable)
 /* Call this function to clear the cached drawable for the widget. This means that the
  * next time that expose is called, the bitmap will be redrawn from scratch. */
 void widgetClearCachedDrawable(GtkWidget *widget, gpointer data)
-{  
+{
   /* Don't delete the drawable; instead, mark it as invalid so that we
-   * can re-use it (because lots of create/delete of drawables can cause 
+   * can re-use it (because lots of create/delete of drawables can cause
    * XID reuse errors */
   widgetSetDrawableValid(widget, FALSE);
 }
@@ -205,26 +206,26 @@ void callFuncOnAllChildWidgets(GtkWidget *widget, gpointer data)
 {
   GtkCallback func = (GtkCallback)data;
   func(widget, NULL);
-  
+
   if (GTK_IS_CONTAINER(widget))
     gtk_container_foreach(GTK_CONTAINER(widget), callFuncOnAllChildWidgets, data);
 }
 
 
 /* Functions to get/set a boolean property that is set to true if this widget has
- * been hidden by the user. (We can't just use gtk_widget_hide because we do a 
- * show_all when we remove and re-add widgets to the parent when we toggle strands. 
+ * been hidden by the user. (We can't just use gtk_widget_hide because we do a
+ * show_all when we remove and re-add widgets to the parent when we toggle strands.
  * Note that if the property is not set the result is FALSE, so by default widgets
  * are not hidden. */
 gboolean widgetGetHidden(GtkWidget *widget)
 {
   gboolean result = FALSE;
-  
+
   if (widget)
-    {   
+    {
       result = (gboolean)GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "hidden"));
     }
-  
+
   return result;
 }
 
@@ -234,7 +235,7 @@ void widgetSetHidden(GtkWidget *widget, const gboolean hidden)
     {
       /* Set the property */
       g_object_set_data(G_OBJECT(widget), "hidden", GINT_TO_POINTER((gint)hidden));
-      
+
       /* Show/hide the widget */
       if (hidden)
         {
@@ -243,7 +244,7 @@ void widgetSetHidden(GtkWidget *widget, const gboolean hidden)
       else
         {
           gtk_widget_show_all(widget);
-        }       
+        }
     }
 }
 
@@ -256,7 +257,7 @@ void hideUserHiddenWidget(GtkWidget *widget, gpointer callbackData)
     {
       gtk_widget_hide_all(widget);
     }
-  
+
   if (GTK_IS_CONTAINER(widget))
     {
       gtk_container_foreach(GTK_CONTAINER(widget), hideUserHiddenWidget, NULL);
@@ -264,9 +265,9 @@ void hideUserHiddenWidget(GtkWidget *widget, gpointer callbackData)
 }
 
 
-/* Create a label with the given properties. If 'showWhenPrinting' is false 
+/* Create a label with the given properties. If 'showWhenPrinting' is false
  * this label will not appear when printing */
-GtkWidget* createLabel(const char *text, 
+GtkWidget* createLabel(const char *text,
                        const gdouble xalign,
                        const gdouble yalign,
                        const gboolean ellipsize,
@@ -274,11 +275,11 @@ GtkWidget* createLabel(const char *text,
                        const gboolean showWhenPrinting)
 {
   GtkWidget *label = NULL;
-  
+
   if (text)
     {
-      label = gtk_widget_new(GTK_TYPE_LABEL, 
-                             "label", text, 
+      label = gtk_widget_new(GTK_TYPE_LABEL,
+                             "label", text,
                              "xalign", xalign,
                              "yalign", yalign,
                              "selectable", enableCopyPaste,
@@ -286,9 +287,9 @@ GtkWidget* createLabel(const char *text,
     }
   else
     {
-      label = gtk_widget_new(GTK_TYPE_LABEL, 
-                             "xalign", xalign, 
-                             "yalign", yalign, 
+      label = gtk_widget_new(GTK_TYPE_LABEL,
+                             "xalign", xalign,
+                             "yalign", yalign,
                              "selectable", enableCopyPaste,
                              NULL);
     }
@@ -297,9 +298,9 @@ GtkWidget* createLabel(const char *text,
     gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
 
   gtk_misc_set_padding(GTK_MISC(label), DEFAULT_LABEL_X_PAD, 0);
-  
+
   GtkWidget *parent = NULL;
-  
+
   if (label && showWhenPrinting)
     {
       /* Connect to the expose event handler that will create the drawable object required for printing */
@@ -319,13 +320,13 @@ GtkWidget* createLabel(const char *text,
 GtkWidget* getLabelWidget(GtkWidget *widget)
 {
   GtkWidget *label = widget;
-  
+
   if (GTK_IS_EVENT_BOX(widget))
     {
       GList *childItem = gtk_container_get_children(GTK_CONTAINER(widget));
       label = GTK_WIDGET(childItem->data);
     }
-  
+
   return label;
 }
 
@@ -374,16 +375,16 @@ void blxSetWidgetColor(GtkWidget* widget, const char *colorName)
 }
 
 
-/* Find the position of the left edge of the source widget wrt the dest widget and offset 
+/* Find the position of the left edge of the source widget wrt the dest widget and offset
  * the event by this amount, then propagate the event to the dest widget. This allows us
  * to get the correct x coord on the parent widget for a click on the child widget. */
 void propagateEventButton(GtkWidget *srcWidget, GtkWidget *destWidget, GdkEventButton *event)
 {
   int xOffset;
   gtk_widget_translate_coordinates(srcWidget, destWidget, 0, 0, &xOffset, NULL);
-  
+
   event->x += xOffset;
-  
+
   gtk_propagate_event(destWidget, (GdkEvent*)event);
 }
 
@@ -396,15 +397,15 @@ void propagateEventMotion(GtkWidget *srcWidget, GtkWidget *destWidget, GdkEventM
   /* Find the position of 0,0 of the source widget wrt the dest widget and offset by this amount. */
   int xOffset, yOffset;
   gtk_widget_translate_coordinates(srcWidget, destWidget, 0, 0, &xOffset, &yOffset);
-  
+
   event->x += xOffset;
-  event->y += yOffset;  
-  
+  event->y += yOffset;
+
   gtk_propagate_event(destWidget, (GdkEvent*)event);
 }
 
 /***********************************************************
- *                       Misc utils                        * 
+ *                       Misc utils                        *
  ***********************************************************/
 
 /* Return true if the given character is a delimiter */
@@ -422,16 +423,16 @@ char* removeDelimiters(char *text)
   if (text)
     {
       char *c = text;
-      
+
       if (isDelimiter(*c))
         {
           text = g_strdup(c+1);
           g_free(c);
           c = text;
         }
-      
+
       c = &text[strlen(text) - 1];
-      
+
       if (isDelimiter(*c))
         {
           *c = '\0';
@@ -463,13 +464,13 @@ GArray* keyFileGetCsv(GKeyFile *keyFile, const char *group, const char *key, GEr
           /* Remove any leading/trailing whitespace and delimiters */
           *token = g_strchug(g_strchomp(*token));
           *token = removeDelimiters(*token);
-          
+
           /* Add it as a quark to the array */
           GQuark quark = g_quark_from_string(*token);
           result = g_array_append_val(result, quark);
           ++token;
         }
-      
+
       g_strfreev(tokens);
       g_free(fetchStr);
     }
@@ -499,7 +500,7 @@ void freeStringList(GList **stringList, const gboolean freeDataItems)
               item->data = NULL;
             }
         }
-      
+
       g_list_free(*stringList);
       *stringList = NULL;
     }
@@ -507,7 +508,7 @@ void freeStringList(GList **stringList, const gboolean freeDataItems)
 
 
 /***********************************************************
- *                       Ranges/values                     * 
+ *                       Ranges/values                     *
  ***********************************************************/
 
 IntRange::IntRange(const IntRange &range)
@@ -594,7 +595,7 @@ int IntRange::end(const bool rev, const bool negate) const
 }
 
 /* Utilities to return the min and max values. If inclusive is true then return the max value
- * plus one if forward or the min value minus one if reversed (this is used when drawing from 
+ * plus one if forward or the min value minus one if reversed (this is used when drawing from
  * left to right to draw to the left edge of the next base) */
 int IntRange::min(const bool inclusive, const bool rev) const
 {
@@ -710,21 +711,21 @@ bool IntRange::setMax(const int val)
 void IntRange::boundsLimit(const IntRange* const limit, const gboolean maintainLen)
 {
   const int len = length();
-  
+
   if (!m_min_is_set || m_min < limit->min())
     {
       setMin(limit->min());
-      
+
       if (maintainLen)
         {
           setMax(m_min + len);
         }
     }
-  
+
   if (!m_max_is_set || m_max > limit->max())
     {
       setMax(limit->max());
-      
+
       if (maintainLen)
         {
           setMin(m_max - len);
@@ -733,7 +734,7 @@ void IntRange::boundsLimit(const IntRange* const limit, const gboolean maintainL
           boundsLimitValue(&m_min, limit);
        }
     }
-  
+
   boundsLimitValue(&m_max, limit);
 }
 
@@ -797,7 +798,7 @@ void boundsLimitValue(int *value, const IntRange* const range)
     {
       *value = range->min();
     }
-  
+
   if (*value > range->max())
     {
       *value = range->max();
@@ -809,12 +810,12 @@ void boundsLimitValue(int *value, const IntRange* const range)
 gboolean pointInRect(const int x, const int y, const GdkRectangle* const rect)
 {
   gboolean result = FALSE;
-  
+
   if (x >= rect->x && x <= rect->x + rect->width && y >= rect->y && y <= rect->y + rect->height)
     {
       result = TRUE;
     }
-  
+
   return result;
 }
 /* Utility to calculate how many digits are in an integer (including the '-'
@@ -842,13 +843,13 @@ int numDigitsInInt(int val)
           val /= 10;
         }
     }
-      
+
   return count;
 }
 
 
 /***********************************************************
- *                       Misc                              * 
+ *                       Misc                              *
  ***********************************************************/
 
 /* Returns true if the given button event position is inside the given rectangle
@@ -857,7 +858,7 @@ gboolean clickedInRect(GdkEventButton *event, GdkRectangle *rect, const int minW
 {
   gboolean result = event->x >= rect->x && event->x <= rect->x + rect->width + minWidth;
   result &= event->y >= rect->y && event->y <= rect->y + rect->height;
-  
+
   return result;
 }
 
@@ -881,32 +882,32 @@ BlxSeqType determineSeqType(char *seq, GError **error)
     int  na = 0;                        /* count of nucleotides */
     int  aa = 0;                        /* count of amino acids */
     int  no = 0;                        /* count of others */
-  
+
     /* Look at the first lenToSearch characters
      */
     for (pos = 0; seq[pos] && pos < lenToSearch; pos++)
     {
         c = toupper(seq[pos]);
 
-        if (strchr(protonly, c)) 
+        if (strchr(protonly, c))
             po++;
         else if (strchr(primenuc, c)) {
             na++;
             if (c == 'T') nt++;
             else if (c == 'U') nu++;
         }
-        else if (strchr(aminos, c)) 
+        else if (strchr(aminos, c))
             aa++;
-        else if (isalpha(c)) 
+        else if (isalpha(c))
             no++;
     }
 
     if (po == 0 && na == 0 && aa == 0 && no == 0)
       g_set_error(error, SEQTOOLS_ERROR, SEQTOOLS_ERROR_SEQ_TYPE, "No valid DNA or amino-acid characters found. (Searched the first %d characters.)\n", lenToSearch);
-    
-    if (po > 0) 
+
+    if (po > 0)
       return BLXSEQ_PEPTIDE;
-    else if (na > aa) 
+    else if (na > aa)
       return BLXSEQ_DNA;
     else
       return BLXSEQ_PEPTIDE;
@@ -935,7 +936,7 @@ void argvAdd(int *argc, char ***argv, const char *s)
     v[*argc] = 0;
 
     /* free(*argv); */   /* Too risky */
-    
+
     *argv = v;
 }
 
@@ -955,9 +956,9 @@ char* getSystemErrorText()
 
   return result;
 }
-  
-  
-/* Get the BlxStyle with the given name. Returns null and sets the error if 
+
+
+/* Get the BlxStyle with the given name. Returns null and sets the error if
  * we expected to find the name but didn't. The special-case input string "."
  * means "value not set", so in this case we return NULL and don't set the error. */
 BlxStyle* getBlxStyle(const char *styleName, GSList *styles, GError **error)
@@ -967,7 +968,7 @@ BlxStyle* getBlxStyle(const char *styleName, GSList *styles, GError **error)
   if (styleName && strcmp(styleName, ".") != 0)
     {
       GSList *item = styles;
-      
+
       for ( ; item; item = item->next)
         {
           BlxStyle *style = (BlxStyle*)(item->data);
@@ -977,7 +978,7 @@ BlxStyle* getBlxStyle(const char *styleName, GSList *styles, GError **error)
               break;
             }
         }
-        
+
       if (!result)
         {
           /* Only report the same missing style once */
@@ -988,7 +989,7 @@ BlxStyle* getBlxStyle(const char *styleName, GSList *styles, GError **error)
             {
               seen = stringsEqual((char*)(item->data), styleName, FALSE);
             }
-          
+
           if (!seen)
             {
               seenStyles = g_slist_append(seenStyles, g_strdup(styleName));
@@ -1001,7 +1002,7 @@ BlxStyle* getBlxStyle(const char *styleName, GSList *styles, GError **error)
 }
 
 /***********************************************************
- *                       Colors                            * 
+ *                       Colors                            *
  ***********************************************************/
 
 /* Creates a GdkColor from the given color string in hex format, e.g. "#00ffbe". Returns false
@@ -1014,7 +1015,7 @@ gboolean getColorFromString(const char *colorStr, GdkColor *color, GError **erro
     {
       gboolean failures[1];
       gint numFailures = gdk_colormap_alloc_colors(gdk_colormap_get_system(), color, 1, TRUE, TRUE, failures);
-      
+
       if (numFailures > 0)
         {
           ok = FALSE;
@@ -1025,7 +1026,7 @@ gboolean getColorFromString(const char *colorStr, GdkColor *color, GError **erro
     {
       g_set_error(error, SEQTOOLS_ERROR, 1, "Error parsing color string '%s'\n", colorStr);
     }
-    
+
   return ok;
 }
 
@@ -1035,12 +1036,12 @@ static void increaseColorBrightness(const GdkColor* const origColor, const doubl
 {
   result->pixel = 0;
   const int maxRgb = 65535;
-  
+
 //  int maxVal = origColor->red > origColor->green ? origColor->red : origColor->green;
-//  
+//
 //  if (origColor->blue > maxVal)
 //    maxVal = origColor->blue;
-//  
+//
 //  int offset = maxVal * (factor - 1);
 //
 //  result->red = ((int)origColor->red + offset > maxRgb)   ? maxRgb : (origColor->red + offset);
@@ -1050,7 +1051,7 @@ static void increaseColorBrightness(const GdkColor* const origColor, const doubl
   int newRed = origColor->red * factor;
   int newGreen = origColor->green * factor;
   int newBlue = origColor->blue * factor;
-  
+
   gboolean bustMax = FALSE;
 
   if (newRed > maxRgb)
@@ -1070,7 +1071,7 @@ static void increaseColorBrightness(const GdkColor* const origColor, const doubl
       bustMax = TRUE;
       newBlue = maxRgb;
     }
-  
+
   if (bustMax)
     {
       const int offset = maxRgb * (factor - 1);
@@ -1078,14 +1079,14 @@ static void increaseColorBrightness(const GdkColor* const origColor, const doubl
       newGreen = (origColor->green + offset > maxRgb) ? maxRgb : origColor->green + offset;
       newBlue = (origColor->blue + offset > maxRgb) ? maxRgb : origColor->blue + offset;
     }
-  
+
   result->red = newRed;
   result->green = newGreen;
   result->blue = newBlue;
-  
+
   gboolean failures[1];
   gint numFailures = gdk_colormap_alloc_colors(gdk_colormap_get_system(), result, 1, TRUE, TRUE, failures);
-  
+
   if (numFailures > 0)
     {
       g_warning("Error calculating highlight color; using original color instead (RGB=%d %d %d).", origColor->red, origColor->green, origColor->blue);
@@ -1104,10 +1105,10 @@ static void reduceColorBrightness(const GdkColor* const origColor, const double
   result->red = origColor->red * factor;
   result->green = origColor->green * factor;
   result->blue = origColor->blue * factor;
-  
+
   gboolean failures[1];
   gint numFailures = gdk_colormap_alloc_colors(gdk_colormap_get_system(), result, 1, TRUE, TRUE, failures);
-  
+
   if (numFailures > 0)
     {
       g_warning("Error calculating highlight color; using original color instead (RGB=%d %d %d).", origColor->red, origColor->green, origColor->blue);
@@ -1143,14 +1144,14 @@ void convertToGrayscale(const GdkColor* const origColor, GdkColor *result)
 {
   result->red = result->green = result->blue =
    ((11 * origColor->red) + (16 * origColor->green) + (5 * origColor->blue)) / 32;
-   
+
   gboolean failures[1];
   gint numFailures = gdk_colormap_alloc_colors(gdk_colormap_get_system(), result, 1, TRUE, TRUE, failures);
-  
+
   if (numFailures > 0)
     {
       g_warning("Error calculating greyscale color (RGB=%d %d %d).", origColor->red, origColor->green, origColor->blue);
-      
+
       /* Set it to black, for want of something better to do... */
       result->pixel = 0;
       result->red = 0;
@@ -1178,19 +1179,19 @@ BlxColor* getBlxColor(GArray *defaultColors, const int colorId)
     {
       g_warning("Color ID %d not found in the default colors array.\n", colorId);
     }
-  
+
   return result;
 }
 
 
-/* Lookup the BlxColor with the given id in the given hash table and return a 
+/* Lookup the BlxColor with the given id in the given hash table and return a
  * pointer to the gdk color with the given properties */
 GdkColor* getGdkColor(const int colorId, GArray *defaultColors, const gboolean selected, const gboolean usePrintColors)
 {
   GdkColor *result = NULL;
-  
+
   BlxColor *blxColor = getBlxColor(defaultColors, colorId);
-  
+
   if (blxColor)
     {
       if (usePrintColors)
@@ -1206,7 +1207,7 @@ GdkColor* getGdkColor(const int colorId, GArray *defaultColors, const gboolean s
     {
       g_warning("Error: requested invalid color ID %d", colorId);
     }
-  
+
   return result;
 }
 
@@ -1217,16 +1218,16 @@ char* convertColorToString(GdkColor *color)
 {
   //  char *result = gdk_color_to_string(&widget->style->bg[GTK_STATE_NORMAL]);
   //  return result;
-  
+
   /* Need to make sure the color is allocated (otherwise the 'pixel' field may be zero) */
   gboolean failures[1];
   gdk_colormap_alloc_colors(gdk_colormap_get_system(), color, 1, TRUE, TRUE, failures);
-  
+
   const int hexLen = 8; /* to fit a string of the format '#ffffff', plus the terminating character */
-  
+
   char *result = (char*)g_malloc(sizeof(char) * hexLen);
   sprintf(result, "#%x", color->pixel);
-  
+
   return result;
 }
 
@@ -1247,23 +1248,23 @@ void destroyBlxColor(BlxColor *blxColor)
  * Inserts the new color into the given list */
 void createBlxColor(GArray *defaultColors,
                     int colorId,
-                    const char *name, 
-                    const char *desc, 
-                    const char *normalCol, 
+                    const char *name,
+                    const char *desc,
+                    const char *normalCol,
                     const char *printCol,
                     const char *normalColSelected,
                     const char *printColSelected)
 {
   BlxColor *result = &g_array_index(defaultColors, BlxColor, colorId);
-  
+
   result->transparent = FALSE;
   GError *error = NULL;
-  
+
   if (!normalCol)
     {
       result->transparent = TRUE;
     }
-  else if (getColorFromString(normalCol, &result->normal, &error)) 
+  else if (getColorFromString(normalCol, &result->normal, &error))
     {
       /* find a "selected" version of it, if not passed one */
       if (normalColSelected)
@@ -1277,9 +1278,9 @@ void createBlxColor(GArray *defaultColors,
         }
     else
         {
-          getSelectionColor(&result->normal, &result->selected); 
+          getSelectionColor(&result->normal, &result->selected);
         }
-    
+
     /* Parse the print color */
     if (getColorFromString(printCol, &result->print, &error))
       {
@@ -1295,7 +1296,7 @@ void createBlxColor(GArray *defaultColors,
           }
         else
           {
-            getSelectionColor(&result->print, &result->printSelected); 
+            getSelectionColor(&result->print, &result->printSelected);
           }
         }
       else
@@ -1313,7 +1314,7 @@ void createBlxColor(GArray *defaultColors,
       delete result;
       result = NULL;
     }
-  
+
   if (result)
     {
       /* Set the other properties */
@@ -1331,42 +1332,42 @@ gdouble pixelsPerBase(const gint displayWidth, const IntRange* const displayRang
 }
 
 
-/* Convert a base index to a coord within the given rectangle - the x coord if 
- * horizontal is true, the y coord otherwise. Returns the number of pixels 
- * to the coord from 0 at the left edge (or top edge, if vertical), including 
- * any pixels up to the left/top edge of the rectangle. 
- * 
- * 'displayRev' should be passed as true if the display is reversed (i.e. if 
- * values decrease from left-to-right/top-to-bottom). 
- * 
+/* Convert a base index to a coord within the given rectangle - the x coord if
+ * horizontal is true, the y coord otherwise. Returns the number of pixels
+ * to the coord from 0 at the left edge (or top edge, if vertical), including
+ * any pixels up to the left/top edge of the rectangle.
+ *
+ * 'displayRev' should be passed as true if the display is reversed (i.e. if
+ * values decrease from left-to-right/top-to-bottom).
+ *
  * The result is clipped to lie within the rectangle if 'clip' is true */
-gdouble convertBaseIdxToRectPos(const gint dnaIdx, 
-                                const GdkRectangle* const rect, 
+gdouble convertBaseIdxToRectPos(const gint dnaIdx,
+                                const GdkRectangle* const rect,
                                 const IntRange* const dnaDispRange,
                                 const gboolean horizontal,
                                 const gboolean displayRev,
                                 const gboolean clip)
 {
   int baseIdx = invertCoord(dnaIdx, dnaDispRange, displayRev);
-  
+
   gdouble numBasesFromEdge = (gdouble)(baseIdx - dnaDispRange->min()); /* 0-based index from edge */
-  
+
   if (clip && numBasesFromEdge < 0)
     {
       numBasesFromEdge = 0;
     }
-  
+
   const int rectLength = horizontal ? rect->width : rect->height;
   gdouble pixelsFromEdge = numBasesFromEdge * pixelsPerBase(rectLength, dnaDispRange);
-  
+
   const int rectStart = horizontal ? rect->x : rect->y;
   gdouble result = (gdouble)rectStart + pixelsFromEdge;
-  
+
   if (clip && result > rectStart + rectLength)
     {
       result = rectStart + rectLength;
     }
-  
+
   return result;
 }
 
@@ -1390,13 +1391,13 @@ void getCoordRangeExtents(CoordRange *range, int *qRangeMin, int *qRangeMax, int
 {
   if (qRangeMin)
     *qRangeMin = min(range->qStart, range->qEnd);
-  
+
   if (qRangeMax)
     *qRangeMax = max(range->qStart, range->qEnd);
-  
+
   if (sRangeMin)
     *sRangeMin = min(range->sStart, range->sEnd);
-  
+
   if (sRangeMax)
     *sRangeMax = max(range->sStart, range->sEnd);
 }
@@ -1413,30 +1414,30 @@ char convertBaseToCorrectCase(const char charToConvert, const BlxSeqType seqType
  * 'complement' is true and seqType is DNA, the result is complemented.
  * Returns ' ' if the index is out of range. */
 char getSequenceIndex(char *seq,
-                      const int qIdx, 
-                      const gboolean complement, 
+                      const int qIdx,
+                      const gboolean complement,
                       const IntRange* const seqRange,
                       const BlxSeqType seqType)
 {
   char result = ' ';
-  
+
   if (qIdx >= seqRange->min() && qIdx <= seqRange->max())
     {
       char base = seq[qIdx - seqRange->min()];
       base = convertBaseToCorrectCase(base, seqType);
-      
+
       if (!complement || seqType == BLXSEQ_PEPTIDE)
         result = base;
       else
         result = complementChar(base, NULL);
     }
-  
+
   return result;
 }
 
 
 /* Convert the given range of display coords to dna coords */
-void convertDisplayRangeToDnaRange(const IntRange* const displayRange, 
+void convertDisplayRangeToDnaRange(const IntRange* const displayRange,
                                    const BlxSeqType displaySeqType,
                                    const int numFrames,
                                    const gboolean displayRev,
@@ -1450,7 +1451,7 @@ void convertDisplayRangeToDnaRange(const IntRange* const displayRange,
 
 
 /***********************************************************
- *			   IMPORTANT!!!			   
+ *			   IMPORTANT!!!
  * The following two functions (convertDisplayIdxToDnaIdx and
  * convertDnaIdxToDisplayIdx) are used extensively by Blixem
  * and underpin all of its coordinate conversions. Be very careful
@@ -1462,26 +1463,26 @@ void convertDisplayRangeToDnaRange(const IntRange* const displayRange,
  * reading frame, return the index into the DNA sequence that will give the equivalent DNA base.
  * If the display sequence is a peptide sequence, it will convert the coord to a DNA coord. If the
  * display is reversed, the display coord will be inverted. */
-int convertDisplayIdxToDnaIdx(const int displayIdx, 
+int convertDisplayIdxToDnaIdx(const int displayIdx,
                               const BlxSeqType srcSeqType,
-                              const int frame, 
-                              const int baseNum, 
+                              const int frame,
+                              const int baseNum,
                               const int numFrames,
                               const gboolean displayRev,
                               const IntRange* const refSeqRange)
 {
   int dnaIdx = displayIdx;
   int base = baseNum;
-  
+
   if (srcSeqType == BLXSEQ_PEPTIDE)
     {
       /* Convert the input peptide coord to a dna coord */
       dnaIdx = (displayIdx * numFrames) - numFrames + frame + base - 1;
     }
-  
+
   if (displayRev)
     {
-      /* If the display is reversed, we need to invert the result. For example, if the 
+      /* If the display is reversed, we need to invert the result. For example, if the
        * result is index '2' out of the range '12345', then we convert it to '4', which is the
        * equivalent position in the range '54321'. */
       dnaIdx = refSeqRange->max() - dnaIdx + refSeqRange->min();
@@ -1491,21 +1492,21 @@ int convertDisplayIdxToDnaIdx(const int displayIdx,
 }
 
 
-/* Given an index into a dna sequence and the reading frame, find the index into 
+/* Given an index into a dna sequence and the reading frame, find the index into
  * the display sequence. Converts the index to a peptide index if displaying
  * peptide sequences (Also returns the base number of the DNA base within the
- * reading frame in this case (i.e. whether it's the 1st, 2nd or 3rd out of the 
+ * reading frame in this case (i.e. whether it's the 1st, 2nd or 3rd out of the
  * triplet). */
-int convertDnaIdxToDisplayIdx(const int dnaIdx, 
+int convertDnaIdxToDisplayIdx(const int dnaIdx,
                               const BlxSeqType displaySeqType,
-                              const int frame, 
-                              const int numFrames, 
+                              const int frame,
+                              const int numFrames,
                               const gboolean displayRev,
                               const IntRange* const dnaIdxRange,
                               int *baseNum)
 {
   int displayIdx = dnaIdx;
-  
+
   const gboolean peptides = (displaySeqType == BLXSEQ_PEPTIDE);
 
   const int direction = displayRev ? -1 : 1;
@@ -1530,12 +1531,12 @@ int convertDnaIdxToDisplayIdx(const int dnaIdx,
     {
       displayIdx = ceil((gdouble)(displayIdx - (frame - 1)) / (gdouble)numFrames);
     }
-  
+
   if (baseNum)
     {
       *baseNum = base;
     }
-  
+
   return displayIdx;
 }
 
@@ -1543,20 +1544,20 @@ int convertDnaIdxToDisplayIdx(const int dnaIdx,
 /* Get the start coord in the given display range, reversed as necessary if 'reverse' is true.
  * Result is a coord in the DNA sequence - converts as necessary if the display range is in terms
  * of peptide coords */
-int getStartDnaCoord(const IntRange* const displayRange, 
+int getStartDnaCoord(const IntRange* const displayRange,
                      const int frame,
-                     const BlxSeqType displaySeqType, 
-                     const gboolean displayRev, 
+                     const BlxSeqType displaySeqType,
+                     const gboolean displayRev,
                      const int numFrames,
                      const IntRange* const refSeqRange)
 {
   int result = displayRange->min();
-  
+
   /* Convert the display coord to coords into the ref seq, which is a DNA sequence. We want
    * the first base in the codon, if this is a peptide sequence. */
   const int baseNum = 1;
   result = convertDisplayIdxToDnaIdx(result, displaySeqType, frame, baseNum, numFrames, displayRev, refSeqRange);
-  
+
   return result;
 }
 
@@ -1564,20 +1565,20 @@ int getStartDnaCoord(const IntRange* const displayRange,
 /* Get the end coord in the given display range, reversed as necessary if 'reverse' is true.
  * Result is a coord in the DNA sequence - converts as necessary if the display range is in terms
  * of peptide coords */
-int getEndDnaCoord(const IntRange* const displayRange, 
+int getEndDnaCoord(const IntRange* const displayRange,
                    const int frame,
-                   const BlxSeqType displaySeqType, 
-                   const gboolean displayRev, 
+                   const BlxSeqType displaySeqType,
+                   const gboolean displayRev,
                    const int numFrames,
                    const IntRange* const refSeqRange)
 {
   int result = displayRange->max();
-  
+
   /* Convert the display coord to coords into the ref seq, which is a DNA sequence. We want
    * the last base in the codon, if this is a peptide sequence. */
   const int baseNum = numFrames;
   result = convertDisplayIdxToDnaIdx(result, displaySeqType, frame, baseNum, numFrames, displayRev, refSeqRange);
-  
+
   return result;
 }
 
@@ -1616,8 +1617,8 @@ gboolean blxColorOverridden(const BlxColor *blxColor, const gboolean selected, c
 
 /* Override a specific GdkColor in dest with a lighter/darker version of the same GdkColor in
  * source. Returns true if successful, false otherwise. */
-gboolean blxColorOverrideTransparency(BlxColor *dest, 
-                                      const BlxColor *source, 
+gboolean blxColorOverrideTransparency(BlxColor *dest,
+                                      const BlxColor *source,
                                       const gboolean lighten,
                                       const gboolean selected,
                                       const gboolean usePrintColors)
@@ -1650,9 +1651,9 @@ gboolean blxColorOverrideTransparency(BlxColor *dest,
 
 
 /* For the given BlxColor, set a pointer to the GdkColor that meets the given criteria */
-static void blxColorOverrideColor(BlxColor *blxColor, 
-                                  const gboolean selected, 
-                                  const gboolean usePrintColors, 
+static void blxColorOverrideColor(BlxColor *blxColor,
+                                  const gboolean selected,
+                                  const gboolean usePrintColors,
                                   const GdkColor *source)
 {
   GdkColor *color = NULL ;
@@ -1695,7 +1696,7 @@ static void blxColorOverrideColor(BlxColor *blxColor,
 GdkColor *blxColorGetColor(BlxColor *blxColor, const gboolean selected, const gboolean usePrintColors)
 {
   GdkColor *result = NULL;
-  
+
   if (usePrintColors)
     {
       if (selected)
@@ -1718,7 +1719,7 @@ GdkColor *blxColorGetColor(BlxColor *blxColor, const gboolean selected, const gb
           result = &blxColor->normal;
         }
     }
-    
+
   return result;
 }
 
@@ -1727,7 +1728,7 @@ GdkColor *blxColorGetColor(BlxColor *blxColor, const gboolean selected, const gb
 const GdkColor *blxColorGetColor(const BlxColor *blxColor, const gboolean selected, const gboolean usePrintColors)
 {
   const GdkColor *result = NULL;
-  
+
   if (usePrintColors)
     {
       if (selected)
@@ -1750,7 +1751,7 @@ const GdkColor *blxColorGetColor(const BlxColor *blxColor, const gboolean select
           result = &blxColor->normal;
         }
     }
-    
+
   return result;
 }
 
@@ -1769,7 +1770,7 @@ gboolean colorsEqual(GdkColor *color1, GdkColor *color2)
 char getStrandAsChar(const BlxStrand strand)
 {
   char result = '.';
-  
+
   if (strand == BLXSTRAND_FORWARD)
     {
       result = '+';
@@ -1778,7 +1779,7 @@ char getStrandAsChar(const BlxStrand strand)
     {
       result = '-';
     }
-  
+
   return result;
 }
 
@@ -1798,7 +1799,7 @@ int roundNearest(const double val)
     {
       result = truncated - 1;
     }
-    
+
   return result;
 }
 
@@ -1815,72 +1816,72 @@ int roundToValue(const int inputVal, const int roundTo)
 int roundToValueFromList(const int inputVal, GSList *roundValues, int *roundedTo)
 {
   /* Decide what amount to round to the nearest number of, out of a list of possible
-   * "nice" values. Find the nearest value in this list to our result. The list 
+   * "nice" values. Find the nearest value in this list to our result. The list
    * shouldn't be long, so this doesn't worry about efficiency */
   GSList *listItem = roundValues;
   int roundTo = UNSET_INT;
   int smallestDiff = inputVal - roundTo;
-  
+
   for ( ; listItem; listItem = listItem->next)
     {
       int val = GPOINTER_TO_INT(listItem->data);
       int thisDiff = inputVal - val;
-      
+
       if (roundTo == UNSET_INT || (val > 0 && abs(thisDiff) < smallestDiff))
 	{
 	  roundTo = val;
 	  smallestDiff = abs(thisDiff);
 	}
     }
-  
+
   /* Round the input to the nearest multiple of 'roundTo'. */
   int result = roundNearest((double)inputVal / (double)roundTo) * roundTo;
-  
+
   if (roundedTo)
     {
       *roundedTo = roundTo;
     }
-  
+
   return result;
 }
 
 
 /* Function to round the given value up to the next "nice" value, from the given
- * list of values to round by. Returns the value it rounded to the nearest of. 
+ * list of values to round by. Returns the value it rounded to the nearest of.
  * Input list of values should be sorted in descending order. */
 int roundUpToValueFromList(const int inputVal, GSList *roundValues, int *roundedTo)
 {
   /* Decide what amount to round to the nearest number of, out of a list of possible
-   * "nice" values. Find the nearest value in this list to our result. The list 
+   * "nice" values. Find the nearest value in this list to our result. The list
    * shouldn't be long, so this doesn't worry about efficiency */
   GSList *listItem = roundValues;
   int roundTo = UNSET_INT;
   int smallestDiff = inputVal - roundTo;
-  
+
   for ( ; listItem; listItem = listItem->next)
     {
       int val = GPOINTER_TO_INT(listItem->data);
 
       if (val < inputVal)
         break;
-      
+
       int thisDiff = inputVal - val;
-      
+
       if (roundTo == UNSET_INT || (val > 0 && abs(thisDiff) < smallestDiff))
 	{
 	  roundTo = val;
 	  smallestDiff = abs(thisDiff);
 	}
     }
-  
+
   /* Round the input to the nearest multiple of 'roundTo'. */
   int result = max(1, roundNearest((double)inputVal / (double)roundTo)) * roundTo;
-  
+
   if (roundedTo)
     {
       *roundedTo = roundTo;
     }
-  
+
   return result;
 }
 
@@ -1900,9 +1901,9 @@ char* convertDoubleToString(const gdouble value, const int numDp)
 {
   char format[numDp + 5];
   sprintf(format, "%%1.%df", numDp);
-  
+
   char result[numDigitsInInt((int)value) + numDp + 2]; /* the +2 includes the and terminating null */
-  
+
   sprintf(result, format, value);
   return g_strdup(result);
 }
@@ -1929,13 +1930,13 @@ gboolean isNewlineChar(const char curChar)
 }
 
 
-/* Get the child of the given widget that has the given name (which could be the given 
+/* Get the child of the given widget that has the given name (which could be the given
  * widget itself.) Assumes there is only one, so returns the first one found. */
 GtkWidget* getNamedChildWidget(GtkWidget *widget, const gchar *searchName)
 {
   GtkWidget *result = NULL;
   const gchar *widgetName = gtk_widget_get_name(widget);
- 
+
   if (stringsEqual(widgetName, searchName, TRUE))
     {
       result = widget;
@@ -1945,7 +1946,7 @@ GtkWidget* getNamedChildWidget(GtkWidget *widget, const gchar *searchName)
       /* recurse over children until we find the detail view (assumes there is only one!) */
       GList *children = gtk_container_get_children(GTK_CONTAINER(widget));
       GList *child = children;
-      
+
       for ( ; child && !result; child = child->next)
         {
           GtkWidget *childWidget = GTK_WIDGET(child->data);
@@ -1954,7 +1955,7 @@ GtkWidget* getNamedChildWidget(GtkWidget *widget, const gchar *searchName)
 
       g_list_free(children);
     }
-    
+
   return result;
 }
 
@@ -1970,7 +1971,7 @@ void stringProtect(GIOChannel *ioChannel, const char *string, GError **error)
 
   const char *cp;
   GError *tmpError = NULL;
- 
+
   g_io_channel_write_unichar(ioChannel, ' ', &tmpError);
 
   if (!tmpError)
@@ -1997,9 +1998,9 @@ void stringProtect(GIOChannel *ioChannel, const char *string, GError **error)
 }
 
 
-/* Read a protected string. If 'target' is given, then this function will 
- * populate it with the result and return a pointer to it. If target is NULL, 
- * then memory will be allocated for the result and this must be freed by the 
+/* Read a protected string. If 'target' is given, then this function will
+ * populate it with the result and return a pointer to it. If target is NULL,
+ * then memory will be allocated for the result and this must be freed by the
  * caller using g_free. */
 char *stringUnprotect(char **textp, char *target)
 {
@@ -2009,7 +2010,7 @@ char *stringUnprotect(char **textp, char *target)
  redo:
   cp = *textp;
   cpd = target;
-  
+
   while (*cp)
     {
       /* Protected strings are enclosed in quotes, so find the opening quote
@@ -2027,13 +2028,13 @@ char *stringUnprotect(char **textp, char *target)
   while (*cp != '"' && *cp)
     {
       /* If it's the escape character, skip it and process the next character
-       * instead (this avoids the escaped character being processed by the 
+       * instead (this avoids the escaped character being processed by the
        * while statement, so internal quotes do not cause the loop to exit). */
       if (*cp == '$')
         cp++;
 
       /* If the target pointer exists, set the current char and increment.
-       * Otherwise, on the first run through we maintain a count of how 
+       * Otherwise, on the first run through we maintain a count of how
        * many chars there are so we can allocate the correct memory for the target */
       if (cpd)
         *cpd++ = *cp;
@@ -2042,14 +2043,14 @@ char *stringUnprotect(char **textp, char *target)
 
       cp++;
     }
-  
+
   if (!target)
     {
       /* Allocate the memory for the target and then re-do the loops to populate it. */
       target = (char*)g_malloc0(count+1);
       goto redo;
     }
-  
+
   *cp = '\0' ;
   *textp = cp+1; /* skip quote */
 
@@ -2062,7 +2063,7 @@ char *stringUnprotect(char **textp, char *target)
  ***********************************************************/
 
 /* Utility to set the width and height of a GtkTextView based on the width and
- * number of lines of text it contains (but not going above the given max). 
+ * number of lines of text it contains (but not going above the given max).
  * Returns the width/height that was set. */
 static void setTextViewSize(GtkWidget *textView, GtkTextBuffer *textBuffer, PangoFontDescription *fontDesc, int *width, int *height)
 {
@@ -2079,7 +2080,7 @@ static void setTextViewSize(GtkWidget *textView, GtkTextBuffer *textBuffer, Pang
       /* Loop through all lines and find the max line length. */
       int maxWidth = 0;
       int numLines = gtk_text_buffer_get_line_count(textBuffer);
-      
+
       int line = 0;
       for ( ; line < numLines; ++line)
         {
@@ -2087,14 +2088,14 @@ static void setTextViewSize(GtkWidget *textView, GtkTextBuffer *textBuffer, Pang
           GtkTextIter iter2;
           gtk_text_buffer_get_iter_at_line(textBuffer, &iter1, line);
           gtk_text_buffer_get_iter_at_line(textBuffer, &iter2, line + 1);
-          
+
           gchar *text = gtk_text_iter_get_text(&iter1, &iter2);
           const int lineWidth = getTextWidth(textView, text);
-          
+
           if (lineWidth > maxWidth)
             maxWidth = lineWidth;
-        } 
-      
+        }
+
       /* Limit it to the input width */
       *width = min(*width, maxWidth);
     }
@@ -2113,10 +2114,10 @@ GtkWidget* createScrollableTextView(const char *messageText,
 {
   /* Create a text buffer and copy the text in */
   GtkTextBuffer *textBuffer = gtk_text_buffer_new(NULL);
-  
+
   GtkTextIter textIter;
   gtk_text_buffer_get_iter_at_line(textBuffer, &textIter, 0);
-  
+
   if (useMarkup && messageText)
     {
       gtk_text_buffer_insert_markup(textBuffer, &textIter, messageText);
@@ -2125,46 +2126,46 @@ GtkWidget* createScrollableTextView(const char *messageText,
     {
       gtk_text_buffer_set_text(textBuffer, messageText, -1);
     }
-  
+
   /* Create a text view to display the buffer */
   GtkWidget *textView = gtk_text_view_new();
   gtk_text_view_set_buffer(GTK_TEXT_VIEW(textView), textBuffer);
   gtk_text_view_set_editable(GTK_TEXT_VIEW(textView), FALSE);
-  
+
   if (textViewOut)
     {
       *textViewOut = GTK_TEXT_VIEW(textView);
     }
-  
+
   if (fontDesc)
     {
       gtk_widget_modify_font(textView, fontDesc);
     }
-  
+
   if (wrapText)
     {
       gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textView), GTK_WRAP_WORD);
     }
-  
+
   /* Put the text view in a scrollable window */
   GtkWidget *scrollWin = gtk_scrolled_window_new(NULL, NULL);
   gtk_container_add(GTK_CONTAINER(scrollWin), textView);
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollWin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
-  /* Set the height to fit the number of lines of text, unless this would exceed 
+  /* Set the height to fit the number of lines of text, unless this would exceed
    * the passed-in height. To do: should pass in width here too but the calculation
    * is not accurate. */
  setTextViewSize(textView, textBuffer, fontDesc, NULL, height);
-  
+
   /* Return the outermost container */
   return scrollWin;
 }
 
 
-/* Utility to pop up a simple dialog with the given title and text, with just an "OK" 
- * button. Returns the dialog, and optionally sets a pointer to the text buffer in the 
+/* Utility to pop up a simple dialog with the given title and text, with just an "OK"
+ * button. Returns the dialog, and optionally sets a pointer to the text buffer in the
  * textBuffer return arg. */
-GtkWidget* showMessageDialog(const char *title,  
+GtkWidget* showMessageDialog(const char *title,
                              const char *messageText,
                              GtkWidget *parent,
                              const int maxWidth,
@@ -2174,8 +2175,8 @@ GtkWidget* showMessageDialog(const char *title,
                              PangoFontDescription *fontDesc,
                              GtkTextView **textView)
 {
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
-                                                  GTK_WINDOW(parent), 
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
+                                                  GTK_WINDOW(parent),
                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
                                                   GTK_STOCK_OK,
                                                   GTK_RESPONSE_ACCEPT,
@@ -2190,13 +2191,13 @@ GtkWidget* showMessageDialog(const char *title,
   int width = maxWidth, height = maxHeight;
   GtkWidget *child = createScrollableTextView(messageText, wrapText, fontDesc, useMarkup, NULL, NULL, textView);
   height += 40; /* fudge to allow space for dialog buttons */
-  
+
   gtk_window_set_default_size(GTK_WINDOW(dialog), width, height);
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), child, TRUE, TRUE, 0);
 
   g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
   gtk_widget_show_all(dialog);
-  
+
   return dialog;
 }
 
@@ -2212,15 +2213,15 @@ static CallbackData* widgetGetCallbackData(GtkWidget *widget)
 void widgetSetCallbackData(GtkWidget *widget, BlxResponseCallback func, gpointer data)
 {
   if (widget)
-    { 
+    {
       CallbackData *callbackData = widgetGetCallbackData(widget);
-      
+
       if (!callbackData)
         callbackData = new CallbackData;
-      
+
       callbackData->func = func;
       callbackData->data = data;
-      
+
       g_object_set_data(G_OBJECT(widget), "callbackData", callbackData);
       g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(onDestroyCustomWidget), NULL);
     }
@@ -2232,12 +2233,12 @@ static gboolean widgetCallCallback(GtkWidget *widget, const gint responseId)
 {
   gboolean result = TRUE;
   CallbackData *callbackData = widgetGetCallbackData(widget);
-  
+
   if (callbackData && callbackData->func)
     {
       result = callbackData->func(widget, responseId, callbackData->data);
     }
-  
+
   return result;
 }
 
@@ -2247,25 +2248,25 @@ static gboolean widgetCallCallback(GtkWidget *widget, const gint responseId)
 gboolean widgetCallAllCallbacks(GtkWidget *widget, gpointer data)
 {
   gboolean result = TRUE;
-  
+
   if (widget && GTK_IS_WIDGET(widget))
     {
       gint responseId = GPOINTER_TO_INT(data);
-      
+
       if (!widgetCallCallback(widget, responseId))
         {
           result = FALSE;
         }
-  
+
       if (GTK_IS_CONTAINER(widget))
         {
           GList *children = gtk_container_get_children(GTK_CONTAINER(widget));
           GList *childItem = children;
-          
+
           for ( ; childItem; childItem = childItem->next)
             {
               GtkWidget *child = GTK_WIDGET(childItem->data);
-              
+
               if (!widgetCallAllCallbacks(child, data))
                 {
                   result = FALSE;
@@ -2275,29 +2276,29 @@ gboolean widgetCallAllCallbacks(GtkWidget *widget, gpointer data)
           g_list_free(children);
         }
     }
-  
+
   return result;
 }
 
 
 /* Generic callback to call all user-specified callbacks for all child widgets of
- * the given dialog if ACCEPT or APPLY responses received. Also closes the dialog 
+ * the given dialog if ACCEPT or APPLY responses received. Also closes the dialog
  * if ACCEPT or REJECT responses received.
  * The user data must be a boolean (which has been converted to a pointer using
- * GINT_TO_POINTER), that is true if this dialog is persistent or false 
- * otherwise. If it is persistent, the dialog will be hidden rather than being 
+ * GINT_TO_POINTER), that is true if this dialog is persistent or false
+ * otherwise. If it is persistent, the dialog will be hidden rather than being
  * destroyed. */
 void onResponseDialog(GtkDialog *dialog, gint responseId, gpointer data)
 {
   gboolean destroy = TRUE;
-  
+
   switch (responseId)
   {
     case GTK_RESPONSE_ACCEPT:
       /* Destroy if successful */
       destroy = widgetCallAllCallbacks(GTK_WIDGET(dialog), GINT_TO_POINTER(responseId));
       break;
-      
+
     case GTK_RESPONSE_APPLY:
       widgetCallAllCallbacks(GTK_WIDGET(dialog), GINT_TO_POINTER(responseId));
       destroy = FALSE;
@@ -2308,21 +2309,21 @@ void onResponseDialog(GtkDialog *dialog, gint responseId, gpointer data)
       widgetCallAllCallbacks(GTK_WIDGET(dialog), GINT_TO_POINTER(responseId));
       destroy = FALSE;
       break;
-      
+
     case GTK_RESPONSE_CANCEL:
     case GTK_RESPONSE_REJECT:
       destroy = TRUE;
       break;
-      
+
     default:
       break;
   };
-  
+
   if (destroy)
     {
       /* If it's a persistent dialog, just hide it, otherwise destroy it */
       const gboolean isPersistent = GPOINTER_TO_INT(data);
-      
+
       if (isPersistent)
         {
           gtk_widget_hide_all(GTK_WIDGET(dialog));
@@ -2340,14 +2341,14 @@ void dialogClearContentArea(GtkDialog *dialog)
 {
   GtkWidget *contentArea = dialog->vbox;
   GtkWidget *actionArea = dialog->action_area;
-  
+
   GList *children = gtk_container_get_children(GTK_CONTAINER(contentArea));
   GList *child = children;
-  
+
   for ( ; child; child = child->next)
     {
       GtkWidget *childWidget = GTK_WIDGET(child->data);
-      
+
       if (childWidget != actionArea)
         {
           gtk_widget_destroy(childWidget);
@@ -2356,7 +2357,7 @@ void dialogClearContentArea(GtkDialog *dialog)
     }
 
   g_list_free(children);
-  
+
 //  gtk_container_foreach(GTK_CONTAINER(contentArea), destroyWidget, NULL);
 }
 
@@ -2366,12 +2367,12 @@ void dialogClearContentArea(GtkDialog *dialog)
 GtkWidget* getPersistentDialog(GtkWidget* dialogList[], const int dialogId)
 {
   GtkWidget *result = NULL;
-  
+
   if (dialogList[dialogId])
     {
       result = dialogList[dialogId];
     }
-  
+
   return result;
 }
 
@@ -2391,7 +2392,7 @@ void addPersistentDialog(GtkWidget* dialogList[], const int dialogId, GtkWidget
           gtk_widget_destroy(dialogList[dialogId]);
           dialogList[dialogId] = NULL;
         }
-      
+
       dialogList[dialogId] = widget;
     }
 }
@@ -2415,7 +2416,7 @@ int wildcardSearch(const char *textToSearch, const char *searchStr)
     {
       return 0;
     }
-  
+
   char *textChar = (char*)textToSearch; /* to do: don't cast away const! */
   char *searchChar = (char*)searchStr;  /* to do: don't cast away const! */
   char *ts = 0, *cs = 0, *s = 0 ;
@@ -2440,47 +2441,47 @@ int wildcardSearch(const char *textToSearch, const char *searchStr)
                 /* not success yet go back in template */
                 searchChar = ts;
                 textChar = cs + 1;
-                
+
                 if (ts == searchStr)
                   {
                     s = 0;
                   }
               }
-            
+
             break ;
           }
-            
+
         case '?':
           {
             if (!*textChar)
               {
                 return 0;
               }
-            
+
             if(!s)
               {
                 s = textChar;
               }
-            
+
             searchChar++;
             textChar++;
             break;
           }
-            
+
         case '*':
           {
             ts = searchChar;
-            
+
             while( *searchChar == '?' || *searchChar == '*')
               {
                 searchChar++;
               }
-            
+
             if (!*searchChar)
               {
                 return s ? 1 + (s-textToSearch) : 1 ;
               }
-            
+
             while (toupper(*textChar) != toupper(*searchChar))
               {
                 if (*textChar)
@@ -2488,18 +2489,18 @@ int wildcardSearch(const char *textToSearch, const char *searchStr)
                 else
                   return 0;
               }
-            
+
             star = 1;
             cs = textChar;
-            
+
             if(!s)
               {
                 s = textChar;
               }
-            
+
             break;
           }
-            
+
         default:
           {
             if (toupper(*searchChar++) != toupper(*textChar++))
@@ -2508,10 +2509,10 @@ int wildcardSearch(const char *textToSearch, const char *searchStr)
                   {
                     return 0;
                   }
-                
+
                 searchChar = ts;
                 textChar = cs + 1;
-                
+
                 if(ts == searchStr)
                   {
                     s = 0;
@@ -2521,7 +2522,7 @@ int wildcardSearch(const char *textToSearch, const char *searchStr)
               {
                 s = textChar - 1 ;
               }
-            
+
             break;
           }
         }
@@ -2532,17 +2533,17 @@ int wildcardSearch(const char *textToSearch, const char *searchStr)
 
 
 /* Given a string, returns the string if is less than a fudge factor or returns
- * the string abbreviated in the form "xxxxx...yyyyy". The result should be 
+ * the string abbreviated in the form "xxxxx...yyyyy". The result should be
  * free'd with g_free. */
 gchar *abbreviateText(const char *inputStr, const int max_len)
 {
   gchar *result = NULL;
 
-  if (max_len > 0) 
-    { 
+  if (max_len > 0)
+    {
       char abbrev[] = "<>";
       int inputStrLen = strlen(inputStr);
-      
+
       if (inputStrLen <= max_len)
         {
           result = g_strdup(inputStr);
@@ -2555,24 +2556,24 @@ gchar *abbreviateText(const char *inputStr, const int max_len)
 
           const int tailChars = max_len - ((max_len / 2) + 1) ;
           char *tailStr = g_strndup(inputStr + inputStrLen - tailChars, tailChars); /* trailing null fudged in here. */
-          
+
           result = g_strconcat(headStr, abbrev, tailStr, NULL);
-          
+
           g_free(headStr);
           g_free(tailStr);
         }
     }
-    
+
   return (result) ;
 }
 
 
-/* String comparison function with caseSensitive option. Returns true if the two 
+/* String comparison function with caseSensitive option. Returns true if the two
  * strings are equal. The two strings must be null-terminated. */
 gboolean stringsEqual(const char *str1, const char *str2, const gboolean caseSensitive)
 {
   gboolean result = FALSE;
-  
+
   if (!str1 && !str2)
     {
       result = TRUE;
@@ -2590,26 +2591,26 @@ gboolean stringsEqual(const char *str1, const char *str2, const gboolean caseSen
       const size_t len1 = strlen(str1);
       result = (strlen(str2) == len1 && !g_ascii_strncasecmp(str1, str2, len1));
     }
-  
+
   return result;
 }
 
 
 /* Parses a line of text containing a match description, which is of the form:
- * 
+ *
  *                       "\"name\" start end (length)"
  * or:                   "name start end (length)"
  *
  * Returns the number of valid fields that were found.
- * 
+ *
  * We could verify "name" more but it's probably not worth it - in fact, being
- * more flexible here allows us to use wildcards, because we can verify it 
+ * more flexible here allows us to use wildcards, because we can verify it
  * with wildcard matching later.
  */
 int parseMatchLine(const char *inputText,
                    char **matchNameOut,
-                   int *matchStartOut, 
-                   int *matchEndOut, 
+                   int *matchStartOut,
+                   int *matchEndOut,
                    int *matchLenOut)
 {
   char sequence_name[1000] = {'\0'};
@@ -2617,14 +2618,14 @@ int parseMatchLine(const char *inputText,
   const char *format_str = "\"%[^\"]\"%d%d (%d)";
 
   int fields = sscanf(inputText, format_str, &sequence_name[0], &start, &end, &length);
-  
+
   if (fields < 1)
     {
       /* Try again but without the quotes */
       format_str = "%[^\"]%d%d (%d)";
       fields = sscanf(inputText, format_str, &sequence_name[0], &start, &end, &length);
     }
-  
+
   gboolean foundError = (fields < 1);
   int validFields = 0;
 
@@ -2632,16 +2633,16 @@ int parseMatchLine(const char *inputText,
     {
       *matchNameOut = g_strdup(sequence_name);
       foundError = (sequence_name == NULL);
-      
+
       if (!foundError)
         ++validFields;
     }
-    
+
   if (fields > 1)
     {
       *matchStartOut = start;
       foundError = (start < 1);
-      
+
       if (!foundError)
         ++validFields;
     }
@@ -2650,7 +2651,7 @@ int parseMatchLine(const char *inputText,
     {
       *matchEndOut = end;
       foundError = (start >= end);
-      
+
       if (!foundError)
         ++validFields;
     }
@@ -2659,7 +2660,7 @@ int parseMatchLine(const char *inputText,
     {
       *matchLenOut = length;
       foundError = (length < 1);
-      
+
       if (!foundError)
         ++validFields;
     }
@@ -2669,7 +2670,7 @@ int parseMatchLine(const char *inputText,
 
 
 /* Parse a list of matches using parseMatchLine(), and extract the names. Returns
- * a GList of sequence names. Both the list and all its entries should be free'd 
+ * a GList of sequence names. Both the list and all its entries should be free'd
  * by the caller. */
 GList* parseMatchList(const char *inputText)
 {
@@ -2681,7 +2682,7 @@ GList* parseMatchList(const char *inputText)
       const char *delimiters = "\n\r,;";
       char **tokens = g_strsplit_set(inputText, delimiters, -1);   /* -1 means do all tokens. */
       char **token = tokens;
-      
+
       if (token)
         {
           char *match = *token;
@@ -2700,10 +2701,10 @@ GList* parseMatchList(const char *inputText)
               match = *token ? *token : 0; /* token may be empty string if two delimiters next to each other */
             }
         }
-      
+
       g_strfreev(tokens);
     }
-  
+
   return matchList ;
 }
 
@@ -2715,7 +2716,7 @@ void requestPrimaryClipboardText(GtkClipboardTextReceivedFunc callback, gpointer
 
   GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
   gtk_clipboard_request_text(clipboard, callback, data);
-  
+
 #endif
 }
 
@@ -2727,7 +2728,7 @@ void setPrimaryClipboardText(const char *text)
 
   GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
   gtk_clipboard_set_text(clipboard, text, -1);
-  
+
 #endif
 }
 
@@ -2763,27 +2764,27 @@ GdkDrawable* createBlankPixmap(GtkWidget *widget)
 {
   /* If there's already a stored drawable, re-use it */
   GdkDrawable *drawable = widgetGetDrawableAllowInvalid(widget);
-  
+
   if (!drawable || !drawableSizeCorrect(drawable, widget->allocation.width, widget->allocation.height))
     {
       GdkWindow *window = GTK_IS_LAYOUT(widget) ? GTK_LAYOUT(widget)->bin_window : widget->window;
-  
+
       drawable = gdk_pixmap_new(window, widget->allocation.width, widget->allocation.height, -1);
       gdk_drawable_set_colormap(drawable, gdk_colormap_get_system());
       widgetSetDrawable(widget, drawable); /* deletes the old drawable, if there is one */
 
       DEBUG_OUT("Created drawable '%x', XID=%d\n", drawable, gdk_x11_drawable_get_xid(drawable));
     }
-  
+
   /* Paint a blank rectangle for the background, the same color as the widget's background */
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   GdkColor *bgColor = &widget->style->bg[GTK_STATE_NORMAL];
   gdk_gc_set_foreground(gc, bgColor);
   gdk_draw_rectangle(drawable, gc, TRUE, 0, 0, widget->allocation.width, widget->allocation.height);
-      
+
   g_object_unref(gc);
-  
+
   widgetSetDrawableValid(widget, TRUE);
 
   return drawable;
@@ -2796,7 +2797,7 @@ GdkDrawable* createBlankSizedPixmap(GtkWidget *widget, GdkDrawable *window, cons
 {
   /* If there's already a stored drawable, re-use it */
   GdkDrawable *drawable = widgetGetDrawableAllowInvalid(widget);
-  
+
   if (!drawable || !drawableSizeCorrect(drawable, width, height))
     {
       drawable = gdk_pixmap_new(window, width, height, -1);
@@ -2804,58 +2805,58 @@ GdkDrawable* createBlankSizedPixmap(GtkWidget *widget, GdkDrawable *window, cons
       widgetSetDrawable(widget, drawable); /* deletes the old drawable, if there is one */
       DEBUG_OUT("Created drawable '%x', XID=%d\n", drawable, gdk_x11_drawable_get_xid(drawable));
     }
-  
+
   /* Paint a blank rectangle for the background, the same color as the widget's background */
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   GdkColor *bgColor = &widget->style->bg[GTK_STATE_NORMAL];
   gdk_gc_set_foreground(gc, bgColor);
   gdk_draw_rectangle(drawable, gc, TRUE, 0, 0, width, height);
-  
+
   g_object_unref(gc);
-  
+
   widgetSetDrawableValid(widget, TRUE);
-  
+
   return drawable;
 }
 
 
-/* Utility to pop up a simple confirmation dialog box with the given title and text, 
+/* Utility to pop up a simple confirmation dialog box with the given title and text,
  * with just an "OK" and "Cancel" button. Blocks until the user responds, and returns
  * their response ID. */
 gint runConfirmationBox(GtkWidget *widget, const char *title, const char *messageText)
 {
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
-                                                  GTK_WINDOW(widget), 
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
+                                                  GTK_WINDOW(widget),
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                                   GTK_STOCK_CANCEL,
                                                   GTK_RESPONSE_REJECT,
                                                   GTK_STOCK_OK,
                                                   GTK_RESPONSE_ACCEPT,
                                                   NULL);
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
 
   /* Put message and icon into an hbox */
   GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, TRUE, TRUE, 0);
-  
+
   GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
   gtk_box_pack_start(GTK_BOX(hbox), image, TRUE, TRUE, 0);
-  
+
   GtkWidget *label = gtk_label_new(messageText);
   gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
   gtk_widget_show_all(hbox);
-  
+
   gint response = gtk_dialog_run(GTK_DIALOG(dialog));
-  
+
   gtk_widget_destroy(dialog);
-  
+
   return response;
 }
 
 
-/* If error is non-null, tag the given prefix string onto the start of the given 
+/* If error is non-null, tag the given prefix string onto the start of the given
  * error's message. If error is null, do nothing. */
 void prefixError(GError *error, const char *formatStr, ...)
 {
@@ -2865,7 +2866,7 @@ void prefixError(GError *error, const char *formatStr, ...)
     {
       va_list argp;
       va_start(argp, formatStr);
-      
+
       /* Print the prefix text and args into a new string. We're not sure how much space we need
        * for the args, so give a generous buffer but use vsnprintf to make sure we don't overrun.
        * (g_string_vprintf would avoid this problem but is only available from GLib version 2.14). */
@@ -2877,7 +2878,7 @@ void prefixError(GError *error, const char *formatStr, ...)
 
       /* Append the error message */
       char *resultStr = g_strdup_printf("%s%s", tmpStr, error->message);
-      
+
       /* Replace the error message text with the new string. */
       g_free(error->message);
       error->message = resultStr;
@@ -2892,19 +2893,19 @@ void postfixError(GError *error, const char *formatStr, ...)
     {
       va_list argp;
       va_start(argp, formatStr);
-      
+
       /* Print the postfix text and args into a new string. We're not sure how much space we need
        * for the args, so give a generous buffer but use vsnprintf to make sure we don't overrun.
        * (g_string_vprintf would avoid this problem but is only available from GLib version 2.14). */
       const int len = strlen(formatStr) + 200;
       char tmpStr[len];
       vsnprintf(tmpStr, len, formatStr, argp);
-      
+
       va_end(argp);
-      
+
       /* Prepend the error message */
       char *resultStr = g_strdup_printf("%s%s", error->message, tmpStr);
-      
+
       /* Replace the error message text with the new string. */
       g_free(error->message);
       error->message = resultStr;
@@ -2919,7 +2920,7 @@ void postfixError(GError *error, const char *formatStr, ...)
 //{
 //  if (dest == NULL || src == NULL || *src == NULL)
 //    return;
-//  
+//
 //  if (*dest == NULL)
 //    {
 //      g_propagate_error(dest, *src);
@@ -2948,9 +2949,9 @@ void reportAndClearIfError(GError **error, GLogLevelFlags log_level)
         g_debug("%s", (*error)->message);
       else if (log_level & G_LOG_LEVEL_INFO)
         g_message_info("%s", (*error)->message);
-      else 
+      else
         g_message("%s", (*error)->message);
-            
+
       g_error_free(*error);
       *error = NULL;
     }
@@ -2963,9 +2964,9 @@ void reportAndClearIfError(GError **error, GLogLevelFlags log_level)
 void debugLogLevel(const int increaseAmt)
 {
   static int count = 0;
-  
+
   gboolean done = FALSE;
-  
+
   /* If decreasing the count (i.e. printing an exit statement) decrease the log level
    * first. */
   if (increaseAmt < 0)
@@ -2974,14 +2975,14 @@ void debugLogLevel(const int increaseAmt)
       if (count < 0) count = 0;
       done = TRUE;
     }
-  
+
   /* Print whitespace */
   int i = 0;
   for ( ; i < count; ++i)
     {
       printf("  "); /* print 2 spaces per log level */
     }
-  
+
   if (!done)
     {
       count += increaseAmt;
@@ -2991,9 +2992,9 @@ void debugLogLevel(const int increaseAmt)
 #endif
 
 
-/* Utility to draw a filled rectangle (optionally transparent; 
+/* Utility to draw a filled rectangle (optionally transparent;
  * pass alpha=1 for opaque) */
-void drawRect(GdkDrawable *drawable, 
+void drawRect(GdkDrawable *drawable,
               GdkColor *color,
               const int x,
               const int y,
@@ -3003,34 +3004,34 @@ void drawRect(GdkDrawable *drawable,
               cairo_operator_t op)
 {
   cairo_t *cr = gdk_cairo_create(drawable);
-  
+
   gdk_cairo_set_source_color(cr, color);
-  
+
   cairo_rectangle(cr, x, y, width, height);
   cairo_clip(cr);
-  
+
   cairo_set_operator(cr, op);
   cairo_paint_with_alpha(cr, alpha);
   cairo_destroy(cr);
 }
 
 
-/* Draw the highlight box (for highlighting the current detail-view display range on 
+/* Draw the highlight box (for highlighting the current detail-view display range on
  * big-picture widgets such as the grids and exon views). */
 void drawHighlightBox(GdkDrawable *drawable,
                       const GdkRectangle* const rect,
-                      const gint minWidth, 
+                      const gint minWidth,
                       GdkColor *color)
 {
   const int width = max(minWidth, rect->width);
 
   cairo_t *cr = gdk_cairo_create(drawable);
-  
+
   gdk_cairo_set_source_color(cr, color);
   cairo_rectangle(cr, rect->x, rect->y, width, rect->height);
   cairo_clip(cr);
   cairo_paint_with_alpha(cr, 0.2);
-  
+
   cairo_destroy(cr);
 }
 
@@ -3082,12 +3083,12 @@ static gchar *copySeqSegment(const char* const inputSeq, const int idx1, const i
 
   const int minIdx = min(idx1, idx2);
   const int maxIdx = max(idx1, idx2);
-  
+
   const int segmentLen = maxIdx - minIdx + 1;
 
   gchar *segment = (gchar*)g_malloc(sizeof(gchar) * segmentLen + 1);
 
-  
+
   strncpy(segment, inputSeq + minIdx, segmentLen);
   segment[segmentLen] = '\0';
 
@@ -3101,8 +3102,8 @@ static gchar *copySeqSegment(const char* const inputSeq, const int idx1, const i
  *
  * The result is complemented if the reverse strand is requested, but only if
  * the allowComplement flag allows it.
- * 
- * The result is translated to a peptide sequence if the destination seq type 
+ *
+ * The result is translated to a peptide sequence if the destination seq type
  * is peptide.
  *
  * The result is reversed if the reverseResult flag is true (regardless of the
@@ -3116,7 +3117,7 @@ gchar *getSequenceSegment(const char* const dnaSequence,
                           const BlxSeqType srcSeqType,        /* whether input sequence is nucleotide or peptide */
                           const BlxSeqType destSeqType,       /* whether result sequence should be nucleotide or peptide */
                           const int frame,
-                          const int numFrames, 
+                          const int numFrames,
                           const IntRange* const refSeqRange,
                           const BlxBlastMode blastMode,
                           char **geneticCode,
@@ -3127,21 +3128,21 @@ gchar *getSequenceSegment(const char* const dnaSequence,
 {
   gchar *result = NULL;
   GError *tmpError = NULL;
-  
+
   if (destSeqType == BLXSEQ_DNA && srcSeqType == BLXSEQ_PEPTIDE)
     {
       /* We shouldn't try to convert from peptide to nucleotide. If we get here it's a coding error */
       g_set_error(error, SEQTOOLS_ERROR, SEQTOOLS_ERROR_SEQ_SEGMENT, "Error: requested conversion of peptide sequence to nucleotide sequence.\n");
       return result;
     }
-  
+
   IntRange qRange(qRangeIn->min(), qRangeIn->max());
-  
+
   if (qRange.min() < refSeqRange->min() || qRange.max() > refSeqRange->max())
     {
-      /* We might request up to 3 bases beyond the end of the range if we want to 
+      /* We might request up to 3 bases beyond the end of the range if we want to
        * show a partial triplet at the start/end. (It's a bit tricky for the caller to
-       * specify the exact bases they want here so we allow it but just limit it to 
+       * specify the exact bases they want here so we allow it but just limit it to
        * the actual range so that they can't index beyond the end of the range.) Any
        * further out than one triplet is probably indicative of an error, so give a warning.
        * If it doesn't overlap the ref seq range at all, just return NULL. */
@@ -3152,18 +3153,18 @@ gchar *getSequenceSegment(const char* const dnaSequence,
         {
           g_set_error(&tmpError, SEQTOOLS_ERROR, SEQTOOLS_ERROR_SEQ_SEGMENT, "Requested query sequence %d - %d out of available range: %d - %d.\n", qRange.min(), qRange.max(), refSeqRange->min(), refSeqRange->max());
         }
-      
+
       if (qRange.min() < refSeqRange->min())
         {
           qRange.setMin(refSeqRange->min());
         }
-      
+
       if (qRange.max() > refSeqRange->max())
         {
           qRange.setMax(refSeqRange->max());
         }
     }
-  
+
   /* Get 0-based indices into the sequence */
   const int idx1 = qRange.min() - refSeqRange->min();
   const int idx2 = qRange.max() - refSeqRange->min();
@@ -3176,7 +3177,7 @@ gchar *getSequenceSegment(const char* const dnaSequence,
   if (srcSeqType == BLXSEQ_DNA && strand == BLXSTRAND_REVERSE && allowComplement && blastMode != BLXMODE_TBLASTN && blastMode != BLXMODE_BLASTP)
     {
       blxComplement(result);
-      
+
       if (!result)
         {
           g_set_error(error, SEQTOOLS_ERROR, SEQTOOLS_ERROR_SEQ_SEGMENT, "Error getting sequence segment: Failed to complement the reference sequence for the range %d - %d.\n", qRange.min(), qRange.max());
@@ -3184,7 +3185,7 @@ gchar *getSequenceSegment(const char* const dnaSequence,
           return NULL;
         }
     }
-  
+
   /* Reverse if requested. */
   if (reverseResult)
     {
@@ -3195,25 +3196,25 @@ gchar *getSequenceSegment(const char* const dnaSequence,
   if (srcSeqType == BLXSEQ_DNA && destSeqType == BLXSEQ_PEPTIDE)
     {
       char *tmp = blxTranslate(result, geneticCode);
-          
+
       g_free(result); /* delete the original because it's no longer required */
       result = tmp;
-          
+
       if (!result)
         {
           g_set_error(error, SEQTOOLS_ERROR, SEQTOOLS_ERROR_SEQ_SEGMENT,
-                      "Error getting the sequence segment: Failed to translate the DNA sequence for the reference sequence range %d - %d\n", 
+                      "Error getting the sequence segment: Failed to translate the DNA sequence for the reference sequence range %d - %d\n",
                       qRange.min(), qRange.max()) ;
-          
+
           return NULL;
         }
     }
-  
+
   if (!result)
     {
       g_set_error(error, SEQTOOLS_ERROR, SEQTOOLS_ERROR_SEQ_SEGMENT, "Failed to find sequence segment for the range %d - %d\n", qRange.min(), qRange.max());
     }
-  
+
   if (tmpError && *error != NULL)
     {
       prefixError(*error, tmpError->message);
@@ -3255,7 +3256,7 @@ const char* findFixedWidthFontFamily(GtkWidget *widget, GList *pref_families)
   PangoFontFamily **families;
   gint n_families;
   pango_context_list_families(context, &families, &n_families) ;
-  
+
   /* Loop through the available font families looking for one in our preferred list */
   gboolean found_most_preferred = FALSE;
   gint most_preferred = g_list_length(pref_families);
@@ -3265,15 +3266,15 @@ const char* findFixedWidthFontFamily(GtkWidget *widget, GList *pref_families)
   for (family = 0 ; (family < n_families && !found_most_preferred) ; family++)
     {
       const gchar *name = pango_font_family_get_name(families[family]) ;
-      
+
       /* Look for this font family in our list of preferred families */
       GList *pref = g_list_first(pref_families) ;
       gint current = 1;
-      
+
       while(pref)
         {
           char *pref_font = (char *)pref->data ;
-          
+
           if (g_ascii_strncasecmp(name, pref_font, strlen(pref_font)) == 0
 #if GLIB_MAJOR_VERSION >= 1 && GLIB_MINOR_VERSION >= 4
               && pango_font_family_is_monospace(families[family])
@@ -3294,7 +3295,7 @@ const char* findFixedWidthFontFamily(GtkWidget *widget, GList *pref_families)
 
               break;
             }
-          
+
           pref = g_list_next(pref);
           ++current;
         }
@@ -3310,12 +3311,12 @@ const char* findFixedWidthFontFamily(GtkWidget *widget, GList *pref_families)
     {
       g_critical("Could not find a fixed-width font. Alignments may not be displayed correctly.\n");
     }
-  
+
   return result;
 }
 
 
-/* We need a fixed-width font for displaying alignments. Find one from a 
+/* We need a fixed-width font for displaying alignments. Find one from a
  * list of possibilities. */
 const char* findFixedWidthFont(GtkWidget *widget)
 {
@@ -3339,7 +3340,7 @@ const char* findFixedWidthFont(GtkWidget *widget)
   fixed_font_list = g_list_append(fixed_font_list, (void*)"Courier");
   fixed_font_list = g_list_append(fixed_font_list, (void*)"Monospace");
   fixed_font_list = g_list_append(fixed_font_list, (void*)"fixed");
-  
+
   const char *fontFamily = findFixedWidthFontFamily(widget, fixed_font_list);
   g_list_free(fixed_font_list);
 
@@ -3379,11 +3380,11 @@ void getFontCharSize(GtkWidget *widget,
     {
       if (height)
         *height = (gdouble)(pango_font_metrics_get_ascent (metrics) + pango_font_metrics_get_descent (metrics)) / (gdouble)PANGO_SCALE;
-  
+
       if (width)
         *width = (gdouble)pango_font_metrics_get_approximate_digit_width(metrics) / (gdouble)PANGO_SCALE;
     }
-  
+
   pango_font_metrics_unref(metrics);
 }
 
@@ -3406,9 +3407,9 @@ BlxHandle handleCreate()
 gpointer handleAlloc(BlxHandle *handle, size_t numBytes)
 {
   gpointer result = g_malloc(numBytes);
-  
+
   /* prepend so that we delete data in reverse order */
-  (*handle)->memoryList = g_slist_prepend((*handle)->memoryList, result); 
+  (*handle)->memoryList = g_slist_prepend((*handle)->memoryList, result);
 
   return result;
 }
@@ -3427,11 +3428,11 @@ void handleDestroy(BlxHandle *handle)
       g_free(listItem->data);
       listItem->data = NULL;
     }
-  
+
   g_slist_free((*handle)->memoryList);
   g_free(*handle);
   *handle = NULL;
-  
+
   DEBUG_EXIT("handleDestroy returning ");
 }
 
@@ -3472,22 +3473,22 @@ GtkToolItem* addToolbarWidget(GtkToolbar *toolbar, GtkWidget *widget, const int
   GtkToolItem *toolItem = gtk_tool_item_new();
   gtk_container_add(GTK_CONTAINER(toolItem), widget);
   gtk_toolbar_insert(toolbar, toolItem, position);
-  
+
   gtk_tool_item_set_visible_horizontal(toolItem, TRUE);
   gtk_tool_item_set_visible_vertical(toolItem, TRUE);
   gtk_tool_item_set_is_important(toolItem, TRUE);
-  
+
   return toolItem;
 }
 
 
 
 /***********************************************************
- * Customisation to GtkTextView to allow pango markup.     
- * 
+ * Customisation to GtkTextView to allow pango markup.
+ *
  * Taken from https://bugzilla.gnome.org/show_bug.cgi?id=59390
  * since this code hasn't been incorporated into GTK yet...
- * 
+ *
  ***********************************************************/
 
 static void gtk_text_buffer_real_insert_markup         (GtkTextBuffer     *buffer,
@@ -3743,7 +3744,7 @@ gtk_text_buffer_set_markup (GtkTextBuffer *buffer,
  *                     Message handlers
  ***********************************************************/
 
-/* GLib doesn't have a convenience function to log a message with the 
+/* GLib doesn't have a convenience function to log a message with the
  * G_LOG_LEVEL_INFO flag, so this provides us one. In seqtools, this is usd
  * to provide task progress messages that will be sent to stderr (as opposed
  * to g_message, which is used for program output that is sent to stdout) */
@@ -3751,9 +3752,9 @@ void g_message_info(const char *formatStr, ...)
 {
   va_list argp;
   va_start(argp, formatStr);
-  
+
   g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, formatStr, argp);
-  
+
   va_end(argp);
 }
 
@@ -3762,13 +3763,13 @@ static void printMessageToConsole(const char *prefixText, const char *message, G
 {
   /* If debug is enabled, use DEBUG_OUT so that the output gets indented by
    * the same amount as other DEBUG_OUT statements. */
-  
+
 #ifdef DEBUG
-  
+
   DEBUG_OUT("%s%s", prefixText, (char*)message);
-  
+
 #else
-  
+
   /* Print messages and debug to stdout; all warnings and info messages to stderr */
   if (log_level & G_LOG_LEVEL_DEBUG || log_level & G_LOG_LEVEL_MESSAGE)
     {
@@ -3780,9 +3781,9 @@ static void printMessageToConsole(const char *prefixText, const char *message, G
       fprintf(stderr, "%s%s", prefixText, (char*)message);
       fflush(stderr);
     }
-  
+
 #endif
-  
+
 }
 
 
@@ -3790,19 +3791,19 @@ static void printMessageToConsole(const char *prefixText, const char *message, G
 void defaultMessageHandler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer data)
 {
   const char *warningText = "Warning: ";
-  
+
   const int len = strlen(warningText) + 1;
   char prefixText[len];
   prefixText[len - 1] = '\0';
-  
+
   if (log_level & G_LOG_LEVEL_WARNING)
     strcpy(prefixText, warningText);
   else
     prefixText[0] = '\0';
-  
+
   /* print to console */
   printMessageToConsole(prefixText, message, log_level);
-  
+
   /* also display the message in the status bar (unless it's debug output) */
   if (!(log_level & G_LOG_LEVEL_DEBUG))
     {
@@ -3822,14 +3823,14 @@ void popupMessageHandler(const gchar *log_domain, GLogLevelFlags log_level, cons
   const int len = max(strlen(criticalText), strlen(errorText)) + 1;
   char prefixText[len];
   prefixText[len - 1] = '\0';
-  
+
   if (log_level & G_LOG_LEVEL_ERROR)
     strcpy(prefixText, errorText);
   else if (log_level & G_LOG_LEVEL_CRITICAL)
     strcpy(prefixText, criticalText);
   else
     prefixText[0] = '\0';
-  
+
   /* print to console */
   printMessageToConsole(prefixText, message, log_level);
 
@@ -3837,16 +3838,16 @@ void popupMessageHandler(const gchar *log_domain, GLogLevelFlags log_level, cons
   GtkWindow *parent = msgData ? msgData->parent : NULL;
   GtkStatusbar *statusBar = msgData ? msgData->statusBar : NULL;
   char *titlePrefix = msgData ? msgData->titlePrefix : NULL;
-  
+
   /* also display in the status bar */
   printMessageToStatusbar(message, statusBar);
 
   /* Record each message in a list */
   GSList **messageList = getMessageList();
-  
+
   BlxMessage *blxMessage = createBlxMessage(message, log_level);
   *messageList = g_slist_append(*messageList, blxMessage);
-  
+
   /* Display as popup or in a scrolled list, whichever method is active */
   if (getUseScrolledMessages())
     {
@@ -3856,7 +3857,7 @@ void popupMessageHandler(const gchar *log_domain, GLogLevelFlags log_level, cons
     {
       displayMessageAsPopup(message, log_level, titlePrefix ? titlePrefix : "", parent, statusBar);
     }
-    
+
   /* Exit elegantly if it's a fatal error */
   if (log_level & G_LOG_LEVEL_ERROR)
     exit(EXIT_FAILURE);
@@ -3874,17 +3875,17 @@ static void printMessageToStatusbar(const gchar *message, gpointer data)
       /* Remove any newline chars */
       char *displayText = g_strdup(message);
       char *cp = strchr(displayText, '\n');
-      
+
       while (cp)
         {
           *cp = ' ';
           cp = strchr(displayText, '\n');
         }
-          
+
       guint contextId = gtk_statusbar_get_context_id(GTK_STATUSBAR(statusBar), "defaultMessages");
       gtk_statusbar_pop(GTK_STATUSBAR(statusBar), contextId);
       gtk_statusbar_push(GTK_STATUSBAR(statusBar), contextId, displayText);
-        
+
       g_free(displayText);
     }
 }
@@ -3894,38 +3895,38 @@ static void printMessageToStatusbar(const gchar *message, gpointer data)
 static void displayMessageAsPopup(const gchar *message, GLogLevelFlags log_level, const char *titlePrefix, GtkWindow *parent, GtkStatusbar *statusBar)
 {
   char *title = g_strdup_printf("%s%s", titlePrefix, "Error");
-  
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
-                                                  parent, 
+
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
+                                                  parent,
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                                   GTK_STOCK_OK,
                                                   GTK_RESPONSE_ACCEPT,
                                                   NULL);
-  
+
   g_free(title);
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-  
+
   GtkWidget *vbox = gtk_vbox_new(FALSE, 12);
   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox, TRUE, TRUE, 0);
-  
+
   GtkWidget *hbox = gtk_hbox_new(FALSE, 12);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
-  
+
   GtkWidget *image = gtk_image_new_from_stock(getDialogIcon(log_level), GTK_ICON_SIZE_DIALOG);
   gtk_box_pack_start(GTK_BOX(hbox), image, TRUE, TRUE, 0);
-  
+
   GtkWidget *label = gtk_label_new(message);
   gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
-  
+
   GtkWidget *button = gtk_check_button_new_with_mnemonic("Switch to _scrolled message window");
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), getUseScrolledMessages());
   widgetSetCallbackData(button, onSetUseScrolledMessages, NULL);
   gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 0);
-  
+
   g_signal_connect(dialog, "response", G_CALLBACK(onResponseDialog), NULL);
-  
+
   gtk_widget_show_all(vbox);
-  
+
   /* Block until the user clears the dialog */
   gtk_dialog_run(GTK_DIALOG(dialog));
 }
@@ -3940,43 +3941,43 @@ static void displayMessageAsList(GSList *messageList, const char *titlePrefix, c
   static GtkTextBuffer *textBuffer = NULL;
   static GtkTextTag *normalTag = NULL;       /* for normal text */
   static GtkTextTag *highlightTag = NULL;    /* for highlighting text */
-  
+
   if (!dialog)
     {
       char *title = g_strdup_printf("%s%s", titlePrefix, "Errors");
-      
-      dialog = gtk_dialog_new_with_buttons(title, 
-                                           NULL, 
+
+      dialog = gtk_dialog_new_with_buttons(title,
+                                           NULL,
                                            GTK_DIALOG_DESTROY_WITH_PARENT,
                                            GTK_STOCK_OK,
                                            GTK_RESPONSE_ACCEPT,
                                            NULL);
       g_free(title);
-      
+
       /* Hide the widget instead of destroying it when it is closed */
       g_signal_connect(G_OBJECT(dialog), "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
       g_signal_connect(dialog, "response", G_CALLBACK(onResponseDialog), GINT_TO_POINTER(TRUE));
-      
+
       GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
       gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox, TRUE, TRUE, 0);
-      
+
       /* Create the text view */
       int width = 600;
       int height = 180;
-      
+
       GtkWidget *child = createScrollableTextView(NULL, FALSE, NULL, TRUE, NULL, &height, &textView);
       gtk_box_pack_start(GTK_BOX(vbox), child, TRUE, TRUE, 0);
       gtk_window_set_default_size(GTK_WINDOW(dialog), width, height);
       textBuffer = gtk_text_view_get_buffer(textView);
-      
+
       /* Always show the horizontal scrollbar, otherwise it can cover the last line in the list
        * when it magically appears */
       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(child), GTK_POLICY_ALWAYS, GTK_POLICY_AUTOMATIC);
-      
+
       /* Add some tags for normal/highlighted text */
       normalTag = gtk_text_buffer_create_tag(textBuffer, NULL, "foreground", BLX_BLACK, NULL);
       highlightTag = gtk_text_buffer_create_tag(textBuffer, NULL, "foreground", BLX_RED, NULL);
-      
+
       /* Create a button to allow user to switch back to popup messages */
       button = gtk_check_button_new_with_mnemonic("Switch to _popup messages");
       widgetSetCallbackData(button, onSetUsePopupMessages, NULL);
@@ -3989,30 +3990,30 @@ static void displayMessageAsList(GSList *messageList, const char *titlePrefix, c
       GtkTextIter endIter;
       gtk_text_buffer_get_start_iter(textBuffer, &startIter);
       gtk_text_buffer_get_end_iter(textBuffer, &endIter);
-      
+
       gtk_text_buffer_delete(textBuffer, &startIter, &endIter);
     }
-  
+
   gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), !getUseScrolledMessages());
-  
+
   addMessagesToBuffer(messageList, textBuffer, normalTag, highlightTag);
-  
+
   /* Don't bring the dialog to the front if it was already open, unless specifically requested. */
   gtk_widget_show_all(dialog);
-  
+
   if (bringToFront || !GTK_WIDGET_VISIBLE(dialog))
     {
       gtk_window_present(GTK_WINDOW(dialog));
     }
-  
+
   /* Scroll to the last line in the text view. We must make sure the text view height has
    * been calculated first or gtk_text_view_scroll_to_iter might not do the correct thing. */
-  while(gtk_events_pending()) 
+  while(gtk_events_pending())
     {
       gtk_main_iteration();
     }
-  
+
   GtkTextIter textIter;
   gtk_text_buffer_get_end_iter(textBuffer, &textIter);
   gtk_text_view_scroll_to_iter(textView, &textIter, 0.0, FALSE, 0.0, 0.0);
@@ -4024,11 +4025,11 @@ static void displayMessageAsList(GSList *messageList, const char *titlePrefix, c
 static BlxMessage* createBlxMessage(const char *text, const GLogLevelFlags logLevel)
 {
   BlxMessage *blxMessage = new BlxMessage;
-  
+
   blxMessage->text = g_strdup(text);
   blxMessage->timestamp = time(NULL);
   blxMessage->logLevel = logLevel;
-  
+
   return blxMessage;
 }
 
@@ -4041,7 +4042,7 @@ static void destroyBlxMessage(BlxMessage **blxMessage)
         {
           g_free((*blxMessage)->text);
         }
-      
+
       delete *blxMessage;
     }
 }
@@ -4051,7 +4052,7 @@ static void destroyBlxMessage(BlxMessage **blxMessage)
 static GSList** getMessageList()
 {
   static GSList *messageList = NULL;
-  
+
   return &messageList;
 }
 
@@ -4060,7 +4061,7 @@ static GSList** getMessageList()
 void destroyMessageList()
 {
   GSList **messageList = getMessageList();
-  
+
   if (messageList && *messageList)
     {
       GSList *msgItem = *messageList;
@@ -4069,7 +4070,7 @@ void destroyMessageList()
           BlxMessage *blxMessage = (BlxMessage*)(msgItem->data);
           destroyBlxMessage(&blxMessage);
         }
-      
+
       g_slist_free(*messageList);
       *messageList = NULL;
     }
@@ -4087,44 +4088,44 @@ static char* blxMessageGetDisplayText(const BlxMessage *msg, const gboolean incT
     {
       *cutPoint = '\0';
     }
-  
+
   char separatorText[] = " - "; /* separates timestamp from message body */
-  
+
   char *result = (char*)g_malloc(strlen(msg->text) + strlen(separatorText) + strlen(timeText) + 1);
-  
+
   sprintf(result, "%s%s%s", timeText, separatorText, msg->text);
-  
+
   return result;
 }
 
 
 /* Add each BlxMessage in the given list to the given text buffer */
-static void addMessagesToBuffer(GSList *messageList, 
-                                GtkTextBuffer *textBuffer, 
-                                GtkTextTag *normalTag, 
+static void addMessagesToBuffer(GSList *messageList,
+                                GtkTextBuffer *textBuffer,
+                                GtkTextTag *normalTag,
                                 GtkTextTag *highlightTag)
 {
-  GSList *msgItem = messageList;  
-  
+  GSList *msgItem = messageList;
+
   for ( ; msgItem; msgItem = msgItem->next)
     {
       const BlxMessage *msg = (const BlxMessage*)(msgItem->data);
-      
+
       /* If it's the last in the list, highlight it. */
       GtkTextTag *tag = (msgItem->next == NULL ? highlightTag : normalTag);
-      
+
       char *displayText = blxMessageGetDisplayText(msg, TRUE);
-      
+
       GtkTextIter endIter;
       gtk_text_buffer_get_end_iter(textBuffer, &endIter);
       gtk_text_buffer_insert_with_tags(textBuffer, &endIter, displayText, -1, tag, NULL);
-      
+
       g_free(displayText);
     }
 }
 
 
-/* Internal function to get a pointer to the useScrolledMessages flag. Creates the flag the first 
+/* Internal function to get a pointer to the useScrolledMessages flag. Creates the flag the first
  * time it is requested.  */
 static gboolean* getUseScrolledMessagesPtr()
 {
@@ -4169,27 +4170,27 @@ static gboolean onSetUsePopupMessages(GtkWidget *button, const gint responseId,
 static const char* getDialogIcon(GLogLevelFlags log_level)
 {
   const char *result = NULL;
-  
+
   if (log_level & G_LOG_LEVEL_ERROR)
         result = GTK_STOCK_DIALOG_ERROR;
   else if (log_level & G_LOG_LEVEL_CRITICAL || log_level & G_LOG_LEVEL_WARNING)
         result = GTK_STOCK_DIALOG_WARNING;
   else
         result = GTK_STOCK_DIALOG_INFO;
-    
+
   return result;
 }
 
 
 /***********************************************************
- *                       Printing                          * 
+ *                       Printing                          *
  ***********************************************************/
 
 /* Utility to get the drawable to print for the given widget */
 static GdkDrawable* getPrintDrawable(GtkWidget *widget, const gboolean cachedOnly)
 {
   GdkDrawable *drawable = widget->window; /* draw everything by default */
-  
+
   if (cachedOnly)
     {
       if (widgetGetDrawable(widget) && (GTK_IS_LAYOUT(widget) || GTK_IS_DRAWING_AREA(widget)))
@@ -4205,7 +4206,7 @@ static GdkDrawable* getPrintDrawable(GtkWidget *widget, const gboolean cachedOnl
           gtk_container_foreach(GTK_CONTAINER(widget), collatePixmaps, widget);
         }
     }
-  
+
   return drawable;
 }
 
@@ -4216,30 +4217,30 @@ static double getPrintScale(GtkPrintContext *context, GdkDrawable *drawable, Pri
   /* Get the page size */
   double ctxWidth = gtk_print_context_get_width(context);
   double ctxHeight = gtk_print_context_get_height(context);
-  
+
   /* Get the image size */
   int imgWidth, imgHeight;
   gdk_drawable_get_size(drawable, &imgWidth, &imgHeight);
-  
+
   double scale = 1;
-  
+
   switch (scaleType)
   {
     case PRINT_FIT_WIDTH:
       scale = ctxWidth / (double)imgWidth;
       break;
-      
+
     case PRINT_FIT_HEIGHT:
       scale = ctxHeight / (double)imgHeight;
       break;
-      
+
     default:
       scale = min(ctxWidth / (double)imgWidth, ctxHeight / (double)imgHeight);
       break;
   };
-  
+
   scale = min(scale, 1.0); /* don't scale larger */
-  
+
   return scale;
 }
 
@@ -4264,34 +4265,34 @@ void onBeginPrint(GtkPrintOperation *print, GtkPrintContext *context, gpointer d
   /* Calculate the number of pages. We always scale to fit in at least one direction
    * so we should only have multiple pages in one dimension. */
   int numPages = 1;
-  
+
   switch (g_printScaleType)
   {
     case PRINT_FIT_WIDTH:
       numPages = ceil((double)imgHeight / ctxHeight);
       break;
-      
+
     case PRINT_FIT_HEIGHT:
       numPages = ceil((double)imgWidth / ctxWidth);
       break;
-      
+
     default:
       numPages = 1;
       break;
   };
-  
+
   gtk_print_operation_set_n_pages(print, numPages);
 }
 
 
-/* This function is called recursively to combine all of the drawables for 
+/* This function is called recursively to combine all of the drawables for
  * any child widgets onto a single drawable for their top-level parent widget,
  * which is passed as the user data. */
 void collatePixmaps(GtkWidget *widget, gpointer data)
 {
   GtkWidget *parent = GTK_WIDGET(data);
   GdkDrawable *drawable = widgetGetDrawable(widget);
-  
+
   /* If this widget is visible and has a drawable set, draw it onto the window's drawable */
   if (drawable && GTK_WIDGET_VISIBLE(widget))
     {
@@ -4299,12 +4300,12 @@ void collatePixmaps(GtkWidget *widget, gpointer data)
       int xSrc = 0, ySrc = 0;
       int xDest, yDest;
       gtk_widget_translate_coordinates(widget, parent, xSrc, ySrc, &xDest, &yDest);
-      
+
       GdkGC *gc = gdk_gc_new(widget->window);
       gdk_draw_drawable(widgetGetDrawable(parent), gc, drawable, xSrc, ySrc, xDest, yDest, -1, -1); /* -1 means full width/height */
       g_object_unref(gc);
     }
-  
+
   /* If this widget is a container, recurse over its children */
   if (GTK_IS_CONTAINER(widget))
     {
@@ -4320,12 +4321,12 @@ void onDrawPage(GtkPrintOperation *print, GtkPrintContext *context, gint pageNum
   cairo_t *cr = gtk_print_context_get_cairo_context(context);
 
   double scale = getPrintScale(context, drawable, g_printScaleType);
-  
+
   double ctxWidth = gtk_print_context_get_width(context);
   double ctxHeight = gtk_print_context_get_height(context);
   ctxWidth /= scale;
   ctxHeight /= scale;
-  
+
   /* Get the coords on the image at which this page starts */
   int x = 0;
   int y = 0;
@@ -4335,15 +4336,15 @@ void onDrawPage(GtkPrintOperation *print, GtkPrintContext *context, gint pageNum
     case PRINT_FIT_WIDTH:
       y = pageNum * ctxHeight;
       break;
-      
+
     case PRINT_FIT_HEIGHT:
       x = pageNum * ctxWidth;
       break;
-      
+
     default:
       break;
   };
-  
+
   /* Create a new pixmap for drawing just the section for this page */
   GdkDrawable *pagePixmap = gdk_pixmap_new(drawable, ctxWidth, ctxHeight, -1);
   GdkGC *gc = gdk_gc_new(pagePixmap);
@@ -4353,13 +4354,13 @@ void onDrawPage(GtkPrintOperation *print, GtkPrintContext *context, gint pageNum
   gdk_colormap_alloc_colors(gdk_colormap_get_system(), &bgColor, 1, TRUE, TRUE, failures);
   gdk_gc_set_foreground(gc, &bgColor);
   gdk_draw_rectangle(pagePixmap, gc, TRUE, 0, 0, ctxWidth, ctxHeight);
-  
+
   gdk_draw_drawable(pagePixmap, gc, drawable, x, y, 0, 0, ctxWidth, ctxHeight);
   g_object_unref(gc);
 
   /* Scale the image */
-  cairo_scale(cr, scale, scale); 
-  
+  cairo_scale(cr, scale, scale);
+
   /* Paint the image */
   gdk_cairo_set_source_pixmap(cr, pagePixmap, 0, 0);
   cairo_paint(cr);
@@ -4370,26 +4371,26 @@ void onDrawPage(GtkPrintOperation *print, GtkPrintContext *context, gint pageNum
  * not null, otherwise it prints the given widget (which may be null if drawable is
  * given).
  *
- * When printing a whole widget, the 'printCachedOnly' argument is an attempt to 
+ * When printing a whole widget, the 'printCachedOnly' argument is an attempt to
  * de-clutter the print by only printing stuff we request by setting a cached
- * drawable on it, i.e. so that we can exclude scrollbars etc. It works pretty well, 
+ * drawable on it, i.e. so that we can exclude scrollbars etc. It works pretty well,
  * except for the case where you want to include transient items that are not part
  * of the cached drawable in the print (such as the highlight box in blixem or the
  * crosshair in dotter). It's up to the application to set its cached drawables and
- * make sure they include everything necessary if they want to use this option, 
+ * make sure they include everything necessary if they want to use this option,
  * otherwise we just draw everything. */
-void blxPrintWidget(GtkWidget *widget, 
+void blxPrintWidget(GtkWidget *widget,
                     GdkDrawable *drawableIn,
                     GtkWindow *window,
-                    GtkPrintSettings **printSettings, 
-                    GtkPageSetup **pageSetup, 
+                    GtkPrintSettings **printSettings,
+                    GtkPageSetup **pageSetup,
                     const char *filename,
                     const gboolean printCachedOnly,
                     const PrintScaleType scaleType)
 {
   g_printCachedOnly = printCachedOnly;
   g_printScaleType = scaleType;
-  
+
   /* Use the given drawable, if any; otherwise get the drawable from the widget */
   GdkDrawable *drawable = drawableIn;
   if (!drawable && widget)
@@ -4400,13 +4401,13 @@ void blxPrintWidget(GtkWidget *widget,
   /* Create a print operation, using the same settings as the last print, if there was one */
   GtkPrintOperation *print = gtk_print_operation_new();
   GtkPrintOperationAction printAction = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
-  
+
   if (*printSettings != NULL)
     gtk_print_operation_set_print_settings(print, *printSettings);
-  
+
   if (*pageSetup)
     gtk_print_operation_set_default_page_setup(print, *pageSetup);
-  
+
   if (filename)
     {
       /* If a filename was given, export to that file (without showing the print dialog) */
@@ -4414,13 +4415,13 @@ void blxPrintWidget(GtkWidget *widget,
       gtk_print_operation_set_export_filename(print, filename);
       printAction = GTK_PRINT_OPERATION_ACTION_EXPORT;
     }
-  
+
   g_signal_connect (print, "begin_print", G_CALLBACK (onBeginPrint), drawable);
   g_signal_connect(G_OBJECT(print), "draw-page", G_CALLBACK(onDrawPage), drawable);
-  
+
   /* Pop up the print dialog */
   GtkPrintOperationResult printResult = gtk_print_operation_run (print, printAction, window, NULL);
-  
+
   /* If the user hit ok, remember the print settings for next time */
   if (printResult == GTK_PRINT_OPERATION_RESULT_APPLY)
     {
@@ -4429,10 +4430,10 @@ void blxPrintWidget(GtkWidget *widget,
           g_object_unref(*printSettings);
           *printSettings = NULL;
         }
-      
+
       *printSettings = (GtkPrintSettings*)g_object_ref(gtk_print_operation_get_print_settings(print));
     }
-  
+
   g_object_unref(print);
 }
 
@@ -4442,11 +4443,11 @@ void setWidgetBackgroundColor(GtkWidget *widget, gpointer data)
 {
   GdkColor *color = (GdkColor*)data;
   GtkWidget *window = gtk_widget_get_toplevel(widget);
-  
+
   window->style->bg[GTK_STATE_NORMAL] = *color;
   gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, color);
   gtk_widget_modify_base(widget, GTK_STATE_NORMAL, color);
-  
+
   if (GTK_IS_CONTAINER(widget))
     {
       gtk_container_foreach(GTK_CONTAINER(widget), setWidgetBackgroundColor, data);
@@ -4462,10 +4463,10 @@ void forceResize(GtkWidget *widget)
 
 
 /***********************************************************
- *                       Combo boxes                       * 
+ *                       Combo boxes                       *
  ***********************************************************/
 
-/* Callback for when the value in a 2-column combo box has changed. 
+/* Callback for when the value in a 2-column combo box has changed.
  * The value to update is an enum, a pointer to which is passed in the user
  * data.
  * This is called as a result of a response on a dialog, and the response
@@ -4474,35 +4475,35 @@ gboolean onComboChanged(GtkWidget *combo, const gint responseId, gpointer data)
 {
   int *result = (int*)data;
   GtkTreeIter iter;
-  
+
   if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter))
     {
       GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));
-      
+
       GValue val = {0};
       gtk_tree_model_get_value(model, &iter, COMBO_ENUM_COL, &val);
-      
+
       *result = g_value_get_int(&val);
     }
-  
+
   return TRUE;
 }
 
 
 /* Utility to add an item to our 2-column combo box */
 void addComboItem(GtkComboBox *combo,
-                         GtkTreeIter *parent, 
+                         GtkTreeIter *parent,
                          const int val,
                          const char *text,
                          const int initVal)
 {
   GtkTreeStore *store = GTK_TREE_STORE(gtk_combo_box_get_model(combo));
-  
+
   GtkTreeIter iter;
   gtk_tree_store_append(store, &iter, parent);
-  
+
   gtk_tree_store_set(store, &iter, COMBO_ENUM_COL, val, COMBO_TEXT_COL, text, -1);
-  
+
   if (val == initVal)
     {
       gtk_combo_box_set_active_iter(combo, &iter);
@@ -4510,7 +4511,7 @@ void addComboItem(GtkComboBox *combo,
 }
 
 
-/* Utility to create a 2-column combo box with column1 as an enum and column2 
+/* Utility to create a 2-column combo box with column1 as an enum and column2
  * as a text description */
 GtkComboBox* createComboBox()
 {
@@ -4518,48 +4519,48 @@ GtkComboBox* createComboBox()
   GtkTreeStore *store = gtk_tree_store_new(N_COMBO_COLUMNS, G_TYPE_INT, G_TYPE_STRING);
   GtkComboBox *combo = GTK_COMBO_BOX(gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)));
   g_object_unref(store);
-  
+
   /* Create a cell renderer to display the text column. */
   GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
   gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, FALSE);
   gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "text", COMBO_TEXT_COL, NULL);
-  
+
   return combo;
 }
 
 
 /***********************************************************
- *                       Files                             * 
+ *                       Files                             *
  ***********************************************************/
 
 /* Utility to ask the user for a file to save to. Returns the file name (or
- * NULL if the user cancels). The current file name, default file path, 
+ * NULL if the user cancels). The current file name, default file path,
  * default file extension and dialog title can all be specified, or passed
  * as null to use defaults. */
-const char* getSaveFileName(GtkWidget *widget, 
-                            const char *currentName,   
+const char* getSaveFileName(GtkWidget *widget,
+                            const char *currentName,
                             const char *defaultPath,
                             const char *defaultExtension,
                             const char *title)
 {
   const char *filename = NULL;
-  
+
   GtkWindow *window = widget ? GTK_WINDOW(gtk_widget_get_toplevel(widget)) : NULL;
-  
+
   GtkWidget *dialog = gtk_file_chooser_dialog_new (title ? title : "Save File",
                                                    window,
                                                    GTK_FILE_CHOOSER_ACTION_SAVE,
                                                    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                                    GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
                                                    NULL);
-  
+
   gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
-  
+
   if (defaultPath)
     {
       gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), defaultPath);
     }
-  
+
   if (currentName)
     {
       gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), currentName);
@@ -4568,13 +4569,13 @@ const char* getSaveFileName(GtkWidget *widget,
     {
       gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), defaultExtension);
     }
-  
-  
+
+
   if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
     {
       filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
     }
-  
+
   gtk_widget_destroy (dialog);
   return filename;
 }
@@ -4605,7 +4606,7 @@ static void onFileChooserFileSet(GtkFileChooserButton *button, gpointer data)
 /* Utility to ask the user for a file to load. Returns the file name (or
  * NULL if the user cancels). The default file path and dialog title can be
  * specified, or passed as null to use defaults. Result should be free'd using g_free */
-char* getLoadFileName(GtkWidget *widget, 
+char* getLoadFileName(GtkWidget *widget,
                       const char *defaultPath,
                       const char *title)
 {
@@ -4618,8 +4619,8 @@ char* getLoadFileName(GtkWidget *widget,
     defaultWidth = strlen(defaultPath);
 
   GtkWindow *window = widget ? GTK_WINDOW(gtk_widget_get_toplevel(widget)) : NULL;
-  
-  GtkWidget *dialog = gtk_dialog_new_with_buttons(title, 
+
+  GtkWidget *dialog = gtk_dialog_new_with_buttons(title,
                                                   window,
                                                   (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
                                                   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -4636,17 +4637,17 @@ char* getLoadFileName(GtkWidget *widget,
   gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
   gtk_entry_set_width_chars(GTK_ENTRY(entry), defaultWidth);
 
-  gtk_table_attach(table, gtk_label_new("File name or URL: "), 0, 1, 0, 1, GTK_FILL, GTK_SHRINK, xpad, ypad); 
-  gtk_table_attach(table, entry, 1, 2, 0, 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), GTK_SHRINK, xpad, ypad); 
+  gtk_table_attach(table, gtk_label_new("File name or URL: "), 0, 1, 0, 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
+  gtk_table_attach(table, entry, 1, 2, 0, 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), GTK_SHRINK, xpad, ypad);
 
   GtkWidget *fileChooser = gtk_file_chooser_button_new(title, GTK_FILE_CHOOSER_ACTION_OPEN);
   gtk_file_chooser_button_set_width_chars(GTK_FILE_CHOOSER_BUTTON(fileChooser), defaultWidth);
 
-  gtk_table_attach(table, gtk_label_new("Browse: "), 0, 1, 1, 2, GTK_FILL, GTK_SHRINK, xpad, ypad); 
-  gtk_table_attach(table, fileChooser, 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), GTK_SHRINK, xpad, ypad); 
-  
+  gtk_table_attach(table, gtk_label_new("Browse: "), 0, 1, 1, 2, GTK_FILL, GTK_SHRINK, xpad, ypad);
+  gtk_table_attach(table, fileChooser, 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), GTK_SHRINK, xpad, ypad);
+
   if (defaultPath)
-    gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fileChooser), defaultPath); 
+    gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fileChooser), defaultPath);
 
   /* Set callbacks so that the filechooser gets updated when the
    * entry is changed and vice versa */
@@ -4661,21 +4662,21 @@ char* getLoadFileName(GtkWidget *widget,
        * look in the entry */
       filename = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
     }
-  
+
   gtk_widget_destroy (dialog);
   return filename;
 }
 
 
 /***********************************************************
- *                       Action groups                     * 
+ *                       Action groups                     *
  ***********************************************************/
 
 /* Utility to enable/disable an item in a menu. The action name must be the value of a valid action. */
 void enableMenuAction(GtkActionGroup *action_group, const char *actionName, const gboolean enable)
 {
   GtkAction *action = gtk_action_group_get_action(action_group, actionName);
-  
+
   if (!action)
     g_warning("Error %s menu item: action '%s' not found.\n", (enable ? "enabling" : "disabling"), actionName);
   else
@@ -4683,12 +4684,12 @@ void enableMenuAction(GtkActionGroup *action_group, const char *actionName, cons
 }
 
 
-/* Utility to set the status of a toggle item in a menu. The action name must be the name 
+/* Utility to set the status of a toggle item in a menu. The action name must be the name
  * of a valid toggle action. */
 void setToggleMenuStatus(GtkActionGroup *action_group, const char *actionName, const gboolean active)
 {
   GtkAction *action = gtk_action_group_get_action(action_group, actionName);
-  
+
   if (!action)
     {
       g_warning("Error toggling menu item: action '%s' not found.\n", actionName);
@@ -4704,14 +4705,14 @@ void setToggleMenuStatus(GtkActionGroup *action_group, const char *actionName, c
 }
 
 
-/* Utility to get the status of a toggle item in a menu. The action name must be the name 
+/* Utility to get the status of a toggle item in a menu. The action name must be the name
  * of a valid toggle action. */
 gboolean getToggleMenuStatus(GtkActionGroup *action_group, const char *actionName)
 {
   gboolean result = FALSE;
 
   GtkAction *action = gtk_action_group_get_action(action_group, actionName);
-  
+
   if (!action)
     {
       g_warning("Error getting menu item: action '%s' not found.\n", actionName);
@@ -4729,12 +4730,12 @@ gboolean getToggleMenuStatus(GtkActionGroup *action_group, const char *actionNam
 }
 
 
-/* Utility to set the status of a radio button item in a menu. The action name must be the name 
+/* Utility to set the status of a radio button item in a menu. The action name must be the name
  * of a valid toggle action. */
 void setRadioMenuStatus(GtkActionGroup *action_group, const char *actionName, const gint value)
 {
   GtkAction *action = gtk_action_group_get_action(action_group, actionName);
-  
+
   if (!action)
     {
       g_warning("Error toggling menu item: action '%s' not found.\n", actionName);
@@ -4750,7 +4751,7 @@ void setRadioMenuStatus(GtkActionGroup *action_group, const char *actionName, co
 }
 
 /***********************************************************
- *                       External calls                    * 
+ *                       External calls                    *
  ***********************************************************/
 
 /* call an external shell command and print output in a text_scroll window
@@ -4759,7 +4760,7 @@ void setRadioMenuStatus(GtkActionGroup *action_group, const char *actionName, co
  * that it uses gtk directly and provides cut/paste/scrolling but...it has the
  * disadvantage that it will use more memory as it collects all the output into
  * one string and then this is _copied_ into the text widget.
- * 
+ *
  * If this proves to be a problem I expect there is a way to feed the text to the
  * text widget a line a time. */
 GtkWidget* externalCommand (const char *command, const char *progName, GtkWidget *widget, GError **error)
@@ -4767,26 +4768,26 @@ GtkWidget* externalCommand (const char *command, const char *progName, GtkWidget
   GtkWidget *resultWindow = NULL;
 
 #if !defined(MACINTOSH)
-  
+
   GString *result = getExternalCommandOutput(command, error);
-  
+
   if (!error || *error == NULL)
     {
       char *title = g_strdup_printf("%s - %s", progName, command);
       resultWindow = displayFetchResults(title, result->str, widget, NULL, NULL);
-      
+
       g_free(title);
       g_string_free(result, TRUE);
     }
-  
+
 
 #endif
-  
+
   return resultWindow;
 }
 
 
-/* Execute the given external command and return the output from the 
+/* Execute the given external command and return the output from the
  * command.
  * The result should be free'd with g_string_free. */
 GString* getExternalCommandOutput(const char *command, GError **error)
@@ -4806,7 +4807,7 @@ GString* getExternalCommandOutput(const char *command, GError **error)
 
   if (!ok || tmpError)
     {
-      g_set_error(error, SEQTOOLS_ERROR, SEQTOOLS_ERROR_EXECUTING_CMD, "Error executing command: %s\n\n%s", 
+      g_set_error(error, SEQTOOLS_ERROR, SEQTOOLS_ERROR_EXECUTING_CMD, "Error executing command: %s\n\n%s",
                   command, (tmpError ? tmpError->message : "<no error message>"));
     }
   else
@@ -4827,18 +4828,18 @@ GString* getExternalCommandOutput(const char *command, GError **error)
 /* Display a message dialog showing the given display text. This
  * utility function sets things like the font and default width
  * based on properties of the main blixem window. Returns a pointer
- * to the dialog, and optionally sets a pointer to the text buffer 
+ * to the dialog, and optionally sets a pointer to the text buffer
  * in the textBuffer return argument.
  * If the given dialog and text_buffer already contain values
  * then those are updated rather than creating a new dialog */
-GtkWidget* displayFetchResults(const char *title, 
-                               const char *displayText, 
-                               GtkWidget *widget, 
+GtkWidget* displayFetchResults(const char *title,
+                               const char *displayText,
+                               GtkWidget *widget,
                                GtkWidget *dialog,
                                GtkTextBuffer **text_buffer)
 {
   GtkWidget *result = NULL;
-  
+
   if (dialog && text_buffer && *text_buffer)
     {
       /* Just update the existing dialog and return that */
@@ -4853,19 +4854,19 @@ GtkWidget* displayFetchResults(const char *title,
       /* Use a fixed-width font */
       const char *fontFamily = findFixedWidthFont(widget);
       PangoFontDescription *fontDesc = pango_font_description_from_string(fontFamily);
-      
+
       int maxWidth = 300, maxHeight = 200;
       gbtools::GUIGetTrueMonitorSizeFraction(widget, DEFAULT_PFETCH_WINDOW_WIDTH_FRACTION, DEFAULT_PFETCH_WINDOW_HEIGHT_FRACTION, &maxWidth, &maxHeight);
-      
+
       GtkTextView *textView = NULL;
       result = showMessageDialog(title, displayText, NULL, maxWidth, maxHeight, FALSE, FALSE, fontDesc, &textView);
-      
+
       if (text_buffer && textView)
         {
           *text_buffer = gtk_text_view_get_buffer(textView);
         }
     }
-  
+
   return result;
 }
 
@@ -4874,29 +4875,29 @@ GtkWidget* displayFetchResults(const char *title,
 int scrollBarWidth()
 {
   static int result = UNSET_INT;
-  
+
   if (result == UNSET_INT)
     {
       /* Create a temp scrollbar and find the default width from the style properties. */
       GtkWidget *scrollbar = gtk_vscrollbar_new(NULL);
-      
+
       gint sliderWidth = 0, separatorWidth = 0, troughBorder = 0, stepperSpacing = 0;
       gtk_widget_style_get(scrollbar, "slider-width", &sliderWidth, NULL);
       gtk_widget_style_get(scrollbar, "separator-width", &separatorWidth, NULL);
       gtk_widget_style_get(scrollbar, "trough-border", &troughBorder, NULL);
       gtk_widget_style_get(scrollbar, "stepper-spacing", &stepperSpacing, NULL);
-      
+
       gtk_widget_destroy(scrollbar);
-      
+
       result = sliderWidth + separatorWidth*2 + troughBorder*2 + stepperSpacing*2 + 4; /* to do: find out why the extra fudge factor is needed here */
     }
-  
+
   return result;
 }
 
 
 /* Utility to get the width and height of the given text as a pango layout
- * on the given widget. Either width or height may be null if not required. 
+ * on the given widget. Either width or height may be null if not required.
  * The results are in pixels. */
 void getTextSize(GtkWidget *widget, const char *text, int *width, int *height)
 {
@@ -4905,7 +4906,7 @@ void getTextSize(GtkWidget *widget, const char *text, int *width, int *height)
       PangoLayout *layout = gtk_widget_create_pango_layout(widget, text);
       pango_layout_get_size(layout, width, height);
       g_object_unref(layout);
-      
+
       if (width)
         *width /= PANGO_SCALE;
 
@@ -4936,12 +4937,12 @@ int getTextHeight(GtkWidget *widget, const char *text)
 
 
 /* Create a text entry box initialised with the given integer. Adds the entry
- * to the given table. Optionally adds a label with the given mnemonic; if 
+ * to the given table. Optionally adds a label with the given mnemonic; if
  * a label is included it will be drawn at the column before the given 'col'
  * Optionally also sets a callback which will be called on the dialog response
  * (if it uses the standard onResponseDialog function or similar). */
 GtkWidget* createTextEntryFromInt(GtkWidget *widget,
-                                  GtkTable *table, 
+                                  GtkTable *table,
                                   const int row,
                                   const int col,
                                   const int xpad,
@@ -4956,26 +4957,26 @@ GtkWidget* createTextEntryFromInt(GtkWidget *widget,
       gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
       gtk_table_attach(table, label, col - 1, col, row, row + 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
     }
-  
+
   GtkWidget *entry = gtk_entry_new();
   gtk_table_attach(table, entry, col, col + 1, row, row + 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
-  
+
   char *displayText = convertIntToString(value);
   gtk_entry_set_text(GTK_ENTRY(entry), displayText);
   gtk_entry_set_width_chars(GTK_ENTRY(entry), strlen(displayText) + 3);
-  
+
   gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-  
+
   if (callback)
     widgetSetCallbackData(entry, callback, widget);
-  
+
   return entry;
 }
 
 
 /* Similar to createTextEntryFromInt, but for doubles */
 GtkWidget* createTextEntryFromDouble(GtkWidget *widget,
-                                     GtkTable *table, 
+                                     GtkTable *table,
                                      const int row,
                                      const int col,
                                      const int xpad,
@@ -4990,22 +4991,22 @@ GtkWidget* createTextEntryFromDouble(GtkWidget *widget,
       gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
       gtk_table_attach(table, label, col - 1, col, row, row + 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
     }
-  
+
   GtkWidget *entry = gtk_entry_new();
   gtk_table_attach(table, entry, col, col + 1, row, row + 1, GTK_FILL, GTK_SHRINK, xpad, ypad);
-  
+
   /* Only display decimal places if not a whole number */
   const int numDp = value - (int)value > 0 ? 1 : 0;
-  
+
   char *displayText = convertDoubleToString(value, numDp);
   gtk_entry_set_text(GTK_ENTRY(entry), displayText);
   gtk_entry_set_width_chars(GTK_ENTRY(entry), strlen(displayText) + 3);
-  
+
   gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
-  
+
   if (callback)
     widgetSetCallbackData(entry, callback, widget);
-  
+
   return entry;
 }
 
@@ -5063,10 +5064,10 @@ GtkRadioButton* createRadioButton(GtkTable *table,
 
   GtkBox *box = GTK_BOX(gtk_vbox_new(FALSE, 0));
 
-  gtk_table_attach(table, GTK_WIDGET(box), 
-                   col, col + 1, row, row + 1, 
-                   (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 
-                   (GtkAttachOptions)((multiline ? GTK_EXPAND | GTK_FILL : GTK_SHRINK)), 
+  gtk_table_attach(table, GTK_WIDGET(box),
+                   col, col + 1, row, row + 1,
+                   (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
+                   (GtkAttachOptions)((multiline ? GTK_EXPAND | GTK_FILL : GTK_SHRINK)),
                    TABLE_XPAD, TABLE_YPAD);
 
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), isActive);
@@ -5152,19 +5153,19 @@ void widgetSetFontSize(GtkWidget *widget, gpointer data)
 {
   if (!widget)
     return;
-  
+
   int newSize = GPOINTER_TO_INT(data);
-  
+
   pango_font_description_set_size(widget->style->font_desc, newSize * PANGO_SCALE);
   gtk_widget_modify_font(widget, widget->style->font_desc);
-  
+
   if (GTK_IS_CONTAINER(widget))
     gtk_container_foreach(GTK_CONTAINER(widget), widgetSetFontSize, data);
 }
 
 
 /* Utility to set the font size of the given widget to the given size (in
- * points) and check that the new size is within sensible limits; otherwise 
+ * points) and check that the new size is within sensible limits; otherwise
  * does nothing. */
 void widgetSetFontSizeAndCheck(GtkWidget *belvuAlignment, const int newSize)
 {
@@ -5176,13 +5177,13 @@ void widgetSetFontSizeAndCheck(GtkWidget *belvuAlignment, const int newSize)
 
 
 /***********************************************************
- *                          Scale                          * 
+ *                          Scale                          *
  ***********************************************************/
 
 /* Utility to draw a horizontal scale. Currently limited to draw a minor
  * tickmark at every value in the given range. (Could be improved to allow
  * minor tickmarks at larger intervals.) */
-void drawHScale(GtkWidget *widget, 
+void drawHScale(GtkWidget *widget,
                 GdkDrawable *drawable,
                 const IntRange* const range, /* the range of values to draw */
                 const GdkRectangle* const rect, /* the drawing area */
@@ -5193,12 +5194,12 @@ void drawHScale(GtkWidget *widget,
                 const int majorTickHeight)
 {
   GdkGC *gc = gdk_gc_new(drawable);
-  
+
   int y = rect->y;
   const int yBottom = y + rect->height;            /* bottom pos of tickmarks */
   const int yTopMajor = yBottom - majorTickHeight; /* top position of major tickmarks */
   const int yTopMinor = yBottom - minorTickHeight; /* top position of major tickmarks */
-  
+
   int x = rect->x + widthPerVal / 2;
   int tickmarkVal = range->min();
 
@@ -5206,36 +5207,36 @@ void drawHScale(GtkWidget *widget,
     {
       const gboolean major = (tickmarkVal % majorTickInterval == 0);
       const gboolean drawLabel = (tickmarkVal % labelInterval == 0);
-      
+
       /* Draw the tick mark */
       const int yTop = (major ? yTopMajor : yTopMinor);
       gdk_draw_line(drawable, gc, x, yTop, x, yBottom);
-      
+
       if (drawLabel)
         {
           char *tmpStr = g_strdup_printf("%d", tickmarkVal);
           PangoLayout *layout = gtk_widget_create_pango_layout(widget, tmpStr);
           g_free(tmpStr);
-          
+
           /* Centre the text on the tick-mark position */
           int width;
           pango_layout_get_pixel_size(layout, &width, NULL);
-          
+
           gdk_draw_layout(drawable, gc, x - width / 2, y, layout);
           g_object_unref(layout);
         }
     }
-  
+
   /* Draw a horizontal separator line */
   y = yBottom - 1;
   x = 0;
   gdk_draw_line(drawable, gc, x, y, x + rect->width, y);
-  
+
   g_object_unref(gc);
 }
 
 
-/* Get the temp directory. Some systems seem to have a trailing slash, 
+/* Get the temp directory. Some systems seem to have a trailing slash,
  * some not, so if it has one then remove it... */
 const char *getSystemTempDir()
 {
@@ -5244,7 +5245,7 @@ const char *getSystemTempDir()
   if (!tmpDir)
     {
       tmpDir = g_strdup(g_get_tmp_dir());
-      
+
       if (tmpDir[strlen(tmpDir) - 1] == '/')
         tmpDir[strlen(tmpDir) - 1] = '\0';
     }
@@ -5254,10 +5255,10 @@ const char *getSystemTempDir()
 
 
 /***********************************************************
- *                       Error handling                    * 
+ *                       Error handling                    *
  ***********************************************************/
 
-void errorHandler(const int sig) 
+void errorHandler(const int sig)
 {
   fprintf(stderr, "Error: signal %d:\n", sig);
   fflush(stderr);
@@ -5276,5 +5277,3 @@ void errorHandler(const int sig)
 
   exit(EXIT_FAILURE);
 }
-
-
diff --git a/src/seqtoolsUtils/utilities.hpp b/src/seqtoolsUtils/utilities.hpp
index b976d97a0732d61fc066db3517f947c6f15e8cb9..d5efe236b7cce521cf653b99182cdd93ec0f45f5 100644
--- a/src/seqtoolsUtils/utilities.hpp
+++ b/src/seqtoolsUtils/utilities.hpp
@@ -1,5 +1,6 @@
 /*  File: utilities.h
  *  Author: Gemma Barson, 2010-01-05
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -31,7 +32,7 @@
  * Description: Utility functions for the SeqTools package.
  *----------------------------------------------------------------------------
  */
- 
+
 #ifndef _utilities_h_included_
 #define _utilities_h_included_
 
@@ -141,7 +142,7 @@ typedef enum
 #define BLX_DARK_GREY         "#929292"
 #define BLX_VERY_DARK_GREY    "#5f5f5f"
 
-#define BLX_YELLOW            "#ffff00" 
+#define BLX_YELLOW            "#ffff00"
 #define BLX_DARK_YELLOW       "#d0d000"
 #define BLX_PALE_YELLOW       "#ffffcc"
 
@@ -172,7 +173,7 @@ typedef enum
 #define BLX_CERISE            "#DE3163"
 
 #define BLX_GREEN             "#00ff00"
-#define BLX_LIGHT_GREEN       "#C1FFC1" 
+#define BLX_LIGHT_GREEN       "#C1FFC1"
 #define BLX_LAWN_GREEN        "#7cfc00"
 #define BLX_DARK_GREEN        "#00bb00"
 #define BLX_VERY_DARK_GREEN   "#015800"
@@ -187,7 +188,7 @@ typedef struct _BlxColor
     gboolean transparent;         /* If this is true, the colors are not specified and the
                                    * background color should be used instead. */
 
-    /* If the overridden flags are true, transparency has been overridden and the 
+    /* If the overridden flags are true, transparency has been overridden and the
      * colors ARE set but should only be used where transparency is
      * not allowed. */
     gboolean normal_overridden;
@@ -200,16 +201,16 @@ typedef struct _BlxColor
     GdkColor print;               /* the color used for printing */
     GdkColor printSelected;       /* the selected-state color used for printing */
   } BlxColor;
-  
-  
-/* This handle holds a list of pointers to all memory allocated via this handle. 
+
+
+/* This handle holds a list of pointers to all memory allocated via this handle.
  * Use handleDestroy to free the handle and all its allocated memory. */
 typedef struct _BlxHandle
   {
     GSList *memoryList;
   } BlxHandleStruct, *BlxHandle;
-  
-  
+
+
 /* This struct is used to pass user data to the message handlers */
 typedef struct _BlxMessageData
 {
@@ -217,8 +218,8 @@ typedef struct _BlxMessageData
   GtkWindow *parent;
   GtkStatusbar *statusBar;
 } BlxMessageData;
-  
-  
+
+
 /* Define a drawing style for an MSP */
 typedef struct _BlxStyle
   {
@@ -273,35 +274,35 @@ typedef struct _DoubleRange
     gdouble min;
     gdouble max;
   } DoubleRange ;
-  
+
 
 /* Fundamental strand direction. */
 typedef enum
   {
-    BLXSTRAND_NONE, 
-    BLXSTRAND_FORWARD, 
+    BLXSTRAND_NONE,
+    BLXSTRAND_FORWARD,
     BLXSTRAND_REVERSE
   } BlxStrand ;
-  
+
 /* Fundamental type of sequence (DNA really means nucleotide, because it could be RNA as well). */
 typedef enum
   {
-    BLXSEQ_NONE, 
-    BLXSEQ_DNA, 
+    BLXSEQ_NONE,
+    BLXSEQ_DNA,
     BLXSEQ_PEPTIDE
   } BlxSeqType ;
 
 /* Fundamental blast mode used */
 typedef enum
   {
-    BLXMODE_UNSET, 
-    BLXMODE_BLASTX, 
-    BLXMODE_TBLASTX, 
-    BLXMODE_BLASTN, 
-    BLXMODE_TBLASTN, 
+    BLXMODE_UNSET,
+    BLXMODE_BLASTX,
+    BLXMODE_TBLASTX,
+    BLXMODE_BLASTN,
+    BLXMODE_TBLASTN,
     BLXMODE_BLASTP
   } BlxBlastMode ;
-  
+
 
 /* Function pointer for callback functions used by widgets on dialog boxes. */
 typedef gboolean (*BlxResponseCallback)(GtkWidget *widget, const gint responseId, gpointer data);
@@ -318,7 +319,7 @@ typedef struct _CallbackData
  * to the default types specified by GtkResponseType */
 typedef enum
   {
-    BLX_RESPONSE_FORWARD, 
+    BLX_RESPONSE_FORWARD,
     BLX_RESPONSE_BACK,
     BLX_RESPONSE_RESET,
     BLX_RESPONSE_CLEAR
@@ -330,13 +331,13 @@ class CoordRange
 {
 public:
   CoordRange() : qStart(0), qEnd(0), sStart(0), sEnd(0) {};
-  
+
   int qStart;     /* start coord on the reference (Query) seq */
   int qEnd;       /* end coord on the reference (Query) seq */
   int sStart;     /* start coord on the match (Subject) seq */
   int sEnd;       /* end coord on the match (Subject) seq */
 };
-  
+
 
 /* Used to specify the degree of colinearity between two alignment blocks. */
 typedef enum
@@ -405,25 +406,25 @@ void                  boundsLimitValue(int *value, const IntRange* const range);
 gboolean              pointInRect(const int x, const int y, const GdkRectangle* const rect);
 char                  convertBaseToCorrectCase(const char charToConvert, const BlxSeqType seqType);
 
-void                  convertDisplayRangeToDnaRange(const IntRange* const displayRange, 
+void                  convertDisplayRangeToDnaRange(const IntRange* const displayRange,
                                                     const BlxSeqType displaySeqType,
                                                     const int numFrames,
                                                     const gboolean displayRev,
                                                     const IntRange* const refSeqRange,
                                                     IntRange *result);
 
-int                   convertDisplayIdxToDnaIdx(const int inputIdx, 
+int                   convertDisplayIdxToDnaIdx(const int inputIdx,
                                                 const BlxSeqType inputIdxType,
-                                                const int frame, 
-                                                const int baseNum, 
+                                                const int frame,
+                                                const int baseNum,
                                                 const int numFrames,
                                                 const gboolean displayRev,
                                                 const IntRange* const dnaIdxRange);
 
-int                   convertDnaIdxToDisplayIdx(const int dnaIdx, 
+int                   convertDnaIdxToDisplayIdx(const int dnaIdx,
                                                 const BlxSeqType displaySeqType,
                                                 const int frame,
-                                                const int numFrames, 
+                                                const int numFrames,
                                                 const gboolean displayRev,
                                                 const IntRange* const dnaIdxRange,
                                                 int *baseNum);
@@ -435,23 +436,23 @@ int                   roundToValue(const int inputVal, const int roundTo);
 int                   roundToValueFromList(const int inputVal, GSList *roundValues, int *roundedTo);
 int                   roundUpToValueFromList(const int inputVal, GSList *roundValues, int *roundedTo);
 
-char                  getSequenceIndex(char *seq, 
-                                       const int qIdx, 
-                                       const gboolean complement, 
+char                  getSequenceIndex(char *seq,
+                                       const int qIdx,
+                                       const gboolean complement,
                                        const IntRange* const seqRange,
                                        const BlxSeqType seqType);
 
-int                   getStartDnaCoord(const IntRange* const displayRange, 
+int                   getStartDnaCoord(const IntRange* const displayRange,
                                        const int frame,
-                                       const BlxSeqType displaySeqType, 
-                                       const gboolean displayRev, 
+                                       const BlxSeqType displaySeqType,
+                                       const gboolean displayRev,
                                        const int numFrames,
                                        const IntRange* const refSeqRange);
 
-int                   getEndDnaCoord(const IntRange* const displayRange, 
+int                   getEndDnaCoord(const IntRange* const displayRange,
                                      const int frame,
-                                     const BlxSeqType displaySeqType, 
-                                     const gboolean displayRev, 
+                                     const BlxSeqType displaySeqType,
+                                     const gboolean displayRev,
                                      const int numFrames,
                                      const IntRange* const refSeqRange);
 
@@ -474,7 +475,7 @@ void                  popupMessageHandler(const gchar *log_domain, GLogLevelFlag
 void                  defaultMessageHandler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer data);
 void                  g_message_info(const char *formatStr, ...);
 
-GtkWidget*            showMessageDialog(const char *title,  
+GtkWidget*            showMessageDialog(const char *title,
                                         const char *messageText,
                                         GtkWidget *parent,
                                         const int initWidth,
@@ -493,7 +494,7 @@ GtkWidget*              createScrollableTextView(const char *messageText,
                                                  int *width,
                                                  int *height,
                                                  GtkTextView **textViewOut);
-                                    
+
 void                  widgetSetCallbackData(GtkWidget *widget, BlxResponseCallback callbackFunc, gpointer callbackData);
 gboolean              widgetCallAllCallbacks(GtkWidget *widget, gpointer data);
 void                  onResponseDialog(GtkDialog *dialog, gint responseId, gpointer data);
@@ -509,8 +510,8 @@ void                  requestDefaultClipboardText(GtkClipboardTextReceivedFunc c
 
 int                   parseMatchLine(const char *inputText,
                                      char **matchNameOut,
-                                     int *matchStartOut, 
-                                     int *matchEndOut, 
+                                     int *matchStartOut,
+                                     int *matchEndOut,
                                      int *matchLenOut);
 
 GList*                parseMatchList(const char *inputText);
@@ -545,18 +546,18 @@ gboolean              colorsEqual(GdkColor *color1, GdkColor *color2);
 
 void                  createBlxColor(GArray *defaultColors,
                                      int colorId,
-                                     const char *name, 
-                                     const char *desc, 
-                                     const char *normalCol, 
+                                     const char *name,
+                                     const char *desc,
+                                     const char *normalCol,
                                      const char *printCol,
                                      const char *normalColSelected,
                                      const char *printColSelected);
 
-gdouble               pixelsPerBase(const gint displayWidth, 
+gdouble               pixelsPerBase(const gint displayWidth,
                                     const IntRange* const displayRange);
 
-gdouble               convertBaseIdxToRectPos(const gint dnaIdx, 
-                                              const GdkRectangle* const rect, 
+gdouble               convertBaseIdxToRectPos(const gint dnaIdx,
+                                              const GdkRectangle* const rect,
                                               const IntRange* const dnaDispRange,
                                               const gboolean horizontal,
                                               const gboolean displayRev,
@@ -615,7 +616,7 @@ int                                getTextWidth(GtkWidget *widget, const char *t
 int                                getTextHeight(GtkWidget *widget, const char *text);
 
 GtkWidget*                         createTextEntryFromInt(GtkWidget *widget,
-                                                          GtkTable *table, 
+                                                          GtkTable *table,
                                                           const int row,
                                                           const int col,
                                                           const int xpad,
@@ -625,7 +626,7 @@ GtkWidget*                         createTextEntryFromInt(GtkWidget *widget,
                                                           BlxResponseCallback callback);
 
 GtkWidget*                         createTextEntryFromDouble(GtkWidget *widget,
-                                                             GtkTable *table, 
+                                                             GtkTable *table,
                                                              const int row,
                                                              const int col,
                                                              const int xpad,
@@ -634,13 +635,13 @@ GtkWidget*                         createTextEntryFromDouble(GtkWidget *widget,
                                                              const double value,
                                                              BlxResponseCallback callback);
 
-void                               drawHScale(GtkWidget *widget, 
+void                               drawHScale(GtkWidget *widget,
                                               GdkDrawable *drawable,
                                               const IntRange* const range,
                                               const GdkRectangle* const rect,
-                                              const int widthPerVal,       
-                                              const int majorTickInterval, 
-                                              const int labelInterval,     
+                                              const int widthPerVal,
+                                              const int majorTickInterval,
+                                              const int labelInterval,
                                               const int minorTickHeight,
                                               const int majorTickHeight);
 
@@ -660,9 +661,9 @@ GtkRadioButton*                    createRadioButton(GtkTable *table,
                                                      GtkWidget *blxWindow,
                                                      GSList **entryList);
 
-const char*                        getSystemTempDir();     
+const char*                        getSystemTempDir();
 
-void                               errorHandler(const int sig); 
+void                               errorHandler(const int sig);
 
 /* seqtoolsWebBrowser.c */
 gboolean                           seqtoolsLaunchWebBrowser(const char *link, GError **error);
@@ -670,7 +671,7 @@ gboolean                           seqtoolsLaunchWebBrowser(const char *link, GE
 
 /* translate.c */
 char*                              blxTranslate(const char *seq, char **code);
-void                               blxComplement(char *seq) ;    
+void                               blxComplement(char *seq) ;
 char*                              revComplement(char *comp, char *seq) ;
 char                               complementChar(const char inputChar, GError **error);
 
diff --git a/src/seqtoolsUtils/version.hpp b/src/seqtoolsUtils/version.hpp
index 4ca4273889d75adff72f1caec3d133fac0d0507c..c15a6b88f174f5bd9817ceb5ba60315a2e2f2684 100644
--- a/src/seqtoolsUtils/version.hpp
+++ b/src/seqtoolsUtils/version.hpp
@@ -1,5 +1,6 @@
 /*  File: version.h
  *  Author: Ed Griffiths
+ *  Copyright [2018] EMBL-European Bioinformatics Institute
  *  Copyright (c) 2006-2017 Genome Research Ltd
  * ---------------------------------------------------------------------------
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ---------------------------------------------------------------------------
- * This file is part of the SeqTools sequence analysis package, 
+ * This file is part of the SeqTools sequence analysis package,
  * written by
  *      Gemma Barson      (Sanger Institute, UK)  <gb10@sanger.ac.uk>
- * 
+ *
  * based on original code by
  *      Erik Sonnhammer   (SBC, Sweden)           <Erik.Sonnhammer@sbc.su.se>
- * 
+ *
  * and utilizing code taken from the AceDB and ZMap packages, written by
  *      Richard Durbin    (Sanger Institute, UK)  <rd@sanger.ac.uk>
  *      Jean Thierry-Mieg (CRBM du CNRS, France)  <mieg@kaa.crbm.cnrs-mop.fr>
@@ -76,15 +77,15 @@ char *utAppGetCompileDate(void) { return UT_COMPILE_PHRASE " " __DATE__ " " __TI
 /*                                                                           */
 
 
-/*  Use UT_MAKESTRING to make strings out of #define'd numbers.          
- *  (required because of the way ANSI preprocessor handles strings)      
- *  e.g. UT_MAKESTRING(6)  produces "6"                                 */   
+/*  Use UT_MAKESTRING to make strings out of #define'd numbers.
+ *  (required because of the way ANSI preprocessor handles strings)
+ *  e.g. UT_MAKESTRING(6)  produces "6"                                 */
 #define UT_PUTSTRING(x) #x
 #define UT_MAKESTRING(x) UT_PUTSTRING(x)
 
 
 /* Make a single version number out of a version, release and update number.
- * NOTE that there should be no more than 100 (i.e. 0 - 99) revisions per    
+ * NOTE that there should be no more than 100 (i.e. 0 - 99) revisions per
  * version, or updates per revision, otherwise version will be wrong. */
 #define UT_MAKE_VERSION_NUMBER(VERSION, RELEASE, UPDATE) \
 ((VERSION * 10000) + (RELEASE * 100) + UPDATE)
@@ -132,24 +133,24 @@ TITLE" is distributed under the GNU Public License; see http://www.gnu.org/copyl
 
 #define AUTHOR_TEXT        "Gemma Barson <gb10@sanger.ac.uk>\n"\
                            "Erik Sonnhammer <Erik.Sonnhammer@sbc.su.se>"
-                           
+
 #define AUTHOR_TEXT_FULL   " Written by Gemma Barson <gb10@sanger.ac.uk>\n"\
                            " Based on original code by Erik Sonnhammer <Erik.Sonnhammer@sbc.su.se>"
-                           
-
-
-/*    Macro for creating a standard copyright string to be inserted into     
- *    compiled applications and libraries. The macro ensures a common        
- *    format for version numbers etc.                                        
- *                                                                           
- * The macro is a statement, NOT an expression, but does NOT require a       
- * terminating semi-colon. The macro should be coded like this:              
- *                                                                           
- *    UT_COPYRIGHT_STRING(prefix, title, description, copyright_years)       
- *                                                                           
- *    where  prefix is some a string locally used to prefix variables        
- *    where  title is a string of the form   "Appname  1.0.1"                
- *    where  description is of the form  "Application to blah, blah."        
+
+
+
+/*    Macro for creating a standard copyright string to be inserted into
+ *    compiled applications and libraries. The macro ensures a common
+ *    format for version numbers etc.
+ *
+ * The macro is a statement, NOT an expression, but does NOT require a
+ * terminating semi-colon. The macro should be coded like this:
+ *
+ *    UT_COPYRIGHT_STRING(prefix, title, description, copyright_years)
+ *
+ *    where  prefix is some a string locally used to prefix variables
+ *    where  title is a string of the form   "Appname  1.0.1"
+ *    where  description is of the form  "Application to blah, blah."
  *    and    copyright_years is of the form  "2010", "2008-2010", "2008, 2010" etc.
  */
 #define UT_COPYRIGHT(YEARS_STRING)                                                   \