1217988d31947663be0f94309c9e8dbc9867b06e kate Wed Jun 28 08:22:50 2017 -0700 Fix problem with thresholding. refs #15646 diff --git src/hg/hgTracks/gtexEqtlClusterTrack.c src/hg/hgTracks/gtexEqtlClusterTrack.c index dd9861c..26c178a 100644 --- src/hg/hgTracks/gtexEqtlClusterTrack.c +++ src/hg/hgTracks/gtexEqtlClusterTrack.c @@ -46,65 +46,66 @@ if (cluster->expCount == 1) { dyStringPrintf(ds, "%s in %s", cluster->target, cluster->expNames[0]); } else { dyStringPrintf(ds, "%s in %d tissues", cluster->target, cluster->expCount); } return dyStringCannibalize(&ds); } static Color gtexEqtlClusterItemColor(struct track *track, void *item, struct hvGfx *hvg) /* Color by highest effect in list (blue -, red +), with brighter for higher effect (teal, fuschia) */ { struct gtexEqtlCluster *cluster = (struct gtexEqtlCluster *)item; -int maxEffect = 0; +double maxEffect = 0.0; int i; for (i=0; i<cluster->expCount; i++) { - int effect = ceil(cluster->expScores[i]); - if (abs(effect) > abs(maxEffect)) + double effect = cluster->expScores[i]; + if (fabs(effect) > fabs(maxEffect)) maxEffect = effect; } -int cutoff = 2; -if (maxEffect < 0) +double cutoff = 2.0; +if (maxEffect < 0.0) { /* down-regulation displayed as blue */ - if (maxEffect < 0 - cutoff) + if (maxEffect < 0.0 - cutoff) return MG_CYAN; return MG_BLUE; } /* up-regulation displayed as red */ if (maxEffect > cutoff) return MG_MAGENTA; return MG_RED; } static void gtexEqtlClusterMapItem(struct track *tg, struct hvGfx *hvg, void *item, char *itemName, char *mapItemName, int start, int end, int x, int y, int width, int height) /* Create a map box on item and label with list of tissues with colors and effect size */ { char *title = itemName; //uglyf("<br>title: %s\n", title); if (tg->limitedVis != tvDense) { // construct list of tissues with colors and effect sizes for mouseover struct gtexEqtlCluster *eqtl = (struct gtexEqtlCluster *)item; //struct gtexEqtlClusterTrack *extras = (struct gtexEqtlClusterTrack *)tg->extraUiData; //struct hash *tissueHash = extras->tissueHash; struct dyString *ds = dyStringNew(0); + dyStringPrintf(ds, "%s/%s: ", eqtl->name, eqtl->target); int i; for (i=0; i<eqtl->expCount; i++) { double effect= eqtl->expScores[i]; dyStringPrintf(ds, "%s(%s%0.2f)%s", eqtl->expNames[i], effect < 0 ? "" : "+", effect, i < eqtl->expCount - 1 ? ", " : ""); //struct gtexTissue *tis = (struct gtexTissue *)hashFindVal(tissueHash, eqtl->expNames[i]); //unsigned color = tis ? tis->color : 0; // BLACK //char *name = tis ? tis->name : "unknown"; //#dyStringPrintf(ds,"<tr><td style='color: #%06X;'>*</td><td>%s</td><td>%s%0.2f</td></tr>\n", //color, name, effect < 0 ? "" : "+", effect); } title = dyStringCannibalize(&ds); } //uglyf("<br>title2: %s\n", title);