edc2fc7899775257086e2d840beaf7e2e6855742
angie
  Wed Jul 9 16:46:27 2014 -0700
Moved Regulatory annotations out of 'Select More Annotations' into theirown top-level section because they are not just another annotation source --
they cause us to assign a specific consequence type.  Also, as Jonathan suggested,
I'm suppressing regulatory annotation info for gene-consequence lines of outputs.
That makes the output a lot less redundant while still providing details for
RegulatoryFeature lines of output.

diff --git src/hg/hgVai/hgVai.c src/hg/hgVai/hgVai.c
index f80314c..4815b10 100644
--- src/hg/hgVai/hgVai.c
+++ src/hg/hgVai/hgVai.c
@@ -733,57 +733,68 @@
 {
 //#*** NEED METADATA
 return (sameString("wgEncodeRegDnaseClusteredV2", tdb->table) ||
 	sameString("wgEncodeRegTfbsClusteredV3", tdb->table));
 }
 
 struct slRef *findRegulatoryTracks()
 /* Look for the very limited set of Regulation tracks that hgVai offers. */
 {
 struct slRef *regTrackRefList = NULL;
 tdbFilterGroupTrack(fullTrackList, fullGroupList, isRegulatoryTrack,
 		    NULL, NULL, &regTrackRefList);
 return regTrackRefList;
 }
 
