7e6bfce5ff65b67d6e75b239c8b7fb3270f475fb
kent
  Wed Jun 29 19:11:10 2022 -0700
Making baseColorDrawItem(), baseColorOverdrawDiff(), and baseColorOverdrawQInsert() functions to from mrnaSeq parameter to qSeq/qOffset parameter pair.  Currently qOffset is always zero, but have plans to use it so that not necessarily all of query sequence needs to be loaded.  qSeq may be a whole chromosome for a chain.

diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index 5d2f762..accaf40 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -3737,56 +3737,57 @@
 int intronGap = 0;
 boolean chainLines = ((vis != tvDense)&&(tg->subType == lfSubChain));
 int gapFactor = CHAIN_GAP_FACTOR;
 boolean hideLine = ((tg->subType == lfSubChain) ||
 	        ((vis == tvDense) && (tg->subType == lfSubXeno)));
 boolean hideArrows = hideLine;
 int midY = y + (heightPer>>1);
 int w;
 char *exonArrowsDense = trackDbSetting(tg->tdb, "exonArrowsDense");
 boolean exonArrowsEvenWhenDense = (exonArrowsDense != NULL &&
 				   !sameWord(exonArrowsDense, "off"));
 boolean exonArrows = (tg->exonArrows &&
 		      (vis != tvDense || exonArrowsEvenWhenDense));
 boolean exonArrowsAlways = tg->exonArrowsAlways;
 struct psl *psl = NULL;
-struct dnaSeq *mrnaSeq = NULL;
+struct dnaSeq *qSeq = NULL;
+int qOffset = 0;
 enum baseColorDrawOpt drawOpt = baseColorDrawOff;
 Color saveColor = color;
 boolean indelShowDoubleInsert, indelShowQueryInsert, indelShowPolyA;
 if (((vis == tvFull) || (vis == tvPack)) && (tg->subType == lfNoIntronLines))
     {
     hideLine = TRUE;
     hideArrows = FALSE;
     }
 indelEnabled(cart, tg->tdb, basesPerPixel, &indelShowDoubleInsert, &indelShowQueryInsert,
 	     &indelShowPolyA);
 if (indelShowDoubleInsert && !hideLine)
     {
     /* If enabled and we weren't already suppressing the default line,
      * show chain-like lines (single/double gap lines) but without the
      * chain track's gapFactor: */
     chainLines = TRUE;
     hideLine = TRUE;
     gapFactor = 0;
     }
 
 /*if we are zoomed in far enough, look to see if we are coloring
   by codon, and setup if so.*/
 if (vis != tvDense)
     {
-    drawOpt = baseColorDrawSetup(hvg, tg, lf, &mrnaSeq, &psl);
+    drawOpt = baseColorDrawSetup(hvg, tg, lf, &qSeq, &qOffset, &psl);
     if (drawOpt > baseColorDrawOff)
 	exonArrows = FALSE;
     }
 if ((tg->tdb != NULL) && (vis != tvDense))
     intronGap = atoi(trackDbSettingOrDefault(tg->tdb, "intronGap", "0"));
 
 lfColors(tg, lf, hvg, &color, &bColor);
 if (vis == tvDense && trackDbSetting(tg->tdb, EXP_COLOR_DENSE))
     color = saveColor;
 
 boolean baseColorNeedsCodons = (drawOpt == baseColorDrawItemCodons ||
 				drawOpt == baseColorDrawDiffCodons ||
 				drawOpt == baseColorDrawGenomicCodons);
 if (psl && baseColorNeedsCodons)
     {
@@ -3892,31 +3893,31 @@
 	else
 	    {
 	    drawScaledBox(hvg, s2, e, scale, xOff, y+shortOff, shortHeight,
 		color);
 	    }
 	e = s2;
 	}
     /* Draw "tall" portion of exon (or codon) */
     if (e > s)
 	{
         if (drawOpt > baseColorDrawOff
         &&  e + 6 >= winStart
         &&  s - 6 <  winEnd
         &&  (e-s <= 3 || !baseColorNeedsCodons))
             baseColorDrawItem(tg, lf, sf->grayIx, hvg, xOff, y, scale, font, s, e, heightPer,
-                              zoomedToCodonLevel, mrnaSeq, sf, psl, drawOpt, MAXPIXELS, winStart,
+                              zoomedToCodonLevel, qSeq, qOffset, sf, psl, drawOpt, MAXPIXELS, winStart,
                               color);
         else
             {
 	    if (lf->highlightColor && (lf->highlightMode == highlightOutline))
 		{
 		drawScaledBox(hvg, s, e, scale, xOff, y, heightPer, lf->highlightColor);
 		drawScaledBox(hvg, s, e, scale, xOff+1, y+1, heightPer-2, color);
 		}
 	    else
 		{
 		if (tg->drawLabelInBox && 
                         !(tg->drawLabelInBoxNotDense && vis == tvDense))
                     {
 		    drawScaledBoxLabel(hvg, s, e, scale, xOff, y, heightPer,
                                 color, font, lf->name );
@@ -3954,34 +3955,34 @@
             }
 	}
     }
 
 if ((intronGap > 0) || chainLines)
     lfDrawSpecialGaps(lf, intronGap, chainLines, gapFactor,
 		      tg, hvg, xOff, y, scale, color, bColor, vis);
 
 if (vis != tvDense)
     {
     /* If highlighting differences between aligned sequence and genome when
      * zoomed way out, this must be done in a separate pass after exons are
      * drawn so that exons sharing the pixel don't overdraw differences. */
     if (indelShowQueryInsert || indelShowPolyA)
 	baseColorOverdrawQInsert(tg, lf, hvg, xOff, y, scale, heightPer,
-				 mrnaSeq, psl, winStart, drawOpt,
+				 qSeq, qOffset, psl, winStart, drawOpt,
 				 indelShowQueryInsert, indelShowPolyA);
     baseColorOverdrawDiff(tg, lf, hvg, xOff, y, scale, heightPer,
-			  mrnaSeq, psl, winStart, drawOpt);
+			  qSeq, qOffset, psl, winStart, drawOpt);
     }
 }
 
 static void lfSeriesDrawConnecter(struct linkedFeaturesSeries *lfs,
                                   struct hvGfx *hvg, int start, int end, double scale, int xOff,
                                   int midY, Color color, Color bColor, enum trackVisibility vis)
 /* Draw connection between two sets of linked features. */
 {
 if (start != -1 && !lfs->noLine)
     {
     int x1 = round((double)((int)start-winStart)*scale) + xOff;
     int x2 = round((double)((int)end-winStart)*scale) + xOff;
     int w = x2-x1;
     if (w > 0)
         {