9e3324155a600c0eb71adb7f5e63e36915973442
kate
  Fri Nov 1 17:13:15 2013 -0700
Detect problematic motif tables.  refs #9092
diff --git src/hg/hgc/regMotif.c src/hg/hgc/regMotif.c
index 77cb4b3..f409335 100644
--- src/hg/hgc/regMotif.c
+++ src/hg/hgc/regMotif.c
@@ -93,31 +93,39 @@
 /* Load dnaMotif from table. */
 {
 struct sqlConnection *conn = hAllocConn(database);
 char query[256];
 struct dnaMotif *motif;
 sqlSafefFrag(query, sizeof query, "name = '%s'", motifName);
 motif = dnaMotifLoadWhere(conn, motifTable, query);
 hFreeConn(&conn);
 return motif;
 }
 
 
 void motifMultipleHitsSection(struct dnaSeq **seqs, int count, struct dnaMotif *motif)
 /* Print out section about motif, possibly with mutliple occurrences. */
 {
-
+// Detect inconsistent motif/pwm tables and suppress confusing display
+if (motif != NULL)
+    {
+    if (motif->columnCount != seqs[0]->size)
+        {
+        warn("Motif seq length doesn't match PWM\n");
+        return;
+        }
+    }
 webNewSection("Motif:");
 printf("<PRE>\n");
 printf("<table>\n");
 if (motif != NULL)
     {
     struct tempName pngTn;
     dnaMotifMakeProbabalistic(motif);
     makeTempName(&pngTn, "logo", ".png");
     dnaMotifToLogoPng(motif, 47, 140, NULL, "../trash", pngTn.forCgi);
     printf("<tr><td></td><td colspan='%d'>", motif->columnCount);
     printf("<IMG SRC=\"%s\" BORDER=1>", pngTn.forHtml);
     printf("</td><td></td></tr>\n");
     }
 if (count > 0)
     {