84fc7dd7df5303df374f00530a8d590ae550e5db angie Wed Aug 10 08:12:11 2011 -0700 Feature #3710 (vcfTabix UI options): added option to use pgSnp colors instead of blueRef/redAlt in haplotype sorting display. diff --git src/hg/lib/vcfUi.c src/hg/lib/vcfUi.c index 7e5a371..434c6fc 100644 --- src/hg/lib/vcfUi.c +++ src/hg/lib/vcfUi.c @@ -140,59 +140,83 @@ 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; } +static void vcfCfgHapClusterEnable(struct cart *cart, struct trackDb *tdb, char *name, + boolean compositeLevel) +/* Let the user enable/disable haplotype sorting display. */ +{ +printf("Enable Haplotype sorting display: "); +boolean hapClustEnabled = cartUsualBooleanClosestToHome(cart, tdb, compositeLevel, + VCF_HAP_ENABLED_VAR, TRUE); +char varName[1024]; +safef(varName, sizeof(varName), "%s." VCF_HAP_ENABLED_VAR, name); +cgiMakeCheckBox(varName, hapClustEnabled); +printf("
\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("Color sorted haplotypes by:\n"); +char *colorBy = cartUsualStringClosestToHome(cart, tdb, compositeLevel, + VCF_HAP_COLORBY_VAR, VCF_HAP_COLORBY_REFALT); +boolean colorByRefAlt = sameString(colorBy, VCF_HAP_COLORBY_REFALT); +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)\n"); +cgiMakeRadioButton(varName, VCF_HAP_COLORBY_BASE, !colorByRefAlt); +printf("first base of allele (A = red, C = blue, G = green, T = magenta)
\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("Haplotype sorting display height: \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, "10", "2500"); } } static void vcfCfgHapCluster(struct cart *cart, struct trackDb *tdb, struct vcfFile *vcff, char *name) /* Show controls for haplotype-sorting display, which only makes sense to do when * the VCF file describes multiple genotypes. */ { boolean compositeLevel = isNameAtCompositeLevel(tdb, name); -printf("Enable Haplotype sorting display: "); -boolean hapClustEnabled = cartUsualBooleanClosestToHome(cart, tdb, compositeLevel, - VCF_HAP_ENABLED_VAR, TRUE); -char varName[1024]; -safef(varName, sizeof(varName), "%s." VCF_HAP_ENABLED_VAR, name); -cgiMakeCheckBox(varName, hapClustEnabled); -printf("
\n"); +vcfCfgHapClusterEnable(cart, tdb, name, compositeLevel); vcfCfgHaplotypeCenter(cart, tdb, vcff, NULL, NULL, 0, "mainForm"); +vcfCfgHapClusterColor(cart, tdb, name, compositeLevel); vcfCfgHapClusterHeight(cart, tdb, vcff, name, compositeLevel); // thicken lines? // outline center variant? // color haplotypes by red/blue or allele bases? } 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("", boxed ? " width='100%'" : ""); struct vcfFile *vcff = vcfHopefullyOpenHeader(cart, tdb); if (vcff != NULL) { if (vcff->genotypeCount > 1)