9b26d149e1b358d2ad03390762261baeb2602a7d braney Wed Jun 15 12:25:10 2022 -0700 add reverse complement support to sequence logo track diff --git src/hg/hgTracks/wigTrack.c src/hg/hgTracks/wigTrack.c index 16782fc..eb32f08 100644 --- src/hg/hgTracks/wigTrack.c +++ src/hg/hgTracks/wigTrack.c @@ -1175,30 +1175,31 @@ drawColor = tg->colorShades[grayInRange(grayIndex, 0, MAX_WIG_VALUE)]; doLine(image, x, yOff, tg->lineHeight, drawColor); } /* vis == tvDense || vis == tvSquish */ } /* if (preDraw[].count) */ } /* for (x1 = 0; x1 < width; ++x1) */ return(mouseOverData); } /* graphPreDraw() */ static struct wigMouseOver *logoPreDrawContainer(struct preDrawContainer *preDrawContainer, int preDrawZero, int width, struct track *tg, struct hvGfx *hvg, int xOff, int yOff, double graphUpperLimit, double graphLowerLimit, double graphRange, enum trackVisibility vis, struct wigCartOptions *wigCart, int seqStart, int seqEnd) { +boolean baseCmpl = cartUsualBooleanDb(cart, database, COMPLEMENT_BASES_VAR, FALSE); struct preDrawElement *preDraw = preDrawContainer->preDraw; struct wigGraphOutput *wgo = tg->wigGraphOutput; //struct wigMouseOver *mouseOverData = NULL; unsigned numBases = seqEnd - seqStart; struct dnaSeq *seq = hChromSeq(database, chromName, seqStart, seqEnd); struct pixelCountBin *pixelBins = wgo->pixelBins; double *yOffsets = wgo->yOffsets; int numTrack = wgo->numTrack; Color clipColor = MG_MAGENTA; WigVerticalLineVirtual vLine = wgo->vLine; void *image = wgo->image; #define doLine(image, x, y, height, color) {vLine(image, x, y, height, color); } int h = tg->lineHeight; /* the height of our drawing window */ double scaleFactor = h/graphRange; @@ -1266,34 +1267,34 @@ } } int boxHeight = max(1,abs(y1 - y0)); int boxTop = min(y1,y0); // positive data value exactly equal to Bottom pixel // make sure it draws at least a pixel there if (boxTop == h) boxTop = h - 1; if (tg->tdb->parent && startsWith("multiWig", trackDbSetting(tg->tdb->parent,"container"))) { switch(numTrack) { - case 3: base='a';break; - case 2: base='c';break; - case 1: base='g';break; - case 0: base='t';break; + case 3: if (baseCmpl) base='t'; else base='a';break; + case 2: if (baseCmpl) base='g'; else base='c';break; + case 1: if (baseCmpl) base='c'; else base='g';break; + case 0: if (baseCmpl) base='a'; else base='t';break; } } char string[2]; string[0] = toupper(base); string[1] = 0; MgFont *font = tl.font; int height = dataValue * scaleFactor; unsigned color = MG_BLACK; if (base == 'a') color = MG_RED; else if (base == 't') color = MG_GREEN; else if (base == 'c') color = MG_BROWN; else if (base == 'g')