5f52ff16304e45eda438642feed98d00adfa17fe
max
  Tue May 27 04:15:49 2014 -0700
fixing another gp->bed converter used byhg/altSplice/altSplice/genePredToBed.c, but not by
hg/genePredToBed/genePredToBed.c

diff --git src/hg/lib/bed.c src/hg/lib/bed.c
index 50d9240..6e5c7d8 100644
--- src/hg/lib/bed.c
+++ src/hg/lib/bed.c
@@ -57,32 +57,39 @@
 {
 struct bed *bed;
 int i, blockCount, *chromStarts, *blockSizes, chromStart;
 
 /* A tiny bit of error checking on the genePred. */
 if (genePred->txStart >= genePred->txEnd || genePred->cdsStart > genePred->cdsEnd)
     {
     errAbort("mangled genePred format for %s", genePred->name);
     }
 
 /* Allocate bed and fill in from psl. */
 AllocVar(bed);
 bed->chrom = cloneString(genePred->chrom);
 bed->chromStart = chromStart = genePred->txStart;
 bed->chromEnd = genePred->txEnd;
+// noncoding genes are expressed with both cdsStart/cdsEnd set to txEnd in genePred
+// but with both thickStart/thickEnd set to chromStart in bed
+if (genePred->cdsStart == genePred->cdsEnd && genePred->cdsEnd == genePred->txEnd)
+    bed->thickStart = bed->thickEnd = bed->chromStart;
+else 
+    {
     bed->thickStart = genePred->cdsStart;
     bed->thickEnd = genePred->cdsEnd;
+    }
 bed->score = 0;
 strncpy(bed->strand,  genePred->strand, sizeof(bed->strand));
 bed->blockCount = blockCount = genePred->exonCount;
 bed->blockSizes = blockSizes = (int *)cloneMem(genePred->exonEnds,(sizeof(int)*genePred->exonCount));
 bed->chromStarts = chromStarts = (int *)cloneMem(genePred->exonStarts, (sizeof(int)*genePred->exonCount));
 bed->name = cloneString(genePred->name);
 
 /* Convert coordinates to relative and exnosEnds to blockSizes. */
 for (i=0; i<blockCount; ++i)
     {
     blockSizes[i] -= chromStarts[i];
     chromStarts[i] -= chromStart;
     }
 return bed;
 }