8df9be971382f605d3efc4df65ad1d794f95c4e4
braney
  Mon Jun 29 15:53:25 2015 -0700
fix some problems in the mafGene library where exons that had
non-contiguous maf blocks within them weren't be dealt with properly

diff --git src/hg/lib/mafGene.c src/hg/lib/mafGene.c
index e231560..7c2383e 100644
--- src/hg/lib/mafGene.c
+++ src/hg/lib/mafGene.c
@@ -145,33 +145,44 @@
     char *chrom, int start, int end)
 {
 if (list == NULL)
     {
     struct mafAli *ali = getRefAli(database, chrom, start, end);
     return ali;
     }
 
 int aliStart = list->components->start;
 if (start != aliStart)
     {
     struct mafAli *ali = getRefAli(database, chrom, start, aliStart);
     slAddHead(&list, ali);
     }
 
-struct mafAli *last = list;
+struct mafAli *next, *last = list;
 for(; last->next; last = last->next)
-    ;
+    {
+    next=last->next;
+    int aliEnd = last->components->start + last->components->size;
+    int nextStart = next->components->start ;
+
+    if (aliEnd != nextStart)
+	{
+	struct mafAli *ali = getRefAli(database, chrom, aliEnd, nextStart);
+	ali->next = next;
+	last->next = ali;
+	}
+    }
 
 int aliEnd = last->components->start + last->components->size;
 if (end != aliEnd)
     {
     struct mafAli *ali = getRefAli(database, chrom, aliEnd, end);
     slAddTail(&list, ali);
     }
 
 return list;
 }
 
 static struct mafAli *getAliForRange(char *database, char *mafTable, 
     char *chrom, int start, int end)
 {
 struct sqlConnection *conn = hAllocConn(database);