6f5109cec1abd3140e6ff7f9b92cdf1805ca9938
angie
  Mon Oct 25 16:24:48 2010 -0700
Code Review #1452 (v243 preview1): Melissa pointed out that cdsSizewas incorrectly computed when there is a single coding exon that
contains both 5' and 3' UTR plus the entire coding region.  Fixed.
This didn't cause symptoms because in that single-coding-exon case,
there is no next coding exon so the miscalculated value is unused.

diff --git src/hg/hgTables/gffOut.c src/hg/hgTables/gffOut.c
index 6cf8b96..130b438 100644
--- src/hg/hgTables/gffOut.c
+++ src/hg/hgTables/gffOut.c
@@ -62,11 +62,9 @@
     int exonEnd = exonStart + bed->blockSizes[j];
     if ((exonStart < bed->thickEnd) && (exonEnd > bed->thickStart))
 	{
-	int cdsSize = exonEnd - exonStart;
-	if (exonEnd > bed->thickEnd)
-	    cdsSize = bed->thickEnd - exonStart;
-	else if (exonStart < bed->thickStart)
-	    cdsSize = exonEnd - bed->thickStart;
+	int cdsS = max(exonStart, bed->thickStart);
+	int cdsE = min(exonEnd, bed->thickEnd);
+	int cdsSize = cdsE - cdsS;
 	if (! gotFirstCds)
 	    {
 	    gotFirstCds = TRUE;