6791876ba30394c3aad18702708feb4bfb6ec761 braney Thu Jul 19 17:04:44 2018 -0700 add bigBed numeric and filterBy filters diff --git src/hg/lib/hui.c src/hg/lib/hui.c index b5cb803..efca27e 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -5783,135 +5783,128 @@ } if (!blocked) // scoreFilter is implicit unless NO_SCORE_FILTER return TRUE; return FALSE; } 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 parentLevel = isNameAtParentLevel(tdb,name); boolean skipScoreFilter = FALSE; -boolean bigBed = startsWith("bigBed",tdb->type); -if (!bigBed) // bigBed filters are limited! - { // Numeric filters are first boolean isBoxOpened = FALSE; if (numericFiltersShowAll(db, cart, tdb, &isBoxOpened, boxed, parentLevel, name, title) > 0) skipScoreFilter = TRUE; // Add any multi-selects next filterBy_t *filterBySet = filterBySetGet(tdb,cart,name); if (filterBySet != NULL) { if (!tdbIsComposite(tdb) && cartOptionalString(cart, "ajax") == NULL) jsIncludeFile("hui.js",NULL); if (!isBoxOpened) // Note filterBy boxes are not double "boxed", printf("<BR>"); // if there are no other filters filterBySetCfgUi(cart,tdb,filterBySet,TRUE); 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) { if (isBoxOpened) cfgEndBox(boxed); 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,parentLevel,SCORE_FILTER,&minLimit,&maxLimit, &minVal, &maxVal); boolean filterByRange = trackDbSettingClosestToHomeOn(tdb, SCORE_FILTER _BY_RANGE); - if (!bigBed && filterByRange) + if (filterByRange) { puts("<B>Filter score range: min:</B>"); safef(option, sizeof(option), "%s.%s", name,SCORE_FILTER _MIN); cgiMakeIntVarWithLimits(option, minVal, "Minimum score",0, minLimit,maxLimit); puts("<B>max:</B>"); safef(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 { char* scoreLabel = trackDbSettingClosestToHomeOrDefault(tdb, SCORE_LABEL, "score"); printf("<b>Show only items with %s at or above:</b> ", scoreLabel); safef(option, sizeof(option), "%s.%s", name,SCORE_FILTER); cgiMakeIntVarWithLimits(option, minVal, "Minimum score",0, minLimit,maxLimit); printf(" (range: %d to %d)\n", minLimit, maxLimit); if (!boxed) printf("<BR>\n"); } if (glvlScoreMin) printf("<BR>"); } 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, parentLevel, "filterTopScorersOn", sameString(words[0], "on")); puts("<P>"); cgiMakeCheckBox(option, doScoreCtFilter); safef(option, sizeof(option), "%s.filterTopScorersCt", name); scoreFilterCt = cartUsualStringClosestToHome(cart, tdb, parentLevel, "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 ( !parentLevel && 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); } // Moved from hgTrackUi for consistency static void filterByChromCfgUi(struct cart *cart, struct trackDb *tdb) { char filterVar[256]; char *filterVal = ""; printf("<p><b>Filter by chromosome (e.g. chr10):</b> "); safef(filterVar, sizeof(filterVar), "%s.chromFilter", tdb->track); (void) cartUsualString(cart, filterVar, filterVal); // ignore returned setting cgiMakeTextVar(filterVar, cartUsualString(cart, filterVar, ""), 15); }