03270520d98b7251dc50b75c1a2815f8f5de63ec kent Fri Jul 1 18:37:18 2022 -0700 Making ends with unmatched query just 2 pixels again. Need to fix some stuff before capping with anything more fancy. diff --git src/hg/hgTracks/cds.c src/hg/hgTracks/cds.c index b7e68ce..c6cbe98 100644 --- src/hg/hgTracks/cds.c +++ src/hg/hgTracks/cds.c @@ -321,69 +321,96 @@ cdsExonStart = gp->cdsStart; if (gp->cdsEnd > gp->txStart && cdsExonEnd > gp->cdsEnd) cdsExonEnd = gp->cdsEnd; for (j=0; j < (cdsExonEnd - cdsExonStart); j++) { retStr[thisN] = codonDna[cdsExonEnd-j-1-gp->exonStarts[i]]; thisN--; if (thisN < 0) break; } } } } +#ifdef UNUSED +#endif /* UNUSED */ static void drawVertLine(struct linkedFeatures *lf, struct hvGfx *hvg, int chromStart, int xOff, int y, int height, double scale, Color color) /* Draw a 1-pixel wide vertical line at the given chromosomal coord. * The line is 0 bases wide (chromStart==chromEnd) but that doesn't * matter if we're zoomed out to >1base/pixel, so this is OK for diffs * when zoomed way out and for insertion points at any scale. */ { int thisX = round((double)(chromStart-winStart)*scale) + xOff; int thisY = y; height -= 1; int thisHeight = height; if ((chromStart < lf->tallStart) || (chromStart > lf->tallEnd)) { /* adjust for UTR. WARNING: this duplicates shortOff & shortHeight * calculations in linkedFeaturesDrawAt */ thisY += height/4; thisHeight = height - height/2; } hvGfxBox(hvg, thisX-2, thisY, 4, thisHeight, color); } -#ifdef UNUSED -#endif /* UNUSED */ static void drawMidNumber(struct linkedFeatures *lf, struct hvGfx *hvg, int chromStart, int xOff, int y, int height, double scale, Color color, MgFont *font, int size) /* Draw a short string encoding size around chromStart */ /* Draw a 1-pixel wide vertical line at the given chromosomal coord. * The line is 0 bases wide (chromStart==chromEnd) but that doesn't * matter if we're zoomed out to >1base/pixel, so this is OK for diffs * when zoomed way out and for insertion points at any scale. */ { char sizeString[32]; safef(sizeString, sizeof(sizeString), "%d", size); drawScaledBoxLabel(hvg, chromStart-1, chromStart+1, scale, xOff, y, height, color, font, sizeString); } +#ifdef SOON +static void drawLeftNumber(struct linkedFeatures *lf, struct hvGfx *hvg, + int chromStart, int xOff, int y, + int height, double scale, Color color, MgFont *font, int size) +/* Draw a short string encoding size around chromStart */ +/* Draw a 1-pixel wide vertical line at the given chromosomal coord. + * The line is 0 bases wide (chromStart==chromEnd) but that doesn't + * matter if we're zoomed out to >1base/pixel, so this is OK for diffs + * when zoomed way out and for insertion points at any scale. */ +{ +drawMidNumber(lf, hvg, chromStart+1, xOff, y, height, scale, color, font, size); +} +#endif /* SOON */ + +#ifdef SOON +static void drawRightNumber(struct linkedFeatures *lf, struct hvGfx *hvg, + int chromStart, int xOff, int y, + int height, double scale, Color color, MgFont *font, int size) +/* Draw a short string encoding size around chromStart */ +/* Draw a 1-pixel wide vertical line at the given chromosomal coord. + * The line is 0 bases wide (chromStart==chromEnd) but that doesn't + * matter if we're zoomed out to >1base/pixel, so this is OK for diffs + * when zoomed way out and for insertion points at any scale. */ +{ +drawMidNumber(lf, hvg, chromStart-1, xOff, y, height, scale, color, font, size); +} +#endif /* SOON */ static void drawCdsDiffBaseTickmarksOnly(struct track *tg, struct linkedFeatures *lf, struct hvGfx *hvg, int xOff, int y, double scale, int heightPer, struct dnaSeq *qSeq, int qOffset, struct psl *psl, int winStart) /* Draw thin vertical red lines only where mRNA bases differ from genomic. * This assumes that lf has been drawn already, we're zoomed out past * zoomedToBaseLevel, we're not in dense mode etc. */ { struct simpleFeature *sf = NULL; char *winDna = getCachedDna(winStart, winEnd); Color c = cdsColor[CDS_STOP]; @@ -1890,31 +1917,31 @@ } } } if (indelShowQInsert) { int qStart = psl->qStarts[0]; if (qStart != 0 && !gotPolyAStart) { /* Insert at beginning of query -- draw vertical blue line * unless it's polyA. */ s = (psl->strand[1] == '-') ? (psl->tSize - psl->tStarts[0] - 1) : psl->tStarts[0]; Color color = cdsColor[CDS_QUERY_INSERTION_AT_END]; drawVertLine(lf, hvg, s, xOff, y, heightPer, scale, color); - drawMidNumber(lf, hvg, s, xOff, y, heightPer, scale, color, font, qStart); + // drawLeftNumber(lf, hvg, s, xOff, y, heightPer, scale, color, font, qStart); } for (i = 1; i < psl->blockCount; i++) { int qBlkStart = psl->qStarts[i]; int qPrevBlkEnd = (psl->qStarts[i-1] + psl->blockSizes[i-1]); if (qBlkStart > qPrevBlkEnd) { int tBlkStart = psl->tStarts[i]; int tPrevBlkEnd = (psl->tStarts[i-1] + psl->blockSizes[i-1]); /* Note: if tBlkStart < tPrevBlkEnd, then we have overlap on * target, possibly indicating a bug in the aligner. */ if (tBlkStart <= tPrevBlkEnd) { /* Insert in query only -- draw vertical orange line. */ s = (psl->strand[1] == '-') ? (psl->tSize - psl->tStarts[i] - 1) : @@ -1927,32 +1954,32 @@ /* Note: if qBlkStart < qPrevBlkEnd, then we have overlap on query, * possibly indicating a bug in the aligner. Most likely a gap * should be drawn in that case (really a target insert) but I don't * think this is the place to do it. Should be caught by * pre-screening table data for block coords that overlap. */ } int missingAtEnd = psl->qSize - (psl->qStarts[lastBlk] + psl->blockSizes[lastBlk]); if (missingAtEnd != 0 && !gotPolyAEnd) { /* Insert at end of query -- draw vertical blue line unless it's * all polyA. */ s = (psl->strand[1] == '-') ? (psl->tSize - (psl->tStarts[lastBlk] + psl->blockSizes[lastBlk])) : (psl->tStarts[lastBlk] + psl->blockSizes[lastBlk]); Color color = cdsColor[CDS_QUERY_INSERTION_AT_END]; + // drawRightNumber(lf, hvg, s, xOff, y, heightPer, scale, color, font, missingAtEnd); drawVertLine(lf, hvg, s, xOff, y, heightPer, scale, color); - drawMidNumber(lf, hvg, s, xOff, y, heightPer, scale, color, font, missingAtEnd); } } } void baseColorInitTrack(struct hvGfx *hvg, struct track *tg) /* Set up base coloring state (e.g. cache genomic sequence) for tg. * This must be called by tg->drawItems if baseColorDrawSetup is used * in tg->drawItemAt. Peeks at tg->drawItems method to determine whether * tg is linkedFeatures or linkedFeaturesSeries (currently the only * two supported track types -- bed, psl etc. are subclasses of these). */ { enum baseColorDrawOpt drawOpt = baseColorGetDrawOpt(tg); boolean indelShowDoubleInsert, indelShowQueryInsert, indelShowPolyA; indelEnabled(cart, (tg ? tg->tdb : NULL), basesPerPixel, &indelShowDoubleInsert, &indelShowQueryInsert, &indelShowPolyA);