src/hg/lib/hui.c 1.223

1.223 2009/07/17 06:24:57 sugnet
Adding support for Fantom CAGE 4 track and filtering beds based on their name.
Index: src/hg/lib/hui.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/hui.c,v
retrieving revision 1.222
retrieving revision 1.223
diff -b -B -U 4 -r1.222 -r1.223
--- src/hg/lib/hui.c	10 Jul 2009 22:16:49 -0000	1.222
+++ src/hg/lib/hui.c	17 Jul 2009 06:24:57 -0000	1.223
@@ -3393,8 +3395,67 @@
 cfgEndBox(boxed);
 }
 
 
+
+void filterButtons(char *filterTypeVar, char *filterTypeVal, boolean none)
+/* Put up some filter buttons. */
+{
+printf("<B>Filter:</B> ");
+radioButton(filterTypeVar, filterTypeVal, "red");
+radioButton(filterTypeVar, filterTypeVal, "green");
+radioButton(filterTypeVar, filterTypeVal, "blue");
+radioButton(filterTypeVar, filterTypeVal, "exclude");
+radioButton(filterTypeVar, filterTypeVal, "include");
+if (none)
+    radioButton(filterTypeVar, filterTypeVal, "none");
+}
+
+void radioButton(char *var, char *val, char *ourVal)
+/* Print one radio button */
+{
+cgiMakeRadioButton(var, ourVal, sameString(ourVal, val));
+printf("%s ", ourVal);
+}
+
+void oneMrnaFilterUi(struct controlGrid *cg, char *text, char *var, struct cart *cart)
+/* Print out user interface for one type of mrna filter. */
+{
+controlGridStartCell(cg);
+printf("%s:<BR>", text);
+cgiMakeTextVar(var, cartUsualString(cart, var, ""), 19);
+controlGridEndCell(cg);
+}
+
+void bedUi(struct trackDb *tdb, struct cart *cart, char *title, boolean boxed)
+/* Put up UI for an mRNA (or EST) track. */
+{
+struct mrnaUiData *mud = newBedUiData(tdb->tableName);
+struct mrnaFilter *fil;
+struct controlGrid *cg = NULL;
+char *filterTypeVar = mud->filterTypeVar;
+char *filterTypeVal = cartUsualString(cart, filterTypeVar, "red");
+char *logicTypeVar = mud->logicTypeVar;
+char *logicTypeVal = cartUsualString(cart, logicTypeVar, "and");
+boxed = cfgBeginBoxAndTitle(tdb, boxed, title);
+/* Define type of filter. */
+printf("<table width=400><tr><td align='left'>\n");
+filterButtons(filterTypeVar, filterTypeVal, FALSE);
+printf("</br>");
+printf("<B>Combination Logic:</B> ");
+radioButton(logicTypeVar, logicTypeVal, "and");
+radioButton(logicTypeVar, logicTypeVal, "or");
+printf("</br>");
+printf("<B>Pattern:</B> ");
+/* List various fields you can filter on. */
+cg = startControlGrid(4, NULL);
+for (fil = mud->filterList; fil != NULL; fil = fil->next)
+    oneMrnaFilterUi(cg, fil->label, fil->key, cart);
+endControlGrid(&cg);
+cfgEndBox(boxed);
+}
+
+
 void scoreGrayLevelCfgUi(struct cart *cart, struct trackDb *tdb, char *prefix, int scoreMax)
 /* If scoreMin has been set, let user select the shade of gray for that score, in case
  * the default is too light to see or darker than necessary. */
 {