-void selectRegulatory(struct slRef *trackRefList)
-/* If trackRefList is non-NULL, make a collapsible section with a checkbox for each track,
+void selectRegulatory()
+/* If trackRefList is non-NULL, make a section with a checkbox for each track,
  * labelled with longLabel, and optionally some filtering options. */
 {
+struct slRef *trackRefList = findRegulatoryTracks();
 if (trackRefList != NULL)
     {
-    startCollapsibleSection("Regulation", "Regulatory regions", FALSE);
+    puts("<BR>");
+    printf("<div class='sectionLiteHeader'>Select Regulatory Annotations</div>\n");
+    printf("The annotations in this section provide predicted regulatory regions "
+	   "based on various experimental data.  "
+	   "When a variant overlaps an annotation selected here, the consequence term "
+	   "<A HREF=\"http://sequenceontology.org/browser/current_release/term/SO:0001566\" "
+	   "TARGET=_BLANK>regulatory_region_variant</A> will be assigned.  "
+	   "Follow the links to description pages that explain how each dataset was "
+	   "constructed.  "
+	   "Some datasets cover a significant portion of the genome and it may be "
+	   "desirable to filter these annotations by cell type and/or score in order "
+	   "to avoid an overabundance of hits.  ");
     // Use a table with checkboxes in one column and label/other stuff that depends on
     // checkbox in other column.
     puts("<TABLE>");
     struct slRef *ref;
     for (ref = trackRefList;  ref != NULL;  ref = ref->next)
 	{
 	struct trackDb *tdb = ref->val;
 	char cartVar[512];
 	safef(cartVar, sizeof(cartVar), "hgva_track_%s_%s", database, tdb->track);
 	puts("<TR><TD valign=top>");
 	cartMakeCheckBox(cart, cartVar, FALSE);
 	puts("</TD><TD>");
 	struct trackDb *topTdb = trackDbTopLevelSelfOrParent(tdb);
 	printf("<A HREF=\"%s?%s&g=%s\">%s</A><BR>\n", hgTrackUiName(), cartSidUrlString(cart),
 	       topTdb->track, tdb->longLabel);
 	printFilterOptions(tdb);
 	puts("</TD></TR>");
 	}
-    puts("</TABLE><BR>");
-    endCollapsibleSection();
+    puts("</TABLE>");
     }
 }
 
 boolean isConsElTrack(struct trackDb *tdb, void *filterData)
 /* This is a TdbFilterFunction to get "phastConsNwayElements" tracks. */
 {
 return (startsWith("phastCons", tdb->table) && stringIn("Elements", tdb->table));
 }
 
 boolean isConsScoreTrack(struct trackDb *tdb, void *filterData)
 /* This is a TdbFilterFunction to get tracks that start with "phastCons" (no Elements)
  * or "phyloP". */
 {
 return ((startsWith("phastCons", tdb->table) && !stringIn("Elements", tdb->table))
 	|| startsWith("phyloP", tdb->table));
@@ -814,43 +825,40 @@
 	cartMakeCheckBox(cart, cartVar, FALSE);
 	struct trackDb *topTdb = trackDbTopLevelSelfOrParent(tdb);
 	printf("<A HREF=\"%s?%s&g=%s\">%s</A><BR>\n", hgTrackUiName(), cartSidUrlString(cart),
 	       topTdb->track, tdb->longLabel);
 	}
     puts("<BR>");
     endCollapsibleSection();
     }
 }
 
 void selectAnnotations()
 /* Beyond predictions of protein-coding effect, what other basic data can we integrate? */
 {
 struct slName *dbNsfpTables = findDbNsfpTables();
 boolean gotSnp = findSnpBed4("", NULL, NULL);
-struct slRef *regTrackRefList = findRegulatoryTracks();
 struct slRef *elTrackRefList = NULL, *scoreTrackRefList = NULL;
 findCons(&elTrackRefList, &scoreTrackRefList);
-if (dbNsfpTables == NULL && !gotSnp && elTrackRefList == NULL && scoreTrackRefList == NULL
-    && regTrackRefList == NULL)
+if (dbNsfpTables == NULL && !gotSnp && elTrackRefList == NULL && scoreTrackRefList == NULL)
     return;
 puts("<BR>");
 printf("<div class='sectionLiteHeader'>Select More Annotations (optional)</div>\n");
 // Make wrapper table for collapsible sections:
 puts("<TABLE border=0 cellspacing=5 cellpadding=0 style='padding-left: 10px;'>");
 selectDbNsfp(dbNsfpTables);
 selectDbSnp(gotSnp);
-selectRegulatory(regTrackRefList);
 trackCheckBoxSection("ConsEl", "Conserved elements", elTrackRefList);
 trackCheckBoxSection("ConsScore", "Conservation scores", scoreTrackRefList);
 puts("</TABLE>");
 }
 
 void selectFiltersFunc()
 /* Options to restrict variants based on gene region/soTerm from gpFx */
 {
 startCollapsibleSection("filtersFunc", "Functional role", FALSE);
 printf("Include variants annotated as<BR>\n");
 cartMakeCheckBox(cart, "hgva_include_intergenic", TRUE);
 printf("intergenic<BR>\n");
 cartMakeCheckBox(cart, "hgva_include_upDownstream", TRUE);
 printf("upstream/downstream of gene<BR>\n");
 cartMakeCheckBox(cart, "hgva_include_nmdTranscript", TRUE);
@@ -1028,30 +1036,31 @@
        "</script>\n", alreadyAgreed ? "true" : "false");
 addSomeCss();
 printAssemblySection();
 
 /* Check for variant custom tracks.  If there are none, tell user they need to
  * upload at least one. */
 struct slRef *varTrackList = NULL, *varGroupList = NULL;
 tdbFilterGroupTrack(fullTrackList, fullGroupList, isVariantCustomTrack, NULL,
 		    &varGroupList, &varTrackList);
 puts("<BR>");
 // Make wrapper table for collapsible sections:
 selectVariants(varGroupList, varTrackList);
 boolean gotGP = selectGenes();
 if (gotGP)
     {
+    selectRegulatory();
     selectAnnotations();
     selectFilters();
     selectOutput();
     submitAndDisclaimer();
     }
 printf("</FORM>");
 
 jsReloadOnBackButton(cart);
 
 webNewSection("Using the Variant Annotation Integrator");
 webIncludeHelpFile("hgVaiHelpText", FALSE);
 jsIncludeFile("jquery-ui.js", NULL);
 jsIncludeFile("hgVarAnnogrator.js", NULL);
 jsIncludeFile("ui.dropdownchecklist.js", NULL);
 jsIncludeFile("ddcl.js", NULL);