1a2011f25ac0bd4ce02ed0eb093ff169724f9047 angie Mon May 2 16:39:23 2016 -0700 Added trackDb setting "tableBrowser noGenome", which allows tables to appear in TB and DI menus, unlike "tableBrowser off", but does not allow genome-wide queries on the tables. The new "noGenome" setting is used for OMIM tracks -- OMIM gave the OK for non-genome-wide queries on their tables. See #4458#note-53 for details of UI & functional changes to the TB and DI for noGenome tracks. hg/lib/cartTrackDb.c handles access control based on trackDb tableBrowser settings (and the seldom-used tableAccessControl database tables that restrict tables to be viewed only by certain hosts). As before, 'tableBrowser off' means that the track is removed from the trackList so the TB & DI don't even know that it exists. 'tableBrowser noGenome' tracks are included in the trackList, but the tracks and any tables listed after 'noGenome' are hashed for later use by cartTrackDbIsNoGenome(). The hash used to contain permitted-host lists, but now contains structs that combine the permitted-host lists with a noGenome flag. hgIntegrator.c now includes a 'noGenome' flag in the JSONified groupedTrackDb, which the JS code uses to identify noGenome tracks. When executing a query, if the query region is genome but hgi_querySpec has noGenome related tables left over from past position-only queries, those related table settings are removed from the parsed JSON querySpec->config->relatedTables that is passed down into annoStreamDb. If one of the dataSources is noGenome but the region is genome (should be possible only by URL-tweaking), the region is forced to position. In hgTables, when region is genome, correlation and intersection track menu options for noGenome tracks are disabled. On the main page, JS code controls whether options are disabled depending on the current region. When listing related tables for filtering or selected fields output, if region is genome then the checkboxes for noGenome tables are disabled. If the cart has noGenome related table or intersection settings left over from past searches, they are ignored. If a noGenome query URL is tweaked to have hgta_region=genome, the TB errors out. hgIntegratorModel.js handles disabling of menu options and related table field settings for noGenome tracks when region is genome. refs #4458 diff --git src/hg/hgTables/hgTables.h src/hg/hgTables/hgTables.h index dfadd07..f237e2b 100644 --- src/hg/hgTables/hgTables.h +++ src/hg/hgTables/hgTables.h @@ -82,32 +82,32 @@ void printTrackHtml(struct trackDb *tdb); /* If trackDb has html for table, print it out in a new section. */ /* ---------- Other UI stuff. ----------------------*/ boolean varOn(char *var); /* Return TRUE if variable exists and is set. */ void printMainHelp(); /* Put up main page help info. */ struct grp *showGroupField(char *groupVar, char *groupScript, struct sqlConnection *conn, boolean allTablesOk); /* Show group control. Returns selected group. */ -struct trackDb *showTrackField(struct grp *selGroup, - char *trackVar, char *trackScript); +struct trackDb *showTrackField(struct grp *selGroup, char *trackVar, char *trackScript, + boolean disableNoGenome); /* Show track control. Returns selected track. */ char *showTableField(struct trackDb *track, char *varName, boolean useJoiner); /* Show table control and label. */ struct slName *getDbListForGenome(); /* Get list of selectable databases. */ char *findSelDb(); /* Find user selected database (as opposed to genome database). */ struct slName *tablesForDb(char *db); /* Find tables associated with database. */ /* --------- Utility functions --------------------- */ @@ -121,30 +121,38 @@ void initGroupsTracksTables(); /* Get list of groups that actually have something in them. */ struct region *getRegions(); /* Consult cart to get list of regions to work on. */ struct region *getRegionsFullGenome(); /* Get a region list that covers all of each chromosome. */ char *getRegionName(); /* Get a name for selected region. Don't free this. */ boolean fullGenomeRegion(); /* Return TRUE if region is full genome. */ +boolean isNoGenomeDisabled(char *db, char *table); +/* Return TRUE if table (or a track with which it is associated) has 'tableBrowser noGenome' + * and region is genome. */ + +void checkNoGenomeDisabled(char *db, char *table); +/* Before producing output, make sure that the URL hasn't been hacked to make a + * genome-wide query on a noGenome table. */ + struct sqlResult *regionQuery(struct sqlConnection *conn, char *table, char *fields, struct region *region, boolean isPositional, char *extraWhere); /* Construct and execute query for table on region. */ void dbOverrideFromTable(char buf[256], char **pDb, char **pTable); /* If *pTable includes database, overrider *pDb with it, using * buf to hold string. */ struct grp *findSelectedGroup(struct grp *groupList, char *cgiVar); /* Find user-selected group if possible. If not then * go to various levels of defaults. */ struct trackDb *findSelectedTrack(struct trackDb *trackList, struct grp *group, char *varName); @@ -549,30 +557,33 @@ #define outSchema "schema" #define outSummaryStats "stats" #define outBed "bed" #define outGff "gff" #define outCustomTrack "customTrack" #define outHyperlinks "hyperlinks" #define outWigData "wigData" #define outWigBed "wigBed" #define outChromGraphData "chromGraphData" #define outMicroarrayNames "microarrayNames" #define outMicroarrayGroupings "microarrayGroupings" #define outGalaxy "galaxyQuery" #define outMaf "maf" #define outPalOptions "fasta" +/* For disabling tables in 'tableBrowser noGenome' settings, when region is genome */ +#define NO_GENOME_CLASS " class=\"hgtaNoGenome\" title=\"Position range queries only\"" + /* --------- Identifier list handling stuff. ------------ */ char *identifierFileName(); /* File name identifiers are in, or NULL if no such file. */ struct hash *identifierHash(char *db, char *table); /* Return hash full of identifiers from the given table (or NULL). */ char *getIdField(char *db, struct trackDb *track, char *table, struct hTableInfo *hti); /* Get ID field for table, or NULL if none. FreeMem result when done */ char *identifierWhereClause(char *idField, struct hash *idHash); /* If the number of pasted IDs is reasonably low, return a where-clause component for the IDs. */