58710d45e2d047bbec487c4dcf5bb9fd1b8ed53b
kate
  Tue Jan 28 12:36:58 2014 -0800
Rearrange sections on factorSource details page and make another sectdion collapsible (motifs section better placed). refs #9092
diff --git src/hg/hgc/peakClusters.c src/hg/hgc/peakClusters.c
index 1904024..568ef28 100644
--- src/hg/hgc/peakClusters.c
+++ src/hg/hgc/peakClusters.c
@@ -446,31 +446,31 @@
     float maxScore = -1;
     sqlSafef(query, sizeof(query), 
         "select max(score) from %s where name = '%s'", motifTable, motifName);
     sr = sqlGetResult(conn, query);
     if ((row = sqlNextRow(sr)) != NULL)
         {
         if(!isEmpty(row[0]))
             {
             maxScore = sqlFloat(row[0]);
             }
         }
     sqlFreeResult(&sr);
     #endif
 
     //puts("<p></p>");
-    webNewSection("Motif Sequence from Matching Strand");
+    webNewSection("Canonical Motif in Cluster");
     for (hit = hits, i = 0; hit != NULL; hit = hit->next, i++)
         {
         struct dnaSeq *seq = hDnaFromSeq(database, 
             seqName, hit->chromStart, hit->chromEnd, dnaLower);
         if(hit->strand[0] == '-')
             reverseComplement(seq->dna, seq->size);
         seqs[i] = seq;
         // TODO: move to hgc.c (with other pos printers)
         safef(posLink, sizeof(posLink),"<a href=\"%s&db=%s&position=%s%%3A%d-%d\">%s:%d-%d</a>",
                 hgTracksPathAndSettings(), database, 
                     cluster->chrom, hit->chromStart+1, hit->chromEnd,
                     cluster->chrom, hit->chromStart+1, hit->chromEnd);
         printf("<b>Motif Name:</b>  %s<br>\n", motifName);
         printf("<b>Motif Score");
         if (hitCount > 1)
@@ -524,62 +524,66 @@
     errAbort("Error loading cluster from track %s", tdb->track);
 
 char *sourceTable = trackDbRequiredSetting(tdb, "sourceTable");
 
 char *factorLink = cluster->name;
 char *vocab = trackDbSetting(tdb, "controlledVocabulary");
 if (vocab != NULL)
     {
     char *file = cloneFirstWord(vocab);
     factorLink = controlledVocabLink(file, "term", factorLink, factorLink, factorLink, "");
     }
 printf("<B>Factor:</B> %s<BR>\n", factorLink);
 printf("<B>Cluster Score (out of 1000):</B> %d<BR>\n", cluster->score);
 printPos(cluster->chrom, cluster->chromStart, cluster->chromEnd, NULL, TRUE, NULL);
 
-doClusterMotifDetails(conn, tdb, cluster);
 
 /* Get list of tracks we'll look through for input. */
 char *inputTrackTable = trackDbRequiredSetting(tdb, "inputTrackTable");
 sqlSafef(query, sizeof(query), 
     "select tableName from %s where factor='%s' order by source", inputTrackTable, 
     cluster->name);
 
 /* Next do the lists of hits and misses.  We have the hits from the non-zero signals in
  * cluster->expScores.  We need to figure out the sources actually assayed though
  * some other way.  We'll do this by one of two techniques. */
 char *inputTableFieldDisplay = trackDbSetting(tdb, "inputTableFieldDisplay");
 if (inputTableFieldDisplay != NULL)
     {
     struct slName *fieldList = stringToSlNames(inputTableFieldDisplay);
     char *vocab = trackDbSetting(tdb, "controlledVocabulary");
 
     /* In a new section put up list of hits. */
-    webNewSection("List of %s Items in Cluster", cluster->name);
+    webNewSection("Assays for %s in Cluster", cluster->name);
     webPrintLinkTableStart();
     printClusterTableHeader(fieldList, TRUE, FALSE, TRUE);
     printFactorSourceTableHits(cluster, conn, sourceTable, 
             inputTrackTable, fieldList, FALSE, vocab);
     webPrintLinkTableEnd();
 
-    webNewSection("List of cells assayed for %s but without hits in cluster", cluster->name);
+    webNewSectionHeaderStart();
+    char sectionTitle[128];
+    safef(sectionTitle, 
+            sizeof(sectionTitle),"Assays for %s Without Hits in Cluster", cluster->name);
+    jsBeginCollapsibleSectionOldStyle(cart, tdb->track, "cellNoHits", sectionTitle, FALSE);
+    webNewSectionHeaderEnd();
     webPrintLinkTableStart();
     printClusterTableHeader(fieldList, TRUE, FALSE, FALSE);
     printFactorSourceTableHits(cluster, conn, sourceTable, 
             inputTrackTable, fieldList, TRUE, vocab);
     webPrintLinkTableEnd();
+    jsEndCollapsibleSection();
     }
 else
     {
     errAbort("Missing required trackDb setting %s for track %s",
         "inputTableFieldDisplay", tdb->track);
     }
 webNewSectionHeaderStart();
-jsBeginCollapsibleSectionOldStyle(cart, tdb->track, "cellSources", "Table of cell abbreviations", 
-                                  TRUE);
+jsBeginCollapsibleSectionOldStyle(cart, tdb->track, "cellSources", "Cell Abbreviations", FALSE);
 webNewSectionHeaderEnd();
 hPrintFactorSourceAbbrevTable(conn, tdb);
 jsEndCollapsibleSection();
 
-webNewSection("");
+doClusterMotifDetails(conn, tdb, cluster);
 }