4ba905abef170792a844b3e04f02fdd1ec87bb5d hiram Wed Feb 4 13:16:03 2015 -0800 turning off the new full mode and back to the three mode track refs #9741 diff --git src/hg/hgTracks/rmskJoinedTrack.c src/hg/hgTracks/rmskJoinedTrack.c index de7af0a..d3d8480 100644 --- src/hg/hgTracks/rmskJoinedTrack.c +++ src/hg/hgTracks/rmskJoinedTrack.c @@ -1,23 +1,26 @@ /* joinedRmskTrack - A comprehensive RepeatMasker visualization track * handler. This is an extension of the original * rmskTrack.c written by UCSC. * - * Written by Robert Hubley 10/2012-11/2014 + * Written by Robert Hubley 10/2012-01/2015 * * Modifications: * + * 1/2015 + * Request to revert back to only Full/Dense modes. + * * 11/2014 * Request for traditional pack/squish modes. * * 7/2014 * With the help of Jim Kent we modified the * glyph design to more closely resemble the * existing browser styles. */ /* Copyright (C) 2014 The Regents of the University of California * See README in this or parent directory for licensing information. */ #include "common.h" #include "hash.h" #include "linefile.h" @@ -226,32 +229,34 @@ */ { /* * Initialize the subtracks hash - This will eventually contain * all the repeat data for each displayed subtrack. */ if (!subTracksHash) subTracksHash = newHash(20); //tg->items = makeJRepeatItems(); makeJRepeatItems(); int baseWidth = winEnd - winStart; pixelsPerBase = (float) insideWidth / (float) baseWidth; -if ((tg->visibility == tvFull || tg->visibility == tvSquish || - tg->visibility == tvPack) && baseWidth <= DETAIL_VIEW_MAX_SCALE) +//Disabled +//if ((tg->visibility == tvFull || tg->visibility == tvSquish || +// tg->visibility == tvPack) && baseWidth <= DETAIL_VIEW_MAX_SCALE) +if (tg->visibility == tvFull && baseWidth <= DETAIL_VIEW_MAX_SCALE) { struct repeatItem *ri = NULL; struct subTrack *st = NULL; AllocVar(st); st->levelCount = 0; struct rmskJoined *rm = NULL; char **row; int rowOffset; struct sqlConnection *conn = hAllocConn(database); struct sqlResult *sr = hRangeQuery(conn, tg->table, chromName, winStart, winEnd, NULL, &rowOffset); struct rmskJoined *detailList = NULL; while ((row = sqlNextRow(sr)) != NULL) { @@ -278,32 +283,33 @@ rm = detailList; struct Extents *ext = NULL; ext = getExtents(cr); crChromStart = ext->start; crChromEnd = ext->end; if ( tg->visibility == tvFull ) { AllocVar(ri); ri->className = cr->name; slAddHead(&fullRIList, ri); } - // tvFull is one-per-line -- no need to group items in levels - if ( tg->visibility == tvSquish || tg->visibility == tvPack ) + //Disabled + //if ( tg->visibility == tvSquish || tg->visibility == tvPack ) + if ( tg->visibility == tvFull ) { while (rm) { ext = getExtents(rm); rmChromStart = ext->start; rmChromEnd = ext->end; if (rmChromStart > crChromEnd) { cr->next = rm; cr = rm; crChromStart = rmChromStart; crChromEnd = rmChromEnd; if (prev) prev->next = rm->next; @@ -335,72 +341,78 @@ /* Free up rmskJoinedMasker items. */ { slFreeList(&tg->items); } static char * rmskJoinedName(struct track *tg, void *item) /* Return name of rmskJoined 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->visibility == tvSquish || - tg->visibility == tvPack) && winBaseCount <= DETAIL_VIEW_MAX_SCALE) +//Disabled +//if ((tg->visibility == tvSquish || +// tg->visibility == tvPack) && winBaseCount <= DETAIL_VIEW_MAX_SCALE) +if (tg->visibility == tvFull && winBaseCount <= DETAIL_VIEW_MAX_SCALE) { if (strcmp(ri->className, "SINE") == 0) return("Repeats"); else return ∅ } return ri->className; } int rmskJoinedItemHeight(struct track *tg, void *item) { // Are we in full view mode and at the scale needed to display // the detail view? -if (tg->limitedVis == tvSquish && winBaseCount <= DETAIL_VIEW_MAX_SCALE ) - { - if ( tg->heightPer < (MINHEIGHT/2) ) - return (MINHEIGHT/2); - else - return tg->heightPer; - } -else if ((tg->limitedVis == tvFull || tg->limitedVis == tvPack) && winBaseCount <= DETAIL_VIEW_MAX_SCALE) +//Disabled +//if (tg->limitedVis == tvSquish && winBaseCount <= DETAIL_VIEW_MAX_SCALE ) +// { +// if ( tg->heightPer < (MINHEIGHT/2) ) +// return (MINHEIGHT/2); +// else +// return tg->heightPer; +// } +//else if ((tg->limitedVis == tvFull || tg->limitedVis == tvPack) && winBaseCount <= DETAIL_VIEW_MAX_SCALE) +if (tg->limitedVis == tvFull && winBaseCount <= DETAIL_VIEW_MAX_SCALE) { if ( tg->heightPer < MINHEIGHT ) return MINHEIGHT; else return tg->heightPer; } else { return tgFixedItemHeight(tg, item); } } int rmskJoinedTotalHeight(struct track *tg, enum trackVisibility vis) { // Are we in full view mode and at the scale needed to display // the detail view? -if ((tg->limitedVis == tvFull || tg->limitedVis == tvSquish || - tg->limitedVis == tvPack) && winBaseCount <= DETAIL_VIEW_MAX_SCALE) +//Disabled +//if ((tg->limitedVis == tvFull || tg->limitedVis == tvSquish || +// tg->limitedVis == tvPack) && winBaseCount <= DETAIL_VIEW_MAX_SCALE) +if (tg->limitedVis == tvFull && winBaseCount <= DETAIL_VIEW_MAX_SCALE) { // Lookup the depth of this subTrack and report it struct subTrack *st = hashFindVal(subTracksHash, tg->table); if (st) { tg->height = ((st->levelCount + 1) * rmskJoinedItemHeight(tg, NULL) ); return ((st->levelCount + 1) * rmskJoinedItemHeight(tg, NULL) ); } else { tg->height = rmskJoinedItemHeight(tg, NULL); return (rmskJoinedItemHeight(tg, NULL)); // Just display one line } } else @@ -789,41 +801,42 @@ else { lx1 = roundingScale(rm->chromStart - winStart, width, baseWidth) + xOff; // Line Across drawDashedHorizLine(hvg, lx1, lx2, y + unalignedBlockOffset, 5, 5, black); } // Line down hvGfxLine(hvg, lx2, y + alignedBlockOffset, lx2, y + unalignedBlockOffset, black); hvGfxLine(hvg, lx1, y + unalignedBlockOffset - 3, lx1, y + unalignedBlockOffset + 3, black); // Draw labels - if ( vis != tvSquish && vis != tvFull ) - { + //Disabled + //if ( vis != tvSquish && vis != tvFull ) + // { MgFont *font = tl.font; int fontHeight = tl.fontHeight; int stringWidth = mgFontStringWidth(font, rm->name) + LABEL_PADDING; hvGfxTextCentered(hvg, lx1 - stringWidth, heightPer - fontHeight + y, stringWidth, fontHeight, MG_BLACK, font, rm->name); - } + // } } else if (idx == (rm->blockCount - 1)) { /* * Unaligned sequence at the end of an annotation * Draw as: * -------------| or ------//------| * | | * >>>>> >>>>>>> */ lx1 = roundingScale(rm->chromStart + @@ -1011,32 +1024,33 @@ * to handle the new rmskJoined table structure. */ { int baseWidth = seqEnd - seqStart; struct repeatItem *ri; int y = yOff; int heightPer = tg->heightPer; int lineHeight = tg->lineHeight; int x1, x2, w; Color col; struct sqlConnection *conn = hAllocConn(database); struct sqlResult *sr = NULL; char **row; int rowOffset; - -if (vis == tvFull || vis == tvSquish || vis == tvPack) +//Disabled +//if (vis == tvFull || vis == tvSquish || vis == tvPack) +if (vis == tvFull) { /* * Do grayscale representation spread out among tracks. */ struct hash *hash = newHash(6); struct rmskJoined *ro; int percId; int grayLevel; for (ri = tg->items; ri != NULL; ri = ri->next) { ri->yOffset = y; y += lineHeight; hashAdd(hash, ri->class, ri); } @@ -1174,31 +1188,33 @@ pixelsPerBase = (float) width / (float) baseWidth; /* * Its unclear to me why heightPer is not updated to the * value set in rmskJoinedItemHeight() at the time this callback * is invoked. Getting the correct value myself. * was: * int heightPer = tg->heightPer; */ int heightPer = rmskJoinedItemHeight(tg, NULL); //boolean isFull = (vis == tvFull); struct rmskJoined *rm; // DEBUG REMOVE // If we are in full view mode and the scale is sufficient, // display the new visualization. -if ((vis == tvFull || vis == tvSquish || vis == tvPack) && baseWidth <= DETAIL_VIEW_MAX_SCALE) +//Disabled +//if ((vis == tvFull || vis == tvSquish || vis == tvPack) && baseWidth <= DETAIL_VIEW_MAX_SCALE) +if (vis == tvFull && baseWidth <= DETAIL_VIEW_MAX_SCALE) { int level = yOff; struct subTrack *st = hashFindVal(subTracksHash, tg->table); if (!st) return; int lidx = st->levelCount; int currLevel = 0; for (currLevel = 0; currLevel < lidx; currLevel++) { rm = st->levels[currLevel]; while (rm) { drawRMGlyph(hvg, level, heightPer, width, baseWidth, xOff, rm, vis ); @@ -1235,17 +1251,17 @@ } void rmskJoinedMethods(struct track *tg) { tg->loadItems = rmskJoinedLoadItems; tg->freeItems = rmskJoinedFreeItems; tg->drawItems = rmskJoinedDrawItems; tg->colorShades = shadesOfGray; tg->itemName = rmskJoinedName; tg->mapItemName = rmskJoinedName; tg->totalHeight = rmskJoinedTotalHeight; tg->itemHeight = rmskJoinedItemHeight; tg->itemStart = tgItemNoStart; tg->itemEnd = tgItemNoEnd; tg->mapsSelf = TRUE; -tg->canPack = TRUE; +//tg->canPack = TRUE; }