src/hg/hgc/hgc.c 1.1577

1.1577 2009/09/30 23:17:14 hiram
fixup access to normScore column for tables that have that
Index: src/hg/hgc/hgc.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/hgc.c,v
retrieving revision 1.1576
retrieving revision 1.1577
diff -b -B -U 4 -r1.1576 -r1.1577
--- src/hg/hgc/hgc.c	28 Sep 2009 21:51:10 -0000	1.1576
+++ src/hg/hgc/hgc.c	30 Sep 2009 23:17:14 -0000	1.1577
@@ -2706,9 +2706,8 @@
 int chainWinSize;
 double subSetScore = 0.0;
 int qs, qe;
 boolean nullSubset = FALSE;
-char *foundTable = (char *)NULL;
 
 if (! sameWord(otherDb, "seq"))
     {
     otherOrg = hOrganism(otherDb);
@@ -2798,19 +2797,21 @@
 boolean normScoreAvailable = chainDbNormScoreAvailable(tdb);
 
 if (normScoreAvailable)
     {
+    boolean hasBin;
+    char tableName[HDB_MAX_TABLE_STRING];
+    hFindSplitTable(database, chain->tName, track, tableName, &hasBin);
     char query[256];
     struct sqlResult *sr;
     char **row;
     safef(query, ArraySize(query),
-	 "select normScore from %s where id = '%s'", foundTable, item);
+	 "select normScore from %s where id = '%s'", tableName, item);
     sr = sqlGetResult(conn, query);
     if ((row = sqlNextRow(sr)) != NULL)
 	printf("<B>Normalized Score:</B> %1.0f (bases matched: %d)<BR>\n",
 	    atof(row[0]), (int) (chain->score/atof(row[0])));
     sqlFreeResult(&sr);
-    freeMem(foundTable);
     }
 
 printf("<BR>\n");