2b0605543d897a5fb6a6139f6a107742daeb3e67 braney Sat May 26 17:01:37 2012 -0700 add ability to highlight linkedFeatures with a colored box around the existing boxes. Will be used by Mark to highlight Gencode genes that satisfy filtering requirements. diff --git src/hg/hgTracks/cds.c src/hg/hgTracks/cds.c index 10a3b52..4b4c50d 100644 --- src/hg/hgTracks/cds.c +++ src/hg/hgTracks/cds.c @@ -1459,48 +1459,81 @@ /* Draw codon/base-colored item. */ { char codon[64] = " "; Color color = colorAndCodonFromGrayIx(hvg, codon, grayIx, originalColor); if (sf->codonIndex) safef(codon, sizeof(codon), "%c %d", codon[0], sf->codonIndex); /* When we are zoomed out far enough so that multiple bases/codons share the * same pixel, we have to draw differences in a separate pass (baseColorOverdrawDiff) * so don't waste time drawing the differences here: */ boolean zoomedOutToPostProcessing = ((drawOpt == baseColorDrawDiffBases && !zoomedToBaseLevel) || (drawOpt == baseColorDrawDiffCodons && !zoomedToCdsColorLevel)); if (drawOpt == baseColorDrawGenomicCodons && (e-s <= 3)) { + if (lf->highlightColor) + { + drawScaledBoxSample(hvg, s, e, scale, xOff, y, heightPer, + lf->highlightColor, lf->score ); + drawScaledBoxSampleWithText(hvg, s, e, scale, xOff, y+1, heightPer-2, + color, lf->score, font, codon, + zoomedToCodonLevel, winStart, maxPixels, TRUE, !sf->codonIndex); + } + else + { drawScaledBoxSampleWithText(hvg, s, e, scale, xOff, y, heightPer, color, lf->score, font, codon, zoomedToCodonLevel, winStart, maxPixels, TRUE, !sf->codonIndex); } + } else if (mrnaSeq != NULL && (psl != NULL || sf != NULL) && !zoomedOutToPostProcessing && drawOpt != baseColorDrawGenomicCodons && drawOpt != baseColorDrawOff) { + if (lf->highlightColor) + { + drawScaledBoxSample(hvg, s, e, scale, xOff, y, heightPer, + lf->highlightColor, lf->score ); + drawDiffTextBox(hvg, xOff+1, y+1, scale, heightPer-2, font, + color, chromName, s, e, sf, psl, mrnaSeq, lf, + grayIx, drawOpt, maxPixels, + tg->colorShades, originalColor); + } + else + { drawDiffTextBox(hvg, xOff, y, scale, heightPer, font, color, chromName, s, e, sf, psl, mrnaSeq, lf, grayIx, drawOpt, maxPixels, tg->colorShades, originalColor); } + } else { /* revert to normal coloring */ + if (lf->highlightColor) + { drawScaledBoxSample(hvg, s, e, scale, xOff, y, heightPer, + lf->highlightColor, lf->score ); + drawScaledBoxSample(hvg, s, e, scale, xOff+1, y+1, heightPer -2, color, lf->score ); } + else + { + drawScaledBoxSample(hvg, s, e, scale, xOff, y, heightPer, + color, lf->score ); + } + } } static void drawCdsDiffCodonsOnly(struct track *tg, struct linkedFeatures *lf, struct hvGfx *hvg, int xOff, int y, double scale, int heightPer, struct dnaSeq *mrnaSeq, struct psl *psl, int winStart) /* Draw red boxes only where mRNA codons differ from genomic. This assumes * that lf has been drawn already, we're zoomed out past zoomedToCdsColorLevel, * we're not in dense mode etc. */ { struct simpleFeature *sf = NULL; Color dummyColor = 0;