src/hg/hgTracks/simpleTracks.c 1.74

1.74 2009/04/01 01:33:18 angie
Calls to hDnaFromSeq are rather expensive for 2bit, so cache genomic sequence from a single hDnaFromSeq call covering all of a track's items (even the ones that are only partly in the window). Replaced several strncpy/snprintf calls with memcpy because strncpy/snprintf can include strlen(source) which can be large (cached seq), bad news when called in codon inner loop. Also fixed off-by-one error that caused blue insert line to be drawn 1 base to the left of the end of + strand items (thx Brooke).
Index: src/hg/hgTracks/simpleTracks.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/simpleTracks.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -b -B -U 4 -r1.73 -r1.74
--- src/hg/hgTracks/simpleTracks.c	19 Mar 2009 22:21:06 -0000	1.73
+++ src/hg/hgTracks/simpleTracks.c	1 Apr 2009 01:33:18 -0000	1.74
@@ -2437,11 +2437,9 @@
     struct genePred *gp = NULL;
     if (startsWith("genePred", tg->tdb->type))
 	gp = (struct genePred *)(lf->original);
     if (gp && gp->cdsStart != gp->cdsEnd)
-	lf->codons = baseColorCodonsFromGenePred(lf, gp,
-						 (gp->optFields >= genePredExonFramesFld),
-						 (drawOpt != baseColorDrawDiffCodons));
+	lf->codons = baseColorCodonsFromGenePred(lf, gp, (drawOpt != baseColorDrawDiffCodons));
     }
 if (psl && drawOpt == baseColorDrawCds && !zoomedToCdsColorLevel)
     baseColorSetCdsBounds(lf, psl, tg);
 
@@ -2956,8 +2954,10 @@
  * and tg->drawItemAt has to be filled in. */
 {
 if (tg->mapItem == NULL)
     tg->mapItem = genericMapItem;
+if (vis != tvDense)
+    baseColorInitTrack(hvg, tg);
 if (vis == tvPack || vis == tvSquish)
     genericDrawItemsPackSquish(tg, seqStart, seqEnd, hvg, xOff, yOff, width,
                                font, color, vis);
 else