3ddf11a86aff7cdc3f059a0d0c85255b3b8fe891
angie
  Tue Mar 29 11:55:01 2016 -0700
snp125's getGPsWithFrames assumed that if a genePred table has an exonFrames column
then that column contains frames.  However, hg19's GENCODE Basic V19 has an empty
exonFrames column, which caused a SEGV downstream when trying to predict a coding SNP's
effect on a gene.  So, check for null exonFrames and compute if necessary.
refs #16777 (note 36)

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 6dc64bc..200c9bd 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -17370,31 +17370,36 @@
 					 char *chrom, int start, int end)
 /* Given a known-to-exist genePred table name and a range, return
  * genePreds in range with exonFrames populated. */
 {
 struct genePred *gpList = NULL;
 boolean hasBin;
 struct sqlResult *sr = hRangeQuery(conn, geneTable, chrom, start, end, NULL, &hasBin);
 struct sqlConnection *conn2 = hAllocConn(database);
 boolean hasFrames = (sqlFieldIndex(conn2, geneTable, "exonFrames") == hasBin + 14);
 char **row;
 while ((row = sqlNextRow(sr)) != NULL)
     {
     int fieldCount = hasBin + (hasFrames ? 15 : 10);
     struct genePred *gp;
     if (hasFrames)
+        {
 	gp = genePredExtLoad(row+hasBin, fieldCount);
+        // Some tables have an exonFrames column but it's empty...
+        if (gp->exonFrames == NULL)
+            genePredAddExonFrames(gp);
+        }
     else
 	{
 	gp = genePredLoad(row+hasBin);
 	genePredAddExonFrames(gp);
 	}
     slAddHead(&gpList, gp);
     }
 sqlFreeResult(&sr);
 hFreeConn(&conn2);
 return gpList;
 }
 
 void printSnp125Function(struct trackDb *tdb, struct snp125 *snp)
 /* If the user has selected a gene track for functional annotation,
  * report how this SNP relates to any nearby genes. */