0601238e0258b0ae247f8c1aefe85bf50c039405
kate
  Fri Jan 17 17:25:34 2014 -0800
Make cell abbrev table into a collapsible section to reduce clutter on details page
diff --git src/hg/hgc/peakClusters.c src/hg/hgc/peakClusters.c
index e6b40f2..3c5fabf 100644
--- src/hg/hgc/peakClusters.c
+++ src/hg/hgc/peakClusters.c
@@ -13,30 +13,31 @@
 #include "common.h"
 #include "hash.h"
 #include "jksql.h"
 #include "obscure.h"
 #include "hCommon.h"
 #include "hdb.h"
 #include "web.h"
 #include "cart.h"
 #include "trackDb.h"
 #include "hui.h"
 #include "hgc.h"
 #include "encode/encodePeak.h"
 #include "expRecord.h"
 #include "bed6FloatScore.h"
 #include "ra.h"
+#include "jsHelper.h"
 #include "factorSource.h"
 
 static void printClusterTableHeader(struct slName *otherCols, 
 	boolean withAbbreviation, boolean withDescription, boolean withSignal)
 /* Print out header fields table of tracks in cluster */
 {
 webPrintLabelCell("#");
 if (withSignal)
     webPrintLabelCell("signal");
 if (withAbbreviation)
     webPrintLabelCell("abr");
 struct slName *col;
 for (col = otherCols; col != NULL; col = col->next)
     webPrintLabelCell(col->name);
 if (withDescription)
@@ -386,30 +387,32 @@
 #endif
 char query[256], buf[256];
 
 if (motifTable != NULL && sqlTableExists(conn, motifTable))
     {
     struct sqlResult *sr;
     int rowOffset;
     char where[256];
 
     if (motifMapTable != NULL && sqlTableExists(conn, motifMapTable))
         {
         sqlSafef(query, sizeof(query),
                 "select motif from %s where target = '%s'", motifMapTable, cluster->name);
         // TODO: perhaps sqlQuickString ?
         motifName = sqlQuickQuery(conn, query, buf, sizeof(buf));
+        if (motifName == NULL)
+            return;
         }
     #define HIGHEST_SCORING
     #ifdef HIGHEST_SCORING
     sqlSafefFrag(where, sizeof(where), "name = '%s' order by score desc", motifName);
     #else
     sqlSafefFrag(where, sizeof(where), "name = '%s'", motifName);
     #endif
     sr = hRangeQuery(conn, motifTable, cluster->chrom, cluster->chromStart,
                      cluster->chromEnd, where, &rowOffset);
     #ifdef HIGHEST_SCORING
     if ((row = sqlNextRow(sr)) != NULL)
     #else
     while ((row = sqlNextRow(sr)) != NULL)
     #endif
         {
@@ -557,21 +560,25 @@
             inputTrackTable, fieldList, FALSE, vocab);
     webPrintLinkTableEnd();
 
     webNewSection("List of cells assayed for %s but without hits in cluster", cluster->name);
     webPrintLinkTableStart();
     printClusterTableHeader(fieldList, TRUE, FALSE, FALSE);
     printFactorSourceTableHits(cluster, conn, sourceTable, 
             inputTrackTable, fieldList, TRUE, vocab);
     webPrintLinkTableEnd();
     }
 else
     {
     errAbort("Missing required trackDb setting %s for track %s",
         "inputTableFieldDisplay", tdb->track);
     }
-
-webNewSection("Table of abbreviations for cells");
+webNewSectionHeaderStart();
+jsBeginCollapsibleSectionOldStyle(cart, tdb->track, "cellSources", "Table of cell abbreviations", 
+                                  TRUE);
+webNewSectionHeaderEnd();
 hPrintFactorSourceAbbrevTable(conn, tdb);
-webNewSection("Track Description");
+jsEndCollapsibleSection();
+
+webNewSection("");
 }