97bb7f76e1881c333a1218c87982bc73fdaf59ad tdreszer Mon Oct 31 15:27:02 2011 -0700 Add limited support for bigBeds to have scoreFilter controls. diff --git src/hg/lib/hui.c src/hg/lib/hui.c index 1cb5c23..0a07852 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -4798,30 +4798,34 @@ } } if (count > 0) puts("</TABLE>"); return count; } #endif///def ALL_SCORE_FILTERS_LOGIC void scoreCfgUi(char *db, struct cart *cart, struct trackDb *tdb, char *name, char *title, int maxScore, boolean boxed) /* Put up UI for filtering bed track based on a score */ { char option[256]; boolean compositeLevel = isNameAtCompositeLevel(tdb,name); boolean skipScoreFilter = FALSE; +boolean bigBed = startsWith("bigBed",tdb->type); + +if (!bigBed) // bigBed filters are limited! + { filterBy_t *filterBySet = filterBySetGet(tdb,cart,name); #ifdef ALL_SCORE_FILTERS_LOGIC // Numeric filters are first boolean isBoxOpened = FALSE; if (numericFiltersShowAll(cart, tdb, &isBoxOpened, boxed, compositeLevel, name, title) > 0) skipScoreFilter = TRUE; #endif///def ALL_SCORE_FILTERS_LOGIC // Add any multi-selects next if(filterBySet != NULL) { if(!tdbIsComposite(tdb) && cartOptionalString(cart, "ajax") == NULL) jsIncludeFile("hui.js",NULL); @@ -4831,91 +4835,96 @@ filterBySetFree(&filterBySet); skipScoreFilter = TRUE; } // For no good reason scoreFilter is incompatible with filterBy and or numericFilters // FIXME scoreFilter should be implemented inside numericFilters and is currently specificly excluded to avoid unexpected changes if (skipScoreFilter) { #ifdef ALL_SCORE_FILTERS_LOGIC if (isBoxOpened) cfgEndBox(boxed); #endif///def ALL_SCORE_FILTERS_LOGIC return; // Cannot have both '*filter' and 'scoreFilter' } + } boolean scoreFilterOk = (trackDbSettingClosestToHome(tdb, NO_SCORE_FILTER) == NULL); boolean glvlScoreMin = (trackDbSettingClosestToHome(tdb, GRAY_LEVEL_SCORE_MIN) != NULL); if (! (scoreFilterOk || glvlScoreMin)) return; - boxed = cfgBeginBoxAndTitle(tdb, boxed, title); if (scoreFilterOk) { int minLimit=0,maxLimit=maxScore,minVal=0,maxVal=maxScore; getScoreIntRangeFromCart(cart,tdb,SCORE_FILTER,&minLimit,&maxLimit,&minVal,&maxVal); boolean filterByRange = trackDbSettingClosestToHomeOn(tdb, SCORE_FILTER _BY_RANGE); - if (filterByRange) + if (!bigBed && filterByRange) { puts("<B>Filter score range: min:</B>"); snprintf(option, sizeof(option), "%s.%s", name,SCORE_FILTER _MIN); cgiMakeIntVarWithLimits(option, minVal, "Minimum score",0, minLimit,maxLimit); puts("<B>max:</B>"); snprintf(option, sizeof(option), "%s.%s", name,SCORE_FILTER _MAX); cgiMakeIntVarWithLimits(option, maxVal, "Maximum score",0,minLimit,maxLimit); printf("(%d to %d)\n",minLimit,maxLimit); } else { printf("<b>Show only items with score at or above:</b> "); snprintf(option, sizeof(option), "%s.%s", name,SCORE_FILTER); cgiMakeIntVarWithLimits(option, minVal, "Minimum score",0, minLimit,maxLimit); printf(" (range: %d to %d)", minLimit, maxLimit); + if (!boxed) + printf("<BR>\n"); } } if (glvlScoreMin) scoreGrayLevelCfgUi(cart, tdb, name, maxScore); +if (!bigBed) + { /* filter top-scoring N items in track */ char *scoreCtString = trackDbSettingClosestToHome(tdb, "filterTopScorers"); if (scoreCtString != NULL) { /* show only top-scoring items. This option only displayed if trackDb * setting exists. Format: filterTopScorers <on|off> <count> <table> */ char *words[2]; char *scoreFilterCt = NULL; chopLine(cloneString(scoreCtString), words); safef(option, sizeof(option), "%s.filterTopScorersOn", name); bool doScoreCtFilter = cartUsualBooleanClosestToHome(cart, tdb, compositeLevel, "filterTopScorersOn", sameString(words[0], "on")); puts("<P>"); cgiMakeCheckBox(option, doScoreCtFilter); safef(option, sizeof(option), "%s.filterTopScorersCt", name); scoreFilterCt = cartUsualStringClosestToHome(cart, tdb, compositeLevel, "filterTopScorersCt", words[1]); puts(" <B> Show only items in top-scoring </B>"); cgiMakeIntVarWithLimits(option,atoi(scoreFilterCt),"Top-scoring count",0,1,100000); /* Only check size of table if track does not have subtracks */ if ( !compositeLevel && hTableExists(db, tdb->table)) printf(" (range: 1 to 100,000 total items: %d)\n",getTableSize(db, tdb->table)); else printf(" (range: 1 to 100,000)\n"); } + } cfgEndBox(boxed); } void pslCfgUi(char *db, struct cart *cart, struct trackDb *tdb, char *name, char *title, boolean boxed) /* Put up UI for psl tracks */ { boxed = cfgBeginBoxAndTitle(tdb, boxed, title); baseColorDropLists(cart, tdb, name); indelShowOptionsWithName(cart, tdb, name); cfgEndBox(boxed); } void netAlignCfgUi(char *db, struct cart *cart, struct trackDb *tdb, char *prefix, char *title, boolean boxed) /* Put up UI for net tracks */