5fe6a3b2ce5a7099de38022ab8875d5651797780 tdreszer Fri Dec 16 11:41:01 2011 -0800 Just a changed name tree wide. The 'compositeLevel' paramter to closestToHome cart functions was confusing. What it means is the request is for a setting one step above the tdb passed in. It is used for view level controls where the model tdb is a subtrack. This checkin has NO functional affect. diff --git src/hg/lib/wiggleCart.c src/hg/lib/wiggleCart.c index 234cafb..9dd4d1d 100644 --- src/hg/lib/wiggleCart.c +++ src/hg/lib/wiggleCart.c @@ -89,31 +89,31 @@ correctOrder(low, high); if (retMin) *retMin = low; if (retMax) *retMax = high; } else errAbort("Can't parse colon range '%s'", setting); } } static void viewLimitsCompositeOverride(struct trackDb *tdb,char *name, double *retMin, double *retMax,double *absMin, double *absMax) /* If aquiring min/max for composite level wig cfg. Look in parents as well as self. */ { -if(isNameAtCompositeLevel(tdb,name)) +if(isNameAtParentLevel(tdb,name)) { char *setting = NULL; if(absMin != NULL && absMax != NULL) { setting = trackDbSettingByView(tdb,MIN_LIMIT); if(setting != NULL) { if(setting[0] != '\0') *absMin = sqlDouble(setting); } setting = trackDbSettingByView(tdb,MAX_LIMIT); if(setting != NULL) { if(setting[0] != '\0') *absMax = sqlDouble(setting); @@ -173,33 +173,33 @@ // type wig <min> <max> if (wordCount >= 3) absMax = atof(words[2]); else missingAbsMax = TRUE; if (wordCount >= 2) absMin = atof(words[1]); else missingAbsMin = TRUE; } correctOrder(absMin, absMax); // Determine current minY,maxY. // Precedence: 1. cart; 2. defaultViewLimits; 3. viewLimits; // 4. absolute [which may need to default to #2 or #3!] -boolean compositeLevel = isNameAtCompositeLevel(tdb, name); -char *cartMinStr = cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, MIN_Y); -char *cartMaxStr = cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, MAX_Y); +boolean parentLevel = isNameAtParentLevel(tdb, name); +char *cartMinStr = cartOptionalStringClosestToHome(theCart, tdb, parentLevel, MIN_Y); +char *cartMaxStr = cartOptionalStringClosestToHome(theCart, tdb, parentLevel, MAX_Y); double cartMin = 0.0, cartMax = 0.0; if(cartMinStr) *retMin = atof(cartMinStr); if(cartMaxStr) *retMax = atof(cartMaxStr); if (cartMinStr && cartMaxStr) correctOrder(*retMin, *retMax); // If it weren't for the the allowance for missing data range values, // we could set retAbs* and be done here. if(cartMinStr) cartMin = *retMin; if(cartMaxStr) cartMax = *retMax; @@ -258,31 +258,31 @@ // And as the final word after composite override, reset retMin and retMax if from cart: if (cartMinStr) *retMin = cartMin; if (cartMaxStr) *retMax = cartMax; } /* void wigFetchMinMaxYWithCart() */ void wigFetchMinMaxPixelsWithCart(struct cart *theCart, struct trackDb *tdb, char *name,int *Min, int *Max, int *Default) /* Min, Max, Default Pixel height of track * Limits may be defined in trackDb with the maxHeightPixels string, * Or user requested limits are defined in the cart. * And default opening display limits may optionally be defined with the * maxHeightPixels declaration from trackDb *****************************************************************************/ { -boolean compositeLevel = isNameAtCompositeLevel(tdb,name); +boolean parentLevel = isNameAtParentLevel(tdb,name); char *heightPer = NULL; /* string from cart */ int maxHeightPixels = atoi(DEFAULT_HEIGHT_PER); int defaultHeightPixels = maxHeightPixels; int defaultHeight; /* truncated by limits */ int minHeightPixels = MIN_HEIGHT_PER; char * tdbDefault = cloneString( trackDbSettingClosestToHomeOrDefault(tdb, MAXHEIGHTPIXELS, DEFAULT_HEIGHT_PER) ); if (sameWord(DEFAULT_HEIGHT_PER,tdbDefault)) { struct hashEl *hel; /* no maxHeightPixels from trackDb, maybe it is in tdb->settings * (custom tracks keep settings here) */ if ((tdb->settings != (char *)NULL) && @@ -331,31 +331,31 @@ if (defaultHeightPixels > maxHeightPixels) defaultHeightPixels = maxHeightPixels; if (minHeightPixels > defaultHeightPixels) minHeightPixels = defaultHeightPixels; break; case 1: maxHeightPixels = atoi(words[0]); defaultHeightPixels = maxHeightPixels; if (minHeightPixels > defaultHeightPixels) minHeightPixels = defaultHeightPixels; break; default: break; } } -heightPer = cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, HEIGHTPER); +heightPer = cartOptionalStringClosestToHome(theCart, tdb, parentLevel, HEIGHTPER); /* Clip the cart value to range [minHeightPixels:maxHeightPixels] */ if (heightPer) defaultHeight = min( maxHeightPixels, atoi(heightPer)); else defaultHeight = defaultHeightPixels; defaultHeight = max(minHeightPixels, defaultHeight); *Max = maxHeightPixels; *Default = defaultHeight; *Min = minHeightPixels; freeMem(tdbDefault); } /* void wigFetchMinMaxPixelsWithCart() */ static char *wigCheckBinaryOption(struct trackDb *tdb, char *Default, char *notDefault, char *tdbString, char *secondTdbString) /* A common operation for binary options (two values possible) @@ -399,114 +399,114 @@ if ((hel = hashLookup(tdb->settingsHash, secondTdbString)) != NULL) { if (differentWord(Default,(char *)hel->val)) ret = notDefault; } } } } return(cloneString(ret)); } enum wiggleGridOptEnum wigFetchTransformFuncWithCart(struct cart *theCart, struct trackDb *tdb, char *name,char **optString) /* transformFunc - none by default **********************************/ { -boolean compositeLevel = isNameAtCompositeLevel(tdb,name); +boolean parentLevel = isNameAtParentLevel(tdb,name); char *transformFunc; enum wiggleTransformFuncEnum ret = wiggleTransformFuncNone; char * tdbDefault = trackDbSettingClosestToHome(tdb, TRANSFORMFUNC); -transformFunc = cloneString(cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, TRANSFORMFUNC)); +transformFunc = cloneString(cartOptionalStringClosestToHome(theCart, tdb, parentLevel, TRANSFORMFUNC)); if ((transformFunc == NULL) && (tdbDefault != NULL)) transformFunc = cloneString(tdbDefault); if (optString && transformFunc) *optString = cloneString(transformFunc); if (transformFunc) { ret = wiggleTransformFuncToEnum(transformFunc); freeMem(transformFunc); } return(ret); } enum wiggleGridOptEnum wigFetchAlwaysZeroWithCart(struct cart *theCart, struct trackDb *tdb, char *name,char **optString) /* alwaysZero - off by default **********************************/ { -boolean compositeLevel = isNameAtCompositeLevel(tdb,name); +boolean parentLevel = isNameAtParentLevel(tdb,name); char *alwaysZero; enum wiggleAlwaysZeroEnum ret = wiggleAlwaysZeroOff; char * tdbDefault = trackDbSettingClosestToHome(tdb, ALWAYSZERO); -alwaysZero = cloneString(cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, ALWAYSZERO)); +alwaysZero = cloneString(cartOptionalStringClosestToHome(theCart, tdb, parentLevel, ALWAYSZERO)); if ((alwaysZero == NULL) && (tdbDefault != NULL)) alwaysZero = cloneString(tdbDefault); if (optString && alwaysZero) *optString = cloneString(alwaysZero); if (alwaysZero) { ret = wiggleAlwaysZeroToEnum(alwaysZero); freeMem(alwaysZero); } return(ret); } enum wiggleGridOptEnum wigFetchHorizontalGridWithCart(struct cart *theCart, struct trackDb *tdb, char *name,char **optString) /* horizontalGrid - off by default **********************************/ { char *Default = wiggleGridEnumToString(wiggleHorizontalGridOff); char *notDefault = wiggleGridEnumToString(wiggleHorizontalGridOn); -boolean compositeLevel = isNameAtCompositeLevel(tdb,name); +boolean parentLevel = isNameAtParentLevel(tdb,name); char *horizontalGrid = NULL; enum wiggleGridOptEnum ret; -horizontalGrid = cloneString(cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, HORIZGRID)); +horizontalGrid = cloneString(cartOptionalStringClosestToHome(theCart, tdb, parentLevel, HORIZGRID)); if (!horizontalGrid) /* if it is NULL */ horizontalGrid = wigCheckBinaryOption(tdb,Default,notDefault,GRIDDEFAULT, HORIZGRID); if (optString) *optString = cloneString(horizontalGrid); ret = wiggleGridStringToEnum(horizontalGrid); freeMem(horizontalGrid); return(ret); } /* enum wiggleGridOptEnum wigFetchHorizontalGridWithCart() */ enum wiggleScaleOptEnum wigFetchAutoScaleWithCart(struct cart *theCart, struct trackDb *tdb, char *name, char **optString) /****** autoScale - off by default ***************************************/ { char *autoString = wiggleScaleEnumToString(wiggleScaleAuto); char *manualString = wiggleScaleEnumToString(wiggleScaleManual); char *Default = manualString; char *notDefault = autoString; -boolean compositeLevel = isNameAtCompositeLevel(tdb,name); +boolean parentLevel = isNameAtParentLevel(tdb,name); char *autoScale = NULL; enum wiggleScaleOptEnum ret; -autoScale = cloneString(cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, AUTOSCALE)); +autoScale = cloneString(cartOptionalStringClosestToHome(theCart, tdb, parentLevel, AUTOSCALE)); if (!autoScale) /* if nothing from the Cart, check trackDb/settings */ { /* It may be the autoScale=on/off situation from custom tracks */ char * tdbDefault = trackDbSettingClosestToHomeOrDefault(tdb, AUTOSCALE, "NONE"); if (sameWord(tdbDefault,"on")) autoScale = cloneString(autoString); else if (sameWord(tdbDefault,"off")) autoScale = cloneString(manualString); else { if (isCustomTrack(tdb->track)) // backwards defaults for custom tracks, autoScale on autoScale = wigCheckBinaryOption(tdb,notDefault,Default, AUTOSCALEDEFAULT, AUTOSCALE); @@ -518,58 +518,58 @@ if (optString) *optString = cloneString(autoScale); ret = wiggleScaleStringToEnum(autoScale); freeMem(autoScale); return(ret); } /* enum wiggleScaleOptEnum wigFetchAutoScaleWithCart() */ enum wiggleGraphOptEnum wigFetchGraphTypeWithCart(struct cart *theCart, struct trackDb *tdb, char *name, char **optString) /****** graphType - line(points) or bar graph *****************************/ { char *Default = wiggleGraphEnumToString(wiggleGraphBar); char *notDefault = wiggleGraphEnumToString(wiggleGraphPoints); -boolean compositeLevel = isNameAtCompositeLevel(tdb,name); +boolean parentLevel = isNameAtParentLevel(tdb,name); char *graphType = NULL; enum wiggleGraphOptEnum ret; -graphType = cloneString(cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, LINEBAR)); +graphType = cloneString(cartOptionalStringClosestToHome(theCart, tdb, parentLevel, LINEBAR)); if (!graphType) /* if nothing from the Cart, check trackDb/settings */ graphType = wigCheckBinaryOption(tdb,Default,notDefault,GRAPHTYPEDEFAULT, GRAPHTYPE); if (optString) *optString = cloneString(graphType); ret = wiggleGraphStringToEnum(graphType); freeMem(graphType); return(ret); } /* enum wiggleGraphOptEnum wigFetchGraphTypeWithCart() */ enum wiggleWindowingEnum wigFetchWindowingFunctionWithCart(struct cart *theCart, struct trackDb *tdb, char *name, char **optString) /****** windowingFunction - Whiskers by default **************************/ { char *Default = wiggleWindowingEnumToString(wiggleWindowingWhiskers); -boolean compositeLevel = isNameAtCompositeLevel(tdb,name); +boolean parentLevel = isNameAtParentLevel(tdb,name); char *windowingFunction = NULL; enum wiggleWindowingEnum ret; -windowingFunction = cloneString(cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, WINDOWINGFUNCTION)); +windowingFunction = cloneString(cartOptionalStringClosestToHome(theCart, tdb, parentLevel, WINDOWINGFUNCTION)); /* If windowingFunction is a string, it came from the cart, otherwise * see if it is specified in the trackDb option, finally * return the default. */ if (!windowingFunction) { char * tdbDefault = trackDbSettingClosestToHomeOrDefault(tdb, WINDOWINGFUNCTION, Default); freeMem(windowingFunction); if (differentWord(Default,tdbDefault)) windowingFunction = cloneString(tdbDefault); else { @@ -592,35 +592,35 @@ } if (optString) *optString = cloneString(windowingFunction); ret = wiggleWindowingStringToEnum(windowingFunction); freeMem(windowingFunction); return(ret); } /* enum wiggleWindowingEnum wigFetchWindowingFunctionWithCart() */ enum wiggleSmoothingEnum wigFetchSmoothingWindowWithCart(struct cart *theCart, struct trackDb *tdb, char *name, char **optString) /****** smoothingWindow - OFF by default **************************/ { char * Default = wiggleSmoothingEnumToString(wiggleSmoothingOff); -boolean compositeLevel = isNameAtCompositeLevel(tdb,name); +boolean parentLevel = isNameAtParentLevel(tdb,name); char * smoothingWindow = NULL; enum wiggleSmoothingEnum ret; -smoothingWindow = cloneString(cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, SMOOTHINGWINDOW)); +smoothingWindow = cloneString(cartOptionalStringClosestToHome(theCart, tdb, parentLevel, SMOOTHINGWINDOW)); if (!smoothingWindow) /* if nothing from the Cart, check trackDb/settings */ { char * tdbDefault = trackDbSettingClosestToHomeOrDefault(tdb, SMOOTHINGWINDOW, Default); if (differentWord(Default,tdbDefault)) smoothingWindow = cloneString(tdbDefault); else { struct hashEl *hel; /* no smoothingWindow from trackDb, maybe it is in tdb->settings * (custom tracks keep settings here) */ @@ -640,83 +640,83 @@ if (optString) *optString = cloneString(smoothingWindow); ret = wiggleSmoothingStringToEnum(smoothingWindow); freeMem(smoothingWindow); return(ret); } /* enum wiggleSmoothingEnum wigFetchSmoothingWindowWithCart() */ enum wiggleYLineMarkEnum wigFetchYLineMarkWithCart(struct cart *theCart, struct trackDb *tdb, char *name, char **optString) /* yLineMark - off by default **********************************/ { char *Default = wiggleYLineMarkEnumToString(wiggleYLineMarkOff); char *notDefault = wiggleYLineMarkEnumToString(wiggleYLineMarkOn); -boolean compositeLevel = isNameAtCompositeLevel(tdb,name); +boolean parentLevel = isNameAtParentLevel(tdb,name); char *yLineMark = NULL; enum wiggleYLineMarkEnum ret; -yLineMark = cloneString(cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, YLINEONOFF)); +yLineMark = cloneString(cartOptionalStringClosestToHome(theCart, tdb, parentLevel, YLINEONOFF)); if (!yLineMark) /* if nothing from the Cart, check trackDb/settings */ yLineMark = wigCheckBinaryOption(tdb,Default,notDefault,YLINEONOFF, (char *)NULL); if (optString) *optString = cloneString(yLineMark); ret = wiggleYLineMarkStringToEnum(yLineMark); freeMem(yLineMark); return(ret); } /* enum wiggleYLineMarkEnum wigFetchYLineMarkWithCart() */ void wigFetchYLineMarkValueWithCart(struct cart *theCart,struct trackDb *tdb, char *name, double *tDbYMark ) /* y= marker line value * User requested value is defined in the cart * A Default value can be defined as * yLineMark declaration from trackDb *****************************************************************************/ { -boolean compositeLevel = isNameAtCompositeLevel(tdb,name); +boolean parentLevel = isNameAtParentLevel(tdb,name); char *yLineMarkValue = NULL; /* string from cart */ double yLineValue; /* value from cart or trackDb */ char * tdbDefault = cloneString( trackDbSettingClosestToHomeOrDefault(tdb, YLINEMARK, "NONE") ); if (sameWord("NONE",tdbDefault)) { struct hashEl *hel; /* no yLineMark from trackDb, maybe it is in tdb->settings * (custom tracks keep settings here) */ if ((tdb->settings != (char *)NULL) && (tdb->settingsHash != (struct hash *)NULL)) { if ((hel = hashLookup(tdb->settingsHash, YLINEMARK)) != NULL) { freeMem(tdbDefault); tdbDefault = cloneString((char *)hel->val); } } } /* If nothing else, it is zero */ yLineValue = 0.0; /* Let's see if a value is available in the cart */ -yLineMarkValue = cartOptionalStringClosestToHome(theCart, tdb, compositeLevel, YLINEMARK); +yLineMarkValue = cartOptionalStringClosestToHome(theCart, tdb, parentLevel, YLINEMARK); /* if yLineMarkValue is non-Null, it is the requested value */ if (yLineMarkValue) yLineValue = atof(yLineMarkValue); else /* See if a default line is specified in the trackDb.ra file */ if (differentWord("NONE",tdbDefault)) yLineValue = atof(tdbDefault); /* If possible to return */ if (tDbYMark) *tDbYMark = yLineValue; freeMem(tdbDefault); } /* void wigFetchYLineMarkValueWithCart() */