6819e624cfe2476aa5e10be99ebaf8c96e319278 angie Tue Aug 9 15:40:00 2011 -0700 Feature #3710 (vcfTabix UI options): added checkbox to enable/disable haplotype sorting display. diff --git src/hg/lib/vcfUi.c src/hg/lib/vcfUi.c index 7e603fa..7e5a371 100644 --- src/hg/lib/vcfUi.c +++ src/hg/lib/vcfUi.c @@ -1,207 +1,219 @@ /* vcfUi - Variant Call Format user interface controls that are shared * between more than one CGI. */ #include "common.h" #include "cheapcgi.h" #include "errCatch.h" #include "hCommon.h" #include "hui.h" #include "vcf.h" #include "vcfUi.h" #if (defined USE_TABIX && defined KNETFILE_HOOKS) #include "knetUdc.h" #include "udc.h" #endif//def USE_TABIX && KNETFILE_HOOKS INLINE char *nameOrDefault(char *thisName, char *defaultVal) /* If thisName is not a placeholder value, return it; otherwise return default. */ { if (isNotEmpty(thisName) && !sameString(thisName, ".")) return thisName; return defaultVal; } #define VCF_HAPLOSORT_DEFAULT_DESC "middle variant in viewing window" static void vcfCfgHaplotypeCenterHiddens(char *track, char *ctrName, char *ctrChrom, int ctrPos) /* Make hidden form inputs and button for setting the center variant for haplotype * clustering/sorting in hgTracks. */ { char cartVar[1024]; safef(cartVar, sizeof(cartVar), "%s.centerVariantChrom", track); cgiMakeHiddenVar(cartVar, ctrChrom); safef(cartVar, sizeof(cartVar), "%s.centerVariantPos", track); char ctrPosStr[16]; safef(ctrPosStr, sizeof(ctrPosStr), "%d", ctrPos); cgiMakeHiddenVar(cartVar, ctrPosStr); safef(cartVar, sizeof(cartVar), "%s.centerVariantName", track); cgiMakeHiddenVar(cartVar, ctrName); } void vcfCfgHaplotypeCenter(struct cart *cart, struct trackDb *tdb, struct vcfFile *vcff, char *thisName, char *thisChrom, int thisPos, char *formName) /* If vcff has genotype data, show status and controls for choosing the center variant * for haplotype clustering/sorting in hgTracks. */ { if (vcff != NULL && vcff->genotypeCount > 1) { -// cluster haplotypes or just show allele summary? -// if clustering haplotypes: -// track height? -// thicken lines? -// outline center variant? -// choose center variant? [hgc option to make this variant's coords the center of viewed region?] -// color haplotypes by red/blue or allele bases? printf("
" - "Haplotype sorting: using "); + "Haplotype sorting order: using "); char cartVar[1024]; safef(cartVar, sizeof(cartVar), "%s.centerVariantChrom", tdb->track); char *centerChrom = cartOptionalString(cart, cartVar); if (isEmpty(centerChrom)) { // Unspecified in cart -- describe the default action printf(VCF_HAPLOSORT_DEFAULT_DESC " as anchor. |
"); vcfCfgHaplotypeCenterHiddens(tdb->track, thisName, thisChrom, thisPos); char label[256]; safef(label, sizeof(label), "Use %s", nameOrDefault(thisName, "this variant")); cgiMakeButton("submit", label); printf(" as anchor |
To anchor the sorting to a particular variant, " "click on the variant in the genome browser, " "and then click on the 'Use this variant' button on the next page." " |
\n", nameOrDefault(centerName, "variant"), centerChrom, centerPos+1); char label[256]; safef(label, sizeof(label), "Use %s", nameOrDefault(thisName, "this variant")); cgiMakeButton("submit", label); printf(" as anchor |
"); struct dyString *onClick = dyStringNew(0); dyStringPrintf(onClick, "updateOrMakeNamedVariable(%s, '%s.centerVariantChrom', ''); ", formName, tdb->track); dyStringPrintf(onClick, "updateOrMakeNamedVariable(%s, '%s.centerVariantName', ''); ", formName, tdb->track); dyStringPrintf(onClick, "updateOrMakeNamedVariable(%s, '%s.centerVariantPos', 0);", formName, tdb->track); dyStringPrintf(onClick, "document.%s.submit(); return false;", formName); cgiMakeButtonWithOnClick("submit", "Clear selection", NULL, onClick->string); printf(" (use " VCF_HAPLOSORT_DEFAULT_DESC ") |
", 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);
+ if (vcff->genotypeCount > 1)
+ vcfCfgHapCluster(cart, tdb, vcff, name);
}
else
{
printf("Sorry, couldn't access VCF file. \n"); } // filter: // by qual column // by filter column // color bases like pgSnp or some better palette? printf(" |