cecb86921e82170f093e65592dfcd6bc8f292e80 braney Tue Sep 10 12:53:16 2013 -0700 first pass at making dup bars in snakes into rainhows diff --git src/hg/hgTracks/snakeTrack.c src/hg/hgTracks/snakeTrack.c index cfe884b..e6c8be6 100644 --- src/hg/hgTracks/snakeTrack.c +++ src/hg/hgTracks/snakeTrack.c @@ -583,42 +583,51 @@ else { if(drawNameInverted) { hvGfxBox(hvg, textX - 1, y, nameWidth+1, tg->heightPer-1, color); hvGfxTextRight(hvg, textX, y, nameWidth, tg->heightPer, MG_WHITE, font, name); } else hvGfxTextRight(hvg, textX, y, nameWidth, tg->heightPer, labelColor, font, name); } } // let's draw some blue bars for the duplications struct hal_target_dupe_list_t* dupeList = lf->dupeList; -for(; dupeList ; dupeList = dupeList->next) +extern void makeChromosomeShades(struct hvGfx *hvg); +if (!chromosomeColorsMade) + makeChromosomeShades(hvg); + +int count = 7; +for(; dupeList ; dupeList = dupeList->next, count += 3) { struct hal_target_range_t *range = dupeList->tRange; + +#define NUM_CHROM_COLORS 26 + extern Color chromColor[NUM_CHROM_COLORS+1]; + Color color = chromColor[(count % NUM_CHROM_COLORS) + 1]; for(; range; range = range->next) { int s = range->tStart; int e = range->tStart + range->size; int sClp = (s < winStart) ? winStart : s; int eClp = (e > winEnd) ? winEnd : e; int x1 = round((sClp - winStart)*scale) + xOff; int x2 = round((eClp - winStart)*scale) + xOff; - hvGfxLine(hvg, x1, y , x2, y , MG_BLUE); + hvGfxLine(hvg, x1, y , x2, y , color); } } y+=2; // now we're going to draw the boxes s = sf->start; int lastE = -1; int lastS = -1; int offY = y; int lineHeight = tg->lineHeight ; int tStart, tEnd, qStart; int qs, qe; int heightPer = tg->heightPer; int lastX = -1,lastY = y;