5a7542dced0497f6d08a503a95eba87619b23a8a
markd
  Wed Mar 5 19:35:34 2014 -0800
Fixed bug in GTF to genePred conversion where an assertion was triggered when theGTF had a spliced stop codon where the exon containing the first part of the
stop codon only consisted of the stop codon bases.  For example, a two-base exon where
with two bases are the first two bases of the stop codon.

diff --git src/hg/lib/genePred.c src/hg/lib/genePred.c
index b09de40..45a3828 100644
--- src/hg/lib/genePred.c
+++ src/hg/lib/genePred.c
@@ -535,31 +535,32 @@
 for (; (iExon != iStop) && (gp->exonFrames[iExon] != -1); iExon += dir)
     iPrevExon = iExon;
 if (iPrevExon < 0)
     errAbort("bug: findLastFramedExon should have found an exon with frame");
 return iPrevExon;
 }
 
 static void extendFramePos(struct genePred *gp)
 /* extend frame missing from last exon(s) for positive strand genes, normally
  * caused by GTF stop_codon */
 {
 int iExon = findLastFramedExon(gp);
 int frame = incrFrame(gp->exonFrames[iExon], (gp->exonEnds[iExon]-gp->exonStarts[iExon]));
 for (iExon++; (iExon < gp->exonCount) && (gp->exonStarts[iExon] < gp->cdsEnd); iExon++)
     {
-    assert(gp->exonFrames[iExon] < 0);
+    if (!((gp->exonFrames[iExon] < 0) || (gp->exonFrames[iExon] == frame)))
+        errAbort("conflicting frame for %s exon index %d, was %d, trying to assign %d", gp->name, iExon, gp->exonFrames[iExon], frame);
     gp->exonFrames[iExon] = frame;
     frame = incrFrame(gp->exonFrames[iExon], (gp->exonEnds[iExon]-gp->exonStarts[iExon]));
     }
 }
 
 static void extendFrameNeg(struct genePred *gp)
 /* extend frame missing from last exon(s) for negative strand genes, normally
  * caused by GTF stop_codon */
 {
 int iExon = findLastFramedExon(gp);
 int frame = incrFrame(gp->exonFrames[iExon], (gp->exonEnds[iExon]-gp->exonStarts[iExon]));
 for (iExon--; (iExon >= 0) && (gp->exonEnds[iExon] > gp->cdsStart); iExon--)
     {
     assert(gp->exonFrames[iExon] < 0);
     gp->exonFrames[iExon] = frame;