f1464a78ed45c0f2c2c47112d5ec0585e875208e braney Tue Oct 30 15:01:29 2018 -0700 some optimizations to speed up trackDb loads on huge hubs diff --git src/hg/inc/trackDb.h src/hg/inc/trackDb.h index c31f871..5d14a0a 100644 --- src/hg/inc/trackDb.h +++ src/hg/inc/trackDb.h @@ -47,30 +47,31 @@ unsigned char altColorG; /* Light color green component 0-255 */ unsigned char altColorB; /* Light color blue component 0-255 */ unsigned char useScore; /* 1 if use score, 0 if not */ #ifndef __cplusplus unsigned char private; /* 1 if only want to show it on test site */ #else unsigned char priv; /* don't conflict with C++ keyword */ #endif int restrictCount; /* Number of chromosomes this is on (0=all though!) */ char **restrictList; /* List of chromosomes this is on */ char *url; /* URL to link to when they click on an item */ char *html; /* Some html to display when they click on an item */ char *grp; /* Which group track belongs to */ unsigned char canPack; /* 1 if can pack track display, 0 otherwise */ char *settings; /* Name/value pairs for track-specific stuff */ + struct hash *viewHash; /* Hash for settings. Not saved in database.*/ struct hash *settingsHash; /* Hash for settings. Not saved in database. * Don't use directly, rely on trackDbSetting to access. */ /* additional info, determined from settings */ char treeNodeType; // bit map containing defining supertrack, composite and children // of same (may be parent & child) struct trackDb *parent; // parent of composite or superTracks struct trackDb *subtracks; // children of composite not supers. NOTE: only in one sl at a time! struct slRef *children; // children of folders (superTracks) only. // Needed as slRef since these children are on the main trackList // and can't be in 2 sl's at once char *parentName; // set if this is a supertrack member boolean isShow; // for supertracks: true if supertrack with pseudo-vis 'show' struct hash *overrides; /* If not NULL, this is an override * entry. It contains the names, but not the * values of the fields and settings that were @@ -536,72 +537,103 @@ boolean trackDbCheckValidRelease(char *tag); /* check to make sure release tag is valid */ struct slName *trackDbLocalSettingsWildMatch(struct trackDb *tdb, char *expression); // Return local settings that match expression else NULL. In alpha order. struct slName *trackDbSettingsWildMatch(struct trackDb *tdb, char *expression); // Return settings in tdb tree that match expression else NULL. In alpha order, no duplicates. // Forward defs for tdbExtras struct mdbObj; struct _membersForAll; struct _membership; +enum filterCompositeType +// Filter composites are drop-down checkbox-lists for selecting subtracks (eg hg19::HAIB TFBS) + { + fctNone=0, // do not offer filter for this dimension + fctOne=1, // filter composite by one or all + fctOneOnly=2, // filter composite by only one + fctMulti=3, // filter composite by multiselect: all, one or many + }; + +typedef struct _members + { + int count; + char * groupTag; + char * groupTitle; + char **tags; + char **titles; + boolean *selected; + char * setting; + int *subtrackCount; // count of subtracks + int *currentlyVisible; // count of visible subtracks + struct slRef **subtrackList; // set of subtracks belonging to each subgroup member + enum filterCompositeType fcType; // fctNone,fctOne,fctMulti + } members_t; + struct tdbExtras #define TDB_EXTRAS_EMPTY_STATE 666 // Struct for misc. data collected/calculated during CGI track setup that are cached for later use. // These extras are primarily used in hgTracks & hgTrackUi but can be used and expanded as needed. // CGI developers are encouraged to add to this structure for their own needs. { int fourState; // hgTrackUi subtracks use 4 state checkboxes (checked/un by enabled/dis) boolean reshapedComposite; // hgTracks should not "reshape" composites more than once. struct mdbObj *mdb; // several CGIs need repeated access to a tracks metadata struct _membersForAll *membersForAll; // hgTrackUi composites collect all view/dimension info struct _membership *membership; // hgTrackUi subtracks have individual membership info // Developer: please add your useful data that is costly to calculate/retrieve more than once + struct hash *membersHash; }; void tdbExtrasFree(struct tdbExtras **pTdbExtras); // Frees the tdbExtras structure int tdbExtrasFourState(struct trackDb *tdb); // Returns subtrack four state if known, else TDB_EXTRAS_EMPTY_STATE void tdbExtrasFourStateSet(struct trackDb *tdb,int fourState); // Sets subtrack four state boolean tdbExtrasReshapedComposite(struct trackDb *tdb); // Returns TRUE if composite has been declared as reshaped, else FALSE. void tdbExtrasReshapedCompositeSet(struct trackDb *tdb); // Declares that the composite has been reshaped. struct mdbObj *tdbExtrasMdb(struct trackDb *tdb); // Returns mdb metadata if already known, else NULL void tdbExtrasMdbSet(struct trackDb *tdb,struct mdbObj *mdb); // Sets the mdb metadata structure for later retrieval. struct _membersForAll *tdbExtrasMembersForAll(struct trackDb *tdb); // Returns composite view/dimension members for all, else NULL. void tdbExtrasMembersForAllSet(struct trackDb *tdb, struct _membersForAll *membersForAll); // Sets the composite view/dimensions members for all for later retrieval. +members_t *tdbExtrasMembers(struct trackDb *tdb, char *groupNameOrTag); +// Returns subtrack members if already known, else NULL + +void tdbExtrasMembersSet(struct trackDb *tdb, char *groupNameOrTag, members_t *members); +// Sets the subtrack members for later retrieval. + struct _membership *tdbExtrasMembership(struct trackDb *tdb); // Returns subtrack membership if already known, else NULL void tdbExtrasMembershipSet(struct trackDb *tdb,struct _membership *membership); // Sets the subtrack membership for later retrieval. char *tdbBigFileName(struct sqlConnection *conn, struct trackDb *tdb); // Return file name associated with bigWig. Do a freeMem on returned string when done. boolean rTdbTreeCanPack(struct trackDb *tdb); // Trees can pack as all or none, since they can share vis. void tdbSetCartVisibility(struct trackDb *tdb, struct cart *cart, char *vis); // Set visibility in the cart. Handles all the complications necessary for subtracks. @@ -646,17 +678,20 @@ INLINE boolean tdbIsBedGraph(struct trackDb *tdb) // Return TRUE if tdb corresponds to a bedGraph track. { return startsWithWord("bedGraph", tdb->type); } boolean trackDbSettingBlocksConfiguration(struct trackDb *tdb, boolean onlyAjax); // Configuration dialogs may be explicitly blocked in tracDb settings struct slPair *trackDbMetaPairs(struct trackDb *tdb); /* Read in metadata given a trackDb entry. This routine understands the three ways * that metadata can be represented in a trackDb stanza: "metadata" lines per stanza, * or a tab-separated or tagStorm file with a foreign key specified by the "meta" tag. */ + +char *trackDbViewSetting(struct trackDb *tdb, char *name); +/* Return view setting from tdb, but *not* any of it's parents. */ #endif /* TRACKDB_H */