e0066b6bba1eea45452a32de72eaf4af8c331bbb
angie
  Mon Aug 8 16:27:02 2011 -0700
Feature #2823 (VCF track handler): Added UI control over height of haplotype-sorting display.
diff --git src/hg/lib/vcfUi.c src/hg/lib/vcfUi.c
index a4927cd..7e603fa 100644
--- src/hg/lib/vcfUi.c
+++ src/hg/lib/vcfUi.c
@@ -147,36 +147,61 @@
 struct errCatch *errCatch = errCatchNew();
 if (errCatchStart(errCatch))
     {
     vcff = vcfTabixFileMayOpen(fileOrUrl, NULL, 0, 0, vcfMaxErr);
     }
 errCatchEnd(errCatch);
 if (errCatch->gotError)
     {
     if (isNotEmpty(errCatch->message->string))
 	warn("unable to open %s: %s", fileOrUrl, errCatch->message->string);
     }
 errCatchFree(&errCatch);
 return vcff;
 }
 
+void vcfCfgHapClusterHeight(struct cart *cart, struct trackDb *tdb, struct vcfFile *vcff,
+			    char *name)
+/* Let the user specify a height for the track. */
+{
+if (vcff != NULL && vcff->genotypeCount > 1)
+    {
+    printf("<B>Haplotype sorting display height:</B> \n");
+    boolean compositeLevel = isNameAtCompositeLevel(tdb, name);
+    int cartHeight = cartUsualIntClosestToHome(cart, tdb, compositeLevel,
+					       VCF_HAP_HEIGHT_VAR, VCF_DEFAULT_HAP_HEIGHT);
+    char varName[1024];
+    safef(varName, sizeof(varName), "%s." VCF_HAP_HEIGHT_VAR, name);
+    cgiMakeIntVarInRange(varName, cartHeight, "Height (in pixels) of track", 5, "10", "2500");
+    }
+}
+
 void vcfCfgUi(struct cart *cart, struct trackDb *tdb, char *name, char *title, boolean boxed)
 /* VCF: Variant Call Format.  redmine #3710 */
 {
 boxed = cfgBeginBoxAndTitle(tdb, boxed, title);
 printf("<TABLE%s><TR><TD>", boxed ? " width='100%'" : "");
 struct vcfFile *vcff = vcfHopefullyOpenHeader(cart, tdb);
+if (vcff != NULL)
+    {
 vcfCfgHaplotypeCenter(cart, tdb, vcff, NULL, NULL, 0, "mainForm");
+    vcfCfgHapClusterHeight(cart, tdb, vcff, name);
+    }
+else
+    {
+    printf("Sorry, couldn't access VCF file.<BR>\n");
+    }
+
 // filter:
 //   by qual column
 //   by filter column
 // color bases like pgSnp or some better palette?
 
 
 printf("</TD></TR></TABLE>");
 
 if (!boxed && fileExists(hHelpFile("hgVcfTrackHelp")))
     printf("<P><A HREF=\"../goldenPath/help/hgVcfTrackHelp.html\" TARGET=_BLANK>VCF "
 	   "configuration help</A></P>");
 cfgEndBox(boxed);
 }