0fb9ea11db0d8d8e017cc26769cbf6a1b8ede4cc max Fri Mar 23 16:42:59 2012 -0700 changing track configs according to tims instructions diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index 16b6743..63fd27f 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -121,31 +121,30 @@ #include "nonCodingUi.h" #include "transMapTracks.h" #include "retroTracks.h" #include "pcrResult.h" #include "variome.h" #endif /* GBROWSE */ #ifdef LOWELAB #include "loweLabTracks.h" #include "rnaPLFoldTrack.h" #endif /* LOWELAB */ #ifdef LOWELAB_WIKI #include "wiki.h" #endif /* LOWELAB_WIKI */ - #define CHROM_COLORS 26 int colorBin[MAXPIXELS][256]; /* count of colors for each pixel for each color */ /* Declare our color gradients and the the number of colors in them */ Color shadesOfGreen[EXPR_DATA_SHADES]; Color shadesOfRed[EXPR_DATA_SHADES]; Color shadesOfBlue[EXPR_DATA_SHADES]; Color shadesOfYellow[EXPR_DATA_SHADES]; Color shadesOfGreenOnWhite[EXPR_DATA_SHADES]; Color shadesOfRedOnWhite[EXPR_DATA_SHADES]; Color shadesOfBlueOnWhite[EXPR_DATA_SHADES]; Color shadesOfYellowOnWhite[EXPR_DATA_SHADES]; Color shadesOfRedOnYellow[EXPR_DATA_SHADES]; Color shadesOfBlueOnYellow[EXPR_DATA_SHADES]; Color orangeColor = 0; @@ -12192,36 +12191,37 @@ stripChar(author, ';'); if (isEmpty(author)) author = "NoAuthor"; if (isEmpty(year)) year = "NoYear"; authorYear = catTwoStrings(author, year); return authorYear; } static struct pubsExtra *pubsMakeExtra(char* articleTable, struct sqlConnection* conn, struct linkedFeatures* lf) { char query[LARGEBUF]; -safef(query, sizeof(query), "SELECT authors, year, title FROM %s WHERE articleId = '%s'", - articleTable, lf->name); struct sqlResult *sr = NULL; char **row = NULL; -sr = sqlGetResult(conn, query); struct pubsExtra *extra = NULL; + +safef(query, sizeof(query), "SELECT authors, year, title FROM %s WHERE articleId = '%s'", + articleTable, lf->name); +sr = sqlGetResult(conn, query); if ((row = sqlNextRow(sr)) != NULL) { char* authors = row[0]; char* year = row[1]; char* title = row[2]; extra = needMem(sizeof(struct pubsExtra)); extra->label = pubsFeatureLabel(authors, year); if (isEmpty(title)) extra->mouseOver = extra->label; else extra->mouseOver = cloneString(title); } sqlFreeResult(&sr); @@ -12242,32 +12242,32 @@ struct linkedFeatures *lf = NULL; struct sqlConnection *conn = hAllocConn(database); for (lf = tg->items; lf != NULL; lf = lf->next) { struct pubsExtra* extra = pubsMakeExtra(articleTable, conn, lf); lf->extra = extra; } hFreeConn(&conn); } static void pubsLoadKeywordYearItems(struct track *tg) /* load items that fulfill keyword and year filter */ { struct sqlConnection *conn = hAllocConn(database); -char *keywords = cartOptionalString(cart, "pubsKeywords"); -char *yearFilter = cartOptionalString(cart, "pubsYear"); +char *keywords = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "pubsKeywords"); +char *yearFilter = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "pubsYear"); char *articleTable = pubsArticleTable(tg); if(yearFilter == NULL || sameWord(yearFilter, "anytime")) yearFilter = NULL; if(isNotEmpty(keywords)) keywords = makeMysqlMatchStr(sqlEscapeString(keywords)); if(isEmpty(yearFilter) && isEmpty(keywords)) { loadGappedBed(tg); } else { char* oldLabel = tg->longLabel; @@ -12405,55 +12405,58 @@ /* use previously saved itemName for the mouseOver */ { struct linkedFeatures *lf = item; genericMapItem(tg, hvg, item, lf->extra, lf->extra, start, end, x, y, width, height); } static struct hash* pubsLookupSequences(struct track *tg, struct sqlConnection* conn, char* articleId, bool getSnippet) /* create a hash with a mapping annotId -> snippet or annotId -> shortSeq for an articleId*/ { char query[LARGEBUF]; char *sequenceTable = trackDbRequiredSetting(tg->tdb, "pubsSequenceTable"); char *selectValSql = NULL; if (getSnippet) - selectValSql = "replace(replace(snippet, \"<B>\", \"-->\"), \"</B>\", \"<--\")"; + selectValSql = "replace(replace(snippet, \"<B>\", \"\\n>>> \"), \"</B>\", \" <<<\\n\")"; else selectValSql = "concat(substr(sequence,1,4),\"...\",substr(sequence,-4))"; safef(query, sizeof(query), "SELECT annotId, %s FROM %s WHERE articleId='%s' ", selectValSql, sequenceTable, articleId); struct hash *seqIdHash = sqlQuickHash(conn, query); //freeMem(sequenceTable); // XX Why does this crash?? return seqIdHash; } static char *pubsArticleDispId(struct track *tg, struct sqlConnection *conn, char* articleId) /* given an articleId, lookup author and year and create <author><year> label for it */ { char* dispLabel = NULL; char *articleTable = pubsArticleTable(tg); char query[LARGEBUF]; safef(query, sizeof(query), "SELECT authors, year FROM %s WHERE articleId = '%s'", articleTable, articleId); struct sqlResult *sr = sqlGetResult(conn, query); if (sr!=NULL) { char **row = NULL; row = sqlNextRow(sr); + if (row != NULL) dispLabel = pubsFeatureLabel(row[0], row[1]); + else + dispLabel = articleId; } else dispLabel = articleId; sqlFreeResult(&sr); return dispLabel; } static void pubsPslLoadItems(struct track *tg) /* load only psl items from a single article */ { // get articleId to filter on char *articleId = cartOptionalString(cart, PUBSFILTERNAME); if (articleId==NULL) return;