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/cds.h src/hg/hgTracks/cds.h
index 4f442ba..8e0b3d7 100644
--- src/hg/hgTracks/cds.h
+++ src/hg/hgTracks/cds.h
@@ -119,74 +119,75 @@
  * return a list of simpleFeature elements, one per codon (or partial 
  * codon if the codon falls on a gap boundary.  sizeMul, isXeno and maxShade
  * are for defaulting to one-simpleFeature-per-exon if cds is not found. */
 
 
 INLINE boolean baseColorCanDraw(struct track *tg)
 /* baseColor uses tg->drawItems as a proxy for type of tg->items, which must be 
  * linkedFeatures or linkedFeaturesSeries.  Return TRUE if tg->drawItems
  * implies that tg->items is linkedFeatures or linkedFeaturesSeries, and from
  * a subtype supported by the baseColor code. */
 {
 return (tg->drawItems == linkedFeaturesDraw || tg->drawItems == linkedFeaturesAverageDense ||
 	tg->drawItems == linkedFeaturesAverageDenseOrientEst ||
 	tg->drawItems == linkedFeaturesSeriesDraw ||
 	tg->drawItems == bamLinkedFeaturesDraw ||
+	tg->drawItems == chainDraw ||
 	tg->drawItems == bamLinkedFeaturesSeriesDraw);
 
 }
 
 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, but note that this should be called only if
  * baseColorCanDraw(tg) (above). */
 
 enum baseColorDrawOpt baseColorDrawSetup(struct hvGfx *hvg, struct track *tg,
 			struct linkedFeatures *lf,
-			struct dnaSeq **retMrnaSeq, struct psl **retPsl);
+			struct dnaSeq **retMrnaSeq, int *retMrnaOffset, struct psl **retPsl);
 /* Returns the CDS coloring option, allocates colors if necessary, and 
  * returns the sequence and psl record for the given item if applicable. 
  * Note: even if base coloring is not enabled, this will return psl and 
  * mrna seq if query insert/polyA display is enabled.
  * baseColorInitTrack must be called before this (in tg->drawItems) --
  * this is meant to be called by tg->drawItemAt (i.e. linkedFeaturesDrawAt). */
 
 void baseColorDrawItem(struct track *tg,  struct linkedFeatures *lf,
         int grayIx, struct hvGfx *hvg, int xOff, int y,
         double scale, MgFont *font, int s, int e, int heightPer,
-        boolean zoomedToCodonLevel, struct dnaSeq *mrnaSeq, struct simpleFeature *sf, struct psl *psl,
+        boolean zoomedToCodonLevel, struct dnaSeq *qSeq, int qOffset, struct simpleFeature *sf, struct psl *psl,
 	enum baseColorDrawOpt drawOpt,
         int maxPixels, int winStart, Color originalColor);
 /*draw a box that is colored by the bases inside it and its
  * orientation. Stop codons are red, start are green, otherwise they
  * alternate light/dark blue colors. */
 
 void baseColorOverdrawDiff(struct track *tg,  struct linkedFeatures *lf,
 			   struct hvGfx *hvg, int xOff,
 			   int y, double scale, int heightPer,
-			   struct dnaSeq *mrnaSeq, struct psl *psl,
+			   struct dnaSeq *qSeq, int qOffset, struct psl *psl,
 			   int winStart, enum baseColorDrawOpt drawOpt);
 /* If we're drawing different bases/codons, and zoomed out past base/codon 
  * level, draw 1-pixel wide red lines only where bases/codons differ from 
  * genomic.  This tests drawing mode and zoom level but assumes that lf itself 
  * has been drawn already and we're not in dense mode etc. */
 
 void baseColorOverdrawQInsert(struct track *tg,  struct linkedFeatures *lf,
 			      struct hvGfx *hvg, int xOff,
 			      int y, double scale, int heightPer,
-			      struct dnaSeq *mrnaSeq, struct psl *psl,
+			      struct dnaSeq *qSeq, int qOffset, struct psl *psl,
 			      int winStart, enum baseColorDrawOpt drawOpt,
 			      boolean indelShowQInsert, boolean indelShowPolyA);
 /* If applicable, draw 1-pixel wide orange lines for query insertions in the
  * middle of the query, 1-pixel wide purple lines for query insertions at the 
  * end of the query, and 1-pixel wide green (instead of purple) when a query 
  * insertion at the end is a valid poly-A tail. */
 
 
 struct simpleFeature *baseColorCodonsFromDna(int frame, int chromStart,
 					     int chromEnd, struct dnaSeq *seq,
 					     bool reverse);
 /* Create list of codons from a DNA sequence */
 
 void baseColorDrawRulerCodons(struct hvGfx *hvg, struct simpleFeature *sfList,
                 double scale, int xOff, int y, int height, MgFont *font,