bb6cbc4c704b4ac80459f85e5a43e648dbd465a1 hiram Thu Aug 8 11:56:56 2013 -0700 fixup function declaration format to match kent style refs #11384 diff --git src/hg/hgTracks/joinedRmskTrack.c src/hg/hgTracks/joinedRmskTrack.c index 16b11a7..20d3fd2 100644 --- src/hg/hgTracks/joinedRmskTrack.c +++ src/hg/hgTracks/joinedRmskTrack.c @@ -71,36 +71,35 @@ * help table in joinedRmskTrack.html */ static Color jRepeatClassColors[] = { 0xff0000ff, // SINE - red 0xff00ff00, // LINE - lime 0xff000080, // LTR - maroon 0xffff00ff, // DNA - fuchsia 0xff00ffff, // Simple - yellow 0xff008080, // LowComplex - olive 0xffff0000, // Satellite - blue 0xff008000, // RNA - green 0xff808000, // Other - teal 0xffffff00, // Unknown - aqua }; +static int cmpRepeatVisStart(const void *va, const void *vb) /* Sort repeats by display start position. Note: We * account for the fact we may not start the visual * display at chromStart. See MAX_UNALIGNED_LEN. */ -static int -cmpRepeatVisStart(const void *va, const void *vb) { const struct rmskJoined *a = *((struct rmskJoined **) va); const struct rmskJoined *b = *((struct rmskJoined **) vb); int aStart = a->chromStart; if (a->blockSizes[0] > MAX_UNALIGNED_LEN) aStart = a->chromStart + (a->blockSizes[0] - MAX_UNALIGNED_LEN); int bStart = b->chromStart; if (b->blockSizes[0] > MAX_UNALIGNED_LEN) bStart = b->chromStart + (b->blockSizes[0] - MAX_UNALIGNED_LEN); return (aStart - bStart); } /* Initialize the track */ static void makeJRepeatItems(struct track *tg) /* Initialize the subtracks hash - This will eventually contain @@ -226,114 +225,108 @@ (cr->blockSizes[cr->blockCount - 1] - MAX_UNALIGNED_LEN); } else { prev = rm; rm = rm->next; } } // while ( rm ) } // while ( detailList ) // Create Hash Entry hashReplace(extraData->subTracksHash, tg->table, st); } // if ( st ) } // if ( tg->visibility == tvFull } -static void -jRepeatFree(struct track *tg) +static void jRepeatFree(struct track *tg) /* Free up jRepeatMasker items. */ { slFreeList(&tg->items); } -static char * -jRepeatName(struct track *tg, void *item) +static char * jRepeatName(struct track *tg, void *item) /* Return name of jRepeat item track. */ { static char empty = '\0'; struct repeatItem *ri = item; /* * In detail view mode the items represent different packing * levels. No need to display a label at each level. Instead * Just return a label for the first level. */ if (tg->limitedVis == tvFull && winBaseCount <= REPEAT_DETAIL_VIEW) { if (strcmp(ri->className, "SINE") == 0) { return ("Repeats"); } else { return ∅ } } return ri->className; } -int -jRepeatTotalHeight(struct track *tg, enum trackVisibility vis) +static int jRepeatTotalHeight(struct track *tg, enum trackVisibility vis) { struct itemSpecifics *extraData = tg->extraUiData; // Are we in full view mode and at the scale needed to display // the detail view? if (tg->limitedVis == tvFull && winBaseCount <= REPEAT_DETAIL_VIEW) { // Lookup the depth of this subTrack and report it struct subTrack *st = hashFindVal(extraData->subTracksHash, tg->table ); if ( st ) return ( (st->levelCount+1) * 24 ); else // Just display one line return ( 24 ); } else return tgFixedTotalHeightNoOverflow(tg, vis); } -int -jRepeatItemHeight(struct track *tg, void *item) +static int jRepeatItemHeight(struct track *tg, void *item) { // Are we in full view mode and at the scale needed to display // the detail view? if (tg->limitedVis == tvFull && winBaseCount <= REPEAT_DETAIL_VIEW) return 24; else return tgFixedItemHeight(tg, item); } -static void -drawDashedHorizLine(struct hvGfx *hvg, int x1, int x2, +static void drawDashedHorizLine(struct hvGfx *hvg, int x1, int x2, int y, int dashLen, int gapLen, Color lineColor) // ie. - - - - - - - - - - - - - - - - { int cx1 = x1; int cx2; while (1) { cx2 = cx1 + dashLen; if (cx2 > x2) cx2 = x2; hvGfxLine(hvg, cx1, y, cx2, y, lineColor); cx1 += (dashLen + gapLen); if (cx1 > x2) break; } } -static void -drawShortDashedHorizLine(struct hvGfx *hvg, int x1, int x2, +static void drawShortDashedHorizLine(struct hvGfx *hvg, int x1, int x2, int y, int dashLen, int gapLen, Color lineColor) // ie. - - - - - - -\\- - - - - - - - - { int cx1 = x1; int cx2; int midX = ((x2 - x1) / 2) + x1; int midPointDrawn = 0; while (1) { cx2 = cx1 + dashLen; if (cx2 > x2) cx2 = x2; @@ -353,56 +346,54 @@ if (!midPointDrawn && cx1 + gapLen > midX) { // Draw double slashes "\\" instead of gap hvGfxLine(hvg, cx1, y - 3, cx1 + 3, y + 3, lineColor); hvGfxLine(hvg, cx1 + 3, y - 3, cx1 + 6, y + 3, lineColor); midPointDrawn = 1; } cx1 += gapLen; if (cx1 > x2) break; } } -static void -drawNormalBox(struct hvGfx *hvg, int x1, int y1, +static void drawNormalBox(struct hvGfx *hvg, int x1, int y1, int width, int height, Color fillColor, Color outlineColor) { struct gfxPoly *poly = gfxPolyNew(); int y2 = y1 + height; int x2 = x1 + width; /* * 1,5--------------2 * | | * | | * | | * 4--------------3 */ gfxPolyAddPoint(poly, x1, y1); gfxPolyAddPoint(poly, x2, y1); gfxPolyAddPoint(poly, x2, y2); gfxPolyAddPoint(poly, x1, y2); gfxPolyAddPoint(poly, x1, y1); hvGfxDrawPoly(hvg, poly, fillColor, TRUE); hvGfxDrawPoly(hvg, poly, outlineColor, FALSE); gfxPolyFree(&poly); } -static void -drawTailBox(struct hvGfx *hvg, int x1, int y1, +static void drawTailBox(struct hvGfx *hvg, int x1, int y1, int width, int height, Color fillColor, Color outlineColor, char strand) { struct gfxPoly *poly = gfxPolyNew(); int y2 = y1 + height; int x2 = x1 + width; int half = (y2 - y1) / 2; if (strand == '-') { /* * 1,6-------------2 * | / * | 3 * | \ @@ -424,32 +415,31 @@ * / | * 4---------------3 */ gfxPolyAddPoint(poly, x1, y1); gfxPolyAddPoint(poly, x2, y1); gfxPolyAddPoint(poly, x2, y2); gfxPolyAddPoint(poly, x1, y2); gfxPolyAddPoint(poly, x1 + half, y1 + half); gfxPolyAddPoint(poly, x1, y1); } hvGfxDrawPoly(hvg, poly, fillColor, TRUE); hvGfxDrawPoly(hvg, poly, outlineColor, FALSE); gfxPolyFree(&poly); } -static void -drawPointBox(struct hvGfx *hvg, int x1, int y1, +static void drawPointBox(struct hvGfx *hvg, int x1, int y1, int width, int height, Color fillColor, Color outlineColor, char strand) { struct gfxPoly *poly = gfxPolyNew(); int y2 = y1 + height; int x2 = x1 + width; int half = (y2 - y1) / 2; if (strand == '-') { /* * 1,6-------------2 * / | * 5 | * \ | @@ -471,32 +461,31 @@ * | / * 5--------------4 */ gfxPolyAddPoint(poly, x1, y1); gfxPolyAddPoint(poly, x2 - half, y1); gfxPolyAddPoint(poly, x2, y1 + half); gfxPolyAddPoint(poly, x2 - half, y2); gfxPolyAddPoint(poly, x1, y2); gfxPolyAddPoint(poly, x1, y1); } hvGfxDrawPoly(hvg, poly, fillColor, TRUE); hvGfxDrawPoly(hvg, poly, outlineColor, FALSE); gfxPolyFree(&poly); } -static void -drawDirBox(struct hvGfx *hvg, int x1, int y1, int width, int height, +static void drawDirBox(struct hvGfx *hvg, int x1, int y1, int width, int height, Color fillColor, Color outlineColor, char strand) { struct gfxPoly *poly = gfxPolyNew(); int y2 = y1 + height; int x2 = x1 + width; int half = (y2 - y1) / 2; if (strand == '-') { /* * 1,7-------------2 * / / * 6 3 * \ \ * 5-------------4 @@ -569,32 +558,31 @@ * * blockSizes: As you would expect. * * Here is an example: * ie. * A forward strand RM annotation from chr1:186-196 * which is aligned to a 100 bp repeat from 75-84 * in the consensus would be represented as: * * chromStart: 111 * chromEnd: 212 * blockRelStarts: -1, 75, -1 * blockSizes: 75, 10, 16 * */ -static void -drawRMGlyph(struct hvGfx *hvg, int y, int heightPer, +static void drawRMGlyph(struct hvGfx *hvg, int y, int heightPer, int width, int baseWidth, int xOff, struct rmskJoined *rm, struct itemSpecifics *extraData) { int idx; int lx1, lx2; int cx1, cx2; int w; struct repeatItem *ri; /* * heightPer is the God given height of a single * track item...respect your overlord. */ int alignedBlockHeight = heightPer * 0.5; int alignedBlockOffset = heightPer - alignedBlockHeight; int unalignedBlockHeight = heightPer * 0.75; @@ -922,32 +910,31 @@ cx2 = roundingScale(rm->chromStart + rm->blockRelStarts[idx + 1] - winStart, width, baseWidth) + xOff; hvGfxLine(hvg, cx2, y + alignedBlockOffset, lx2, y + unalignedBlockOffset, black); } } } } } /* This is the original repeat drawing routine, modified * to handle the new rmskJoined table structure. */ -static void -origRepeatDraw(struct track *tg, int seqStart, int seqEnd, +static void origRepeatDraw(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont * font, Color color, enum trackVisibility vis) { struct itemSpecifics *extraData = tg->extraUiData; int baseWidth = seqEnd - seqStart; struct repeatItem *ri; int y = yOff; int heightPer = tg->heightPer; int lineHeight = tg->lineHeight; int x1, x2, w; boolean isFull = (vis == tvFull); Color col; struct sqlConnection *conn = hAllocConn(database); struct sqlResult *sr = NULL; char **row; @@ -1077,32 +1064,31 @@ w = 1; hvGfxBox(hvg, x1, yOff, w, heightPer, MG_BLACK); } } } } dyStringFree(&query); } sqlFreeResult(&sr); hFreeConn(&conn); } /* Main callback for displaying this track in the viewport * of the browser. */ -static void -jRepeatDraw(struct track *tg, int seqStart, int seqEnd, +static void jRepeatDraw(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont * font, Color color, enum trackVisibility vis) { struct itemSpecifics *extraData = tg->extraUiData; int baseWidth = seqEnd - seqStart; /* * Its unclear to me why heightPer is not updated to the * value set in jRepeatItemHeight() at the time this callback * is invoked. Getting the correct value myself. * was: * int heightPer = tg->heightPer; */ int heightPer = jRepeatItemHeight(tg, NULL); boolean isFull = (vis == tvFull); struct rmskJoined *rm; @@ -1144,30 +1130,29 @@ tg->track, rm->id, statusLine); rm = rm->next; } level += heightPer; rmskJoinedFreeList(&(st->levels[currLevel])); } } else { // Draw the stereotypical view origRepeatDraw(tg, seqStart, seqEnd, hvg, xOff, yOff, width, font, color, vis); } } -void -jRepeatMethods(struct track *tg) +void jRepeatMethods(struct track *tg) { tg->loadItems = jRepeatLoad; tg->freeItems = jRepeatFree; tg->drawItems = jRepeatDraw; tg->colorShades = shadesOfGray; tg->itemName = jRepeatName; tg->mapItemName = jRepeatName; tg->totalHeight = jRepeatTotalHeight; tg->itemHeight = jRepeatItemHeight; tg->itemStart = tgItemNoStart; tg->itemEnd = tgItemNoEnd; tg->mapsSelf = TRUE; }