9037401af48af40c7df11285b7d3bb713e6c75d8
max
  Thu Sep 15 16:45:06 2016 -0700
a bunch of small fixes to the crispr track, hopefully last round before
the pushq. refs #17235

diff --git src/hg/hgc/bigBedClick.c src/hg/hgc/bigBedClick.c
index a350096..a376f68 100644
--- src/hg/hgc/bigBedClick.c
+++ src/hg/hgc/bigBedClick.c
@@ -75,37 +75,43 @@
 printf("<td>\n");
 char *coords[65536];
 int coordCount = chopByChar(val, '|', coords, ArraySize(coords));
 int i;
 
 struct subText *subList = NULL;
 slSafeAddHead(&subList, subTextNew("ig:", "intergenic "));
 slSafeAddHead(&subList, subTextNew("ex:", "exon "));
 slSafeAddHead(&subList, subTextNew("in:", "intron "));
 slSafeAddHead(&subList, subTextNew("|", "-"));
 
 struct sqlConnection *conn = hAllocConn(database);
 
 boolean hasLocus = sqlTableExists(conn, "locusName");
 
+if (coordCount==0)
+    puts("Too many off-targets found to display or no off-targets. Please use the Crispor.org link at the top of the page to show all off-targets.\n");
+else
+    {
     printf("<table style='border-collapse:collapse; font-size:12px; table-layout:fixed'>\n");
     printf("<tr>\n"
            "<th style='width:26em'>Mismatched nucleotides</th>\n"
            "<th style='width:9em'>CFD Score</th>\n");
     if (hasLocus)
            printf("<th style='width:40em'>Locus</th>\n");
     printf("<th style='width:30em'>Position</th></tr>\n");
+    }
+
     
 boolean collapsed = FALSE;
 for (i=0; i<coordCount; i++)
     {
     if (i>10)
         {
         collapsed = TRUE;
         printf("<tr class='crisprLinkHidden' style='display:none'>\n");
         }
     else
         printf("<tr>\n");
 
     // parse single coordinate string
     // chr15;63615585-;71 = chrom;startPosStrand;scoreAsInt
     char *parts[3];
@@ -151,30 +157,31 @@
             printf("<td>%s</td>", descLong);
             freeMem(descLong);
             }
         sqlFreeResult(&sr);
         }
     
     // print link to location
     printf("<td><a href='%s&db=%s&position=%s%%3A%d-%d'>%s:%d (%c)</a></td>\n", 
         hgTracksPathAndSettings(), database,
         chrom, pos+1, pos+23, chrom, pos+1, strand);
 
     printf("</tr>\n");
     }
 hFreeConn(&conn);
 printf("<tr>\n");
+if (coordCount!=0)
     printf("</table>\n");
 if (collapsed)
     {
     printf("<p><a id='crisprShowAllLink' href='javascript:crisprShowAll()'>"
         "Show all %d off-targets...</a>\n", coordCount);
     // inline .js is bad style but why pollute our global .js files for such a rare
     // case? Maybe we should have a generic "collapsible" class, like bootstrap?
     printf("<script>\n");
     printf("function crisprShowAll() {\n");
     printf("    $('#crisprShowAllLink').hide();\n");
     printf("    $('.crisprLinkHidden').show();\n");
     printf("    return false;\n");
     printf("}\n");
     printf("</script>\n");
     }