2e5a07597bfa95dedb669fef2a5e2b8048f2c644
angie
  Mon Dec 5 08:08:23 2011 -0800
Feature #3711 (VCF haplo-sorting display): Implemented Richard Durbin'ssuggestions as new defaults:

1. Instead of ref=blue, alt=red, simply ignore ref and draw only alt, in black.
Draw top & bottom bounds of variants in extra pixel rows.

2. Draw the tree using open triangles instead of open rectangles.

diff --git src/hg/lib/vcfUi.c src/hg/lib/vcfUi.c
index 3a5985b..3772c3c 100644
--- src/hg/lib/vcfUi.c
+++ src/hg/lib/vcfUi.c
@@ -157,78 +157,97 @@
 {
 boolean hapClustEnabled = cartUsualBooleanClosestToHome(cart, tdb, compositeLevel,
 							VCF_HAP_ENABLED_VAR, TRUE);
 char cartVar[1024];
 safef(cartVar, sizeof(cartVar), "%s." VCF_HAP_ENABLED_VAR, name);
 cgiMakeCheckBox(cartVar, hapClustEnabled);
 printf("<B>Enable Haplotype sorting display</B><BR>\n");
 }
 
 static void vcfCfgHapClusterColor(struct cart *cart, struct trackDb *tdb, char *name,
 				   boolean compositeLevel)
 /* Let the user choose how to color the sorted haplotypes. */
 {
 printf("<B>Haplotype coloring scheme:</B><BR>\n");
 char *colorBy = cartUsualStringClosestToHome(cart, tdb, compositeLevel,
-					     VCF_HAP_COLORBY_VAR, VCF_HAP_COLORBY_REFALT);
-boolean colorByRefAlt = sameString(colorBy, VCF_HAP_COLORBY_REFALT);
+					     VCF_HAP_COLORBY_VAR, VCF_DEFAULT_HAP_COLORBY);
 char varName[1024];
 safef(varName, sizeof(varName), "%s." VCF_HAP_COLORBY_VAR, name);
-cgiMakeRadioButton(varName, VCF_HAP_COLORBY_REFALT, colorByRefAlt);
-printf("reference/alternate alleles (reference = blue, alternate = red)<BR>\n");
-cgiMakeRadioButton(varName, VCF_HAP_COLORBY_BASE, !colorByRefAlt);
+cgiMakeRadioButton(varName, VCF_HAP_COLORBY_ALTONLY, sameString(colorBy, VCF_HAP_COLORBY_ALTONLY));
+printf("reference alleles invisible, alternate alleles in black<BR>\n");
+cgiMakeRadioButton(varName, VCF_HAP_COLORBY_REFALT, sameString(colorBy, VCF_HAP_COLORBY_REFALT));
+printf("reference alleles in blue, alternate alleles in red<BR>\n");
+cgiMakeRadioButton(varName, VCF_HAP_COLORBY_BASE, sameString(colorBy, VCF_HAP_COLORBY_BASE));
 printf("first base of allele (A = red, C = blue, G = green, T = magenta)<BR>\n");
 }
 
+static void vcfCfgHapClusterTreeAngle(struct cart *cart, struct trackDb *tdb, char *name,
+				   boolean compositeLevel)
+/* Let the user choose branch shape. */
+{
+printf("<B>Haplotype clustering tree branch shape:</B><BR>\n");
+char *treeAngle = cartUsualStringClosestToHome(cart, tdb, compositeLevel,
+					     VCF_HAP_TREEANGLE_VAR, VCF_DEFAULT_HAP_TREEANGLE);
+char varName[1024];
+safef(varName, sizeof(varName), "%s." VCF_HAP_TREEANGLE_VAR, name);
+cgiMakeRadioButton(varName, VCF_HAP_TREEANGLE_TRIANGLE,
+		   sameString(treeAngle, VCF_HAP_TREEANGLE_TRIANGLE));
+printf("triangular<BR>\n");
+cgiMakeRadioButton(varName, VCF_HAP_TREEANGLE_RECTANGLE,
+		   sameString(treeAngle, VCF_HAP_TREEANGLE_RECTANGLE));
+printf("rectangular<BR>\n");
+}
+
 static void vcfCfgHapClusterHeight(struct cart *cart, struct trackDb *tdb, struct vcfFile *vcff,
 				   char *name, boolean compositeLevel)
 /* Let the user specify a height for the track. */
 {
 if (vcff != NULL && vcff->genotypeCount > 1)
     {
     printf("<B>Haplotype sorting display height:</B> \n");
     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, "4", "2500");
     puts("<BR>");
     }
 }
 
 static void vcfCfgHapCluster(struct cart *cart, struct trackDb *tdb, struct vcfFile *vcff,
 			     char *name, boolean compositeLevel)
 /* Show controls for haplotype-sorting display, which only makes sense to do when
  * the VCF file describes multiple genotypes. */
 {
 vcfCfgHapClusterEnable(cart, tdb, name, compositeLevel);
 vcfCfgHaplotypeCenter(cart, tdb, name, compositeLevel, vcff, NULL, NULL, 0, "mainForm");
 vcfCfgHapClusterColor(cart, tdb, name, compositeLevel);
+vcfCfgHapClusterTreeAngle(cart, tdb, name, compositeLevel);
 vcfCfgHapClusterHeight(cart, tdb, vcff, name, compositeLevel);
 puts("<BR>");
 }
 
 static void vcfCfgMinQual(struct cart *cart, struct trackDb *tdb, struct vcfFile *vcff,
 			  char *name, boolean compositeLevel)
 /* If checkbox is checked, apply minimum value filter to QUAL column. */
 {
 char cartVar[1024];
 safef(cartVar, sizeof(cartVar), "%s." VCF_APPLY_MIN_QUAL_VAR, name);
 boolean applyFilter = cartUsualBooleanClosestToHome(cart, tdb, compositeLevel,
 					VCF_APPLY_MIN_QUAL_VAR, VCF_DEFAULT_APPLY_MIN_QUAL);
 cgiMakeCheckBox(cartVar, applyFilter);
-printf("<B>Exclude items with QUAL score less than &nbsp;</B>\n");
+printf("<B>Exclude items with QUAL score less than</B>\n");
 double minQual = cartUsualDoubleClosestToHome(cart, tdb, compositeLevel, VCF_MIN_QUAL_VAR,
 					      VCF_DEFAULT_MIN_QUAL);
 safef(cartVar, sizeof(cartVar), "%s." VCF_MIN_QUAL_VAR, name);
 cgiMakeDoubleVar(cartVar, minQual, 10);
 printf("<BR>\n");
 }
 
 static void vcfCfgFilterColumn(struct cart *cart, struct trackDb *tdb, struct vcfFile *vcff,
 			       char *name, boolean compositeLevel)
 /* Show controls for filtering by value of VCF's FILTER column, which uses values defined
  * in the header. */
 {
 int filterCount = slCount(vcff->filterDefs);
 if (filterCount < 1)
     return;