018505887b2ec414e3a30419422a9b2c61f8f5c3 markd Thu Aug 9 00:23:28 2012 -0700 fixed breaking control over gene labels when gencode track was refactored diff --git src/hg/hgTracks/gencodeTracks.c src/hg/hgTracks/gencodeTracks.c index 9468416..aa14cb4 100644 --- src/hg/hgTracks/gencodeTracks.c +++ src/hg/hgTracks/gencodeTracks.c @@ -13,42 +13,30 @@ * do repeated queries. */ { struct dyString *fields; // select fields struct dyString *from; // from clause struct dyString *where; // where clause int nextFieldCol; // next available column in result row int supportLevelCol; // support level column if joined for highlighting, or -1 int transcriptTypeCol; // transcript type column if joined for highlighting, or -1 filterBy_t *supportLevelHighlight; // choices for support level highlighting if not NULL filterBy_t *transcriptTypeHighlight; // choices for transcript type highlighting if not NULL boolean joinAttrs; // join the wgEncodeGencodeAttrs table boolean joinTransSrc; // join the wgEncodeGencodeTranscriptSource table boolean joinSupportLevel; // join the wgEncodeGencodeTranscriptionSupportLevel table }; -#if 0// FIXME -/* function used to get hightlight color for an item */ -typedef Color (highlightFunc*)(struct highlightColoring coloring, struct linkedFeatures *lf); - -struct highlightColoring -/* object that lets us try different coloring options. */ -{ - Color color; // constant color - highlightFunc highlighter; // callback function to generate color -} -#endif - static struct gencodeQuery *gencodeQueryNew(void) /* construct a new gencodeQuery object */ { struct gencodeQuery *gencodeQuery; AllocVar(gencodeQuery); gencodeQuery->fields = dyStringNew(0); gencodeQuery->from = dyStringNew(0); gencodeQuery->where = dyStringNew(0); gencodeQuery->supportLevelCol = -1; gencodeQuery->transcriptTypeCol = -1; return gencodeQuery; } static void gencodeQueryFree(struct gencodeQuery **gencodeQueryPtr) /* construct a new gencodeQuery object */ @@ -68,44 +56,30 @@ static void gencodeQueryBeginSubWhere(struct gencodeQuery *gencodeQuery) /* begin adding new where sub-clause */ { if (dyStringLen(gencodeQuery->where) > 0) dyStringAppend(gencodeQuery->where, " and "); dyStringAppend(gencodeQuery->where, "("); } static void gencodeQueryEndSubWhere(struct gencodeQuery *gencodeQuery) /* finish adding new where sub-clause */ { dyStringAppend(gencodeQuery->where, ")"); } -#if 0 // FIXME -static Color highlightColorConstant(struct highlightColoring coloring, struct linkedFeatures *lf) -/* get a constant highlight color */ -{ -return coloring.color; -} - -static Color highlightColorContrast(struct highlightColoring coloring, struct linkedFeatures *lf) -/* get compute a highlight color that is high-contrast */ -{ -return coloring.color; -} -#endif - static char *tslSymToNumStr(char *tslSym) /* convert a transcription support level string (tsl1..tsl5, tslN), to * a numeric string ("1".."5", "-1") */ { if (sameString(tslSym, "tslNA")) return "-1"; else return tslSym+3; } static char *tslNumStrToSym(char *tslNum) /* convert a transcription support level numeric string ("1".."5", "-1:) * to a symbol (tsl1..tsl5, tslN). WARNING: static return */ { static char buf[8]; @@ -373,36 +347,38 @@ static void loadGencodeGenePreds(struct track *tg) /* Load genePreds in window info linked feature, with filtering, etc. */ { struct gencodeQuery *gencodeQuery = gencodeQueryConstruct(tg); struct sqlConnection *conn = hAllocConn(database); struct sqlResult *sr = gencodeMakeQuery(conn, gencodeQuery); struct linkedFeatures *lfList = NULL; unsigned highlightColor = getHighlightColor(tg); char **row; while ((row = sqlNextRow(sr)) != NULL) slAddHead(&lfList, loadGencodeGenePred(tg, gencodeQuery, row, highlightColor)); sqlFreeResult(&sr); hFreeConn(&conn); gencodeQueryFree(&gencodeQuery); +genePredAssignConfiguredName(tg); if (tg->visibility != tvDense) slSort(&lfList, linkedFeaturesCmpStart); else slReverse(&lfList); tg->items = lfList; +genePredAssignConfiguredName(tg); } static char *gencodeGeneName(struct track *tg, void *item) /* Get name to use for Gencode gene item. */ { struct linkedFeatures *lf = item; if (lf->extra != NULL) return lf->extra; else return lf->name; } static void gencodeGeneMethods(struct track *tg) /* Load up custom methods for ENCODE Gencode gene track */ {