65de282e0ebdcb5070ba2c7022db030785b3cb70
angie
  Mon Nov 1 10:30:59 2010 -0700
Code Review #1519 (v243 preview2): Adding comment to explain use ofmod-6 for alternating codons, thanks Melissa.

diff --git src/hg/hgTracks/cds.c src/hg/hgTracks/cds.c
index 33799c1..11d4fc2 100644
--- src/hg/hgTracks/cds.c
+++ src/hg/hgTracks/cds.c
@@ -988,31 +988,33 @@
     {
     int offset = i % 3;
     codon[offset] = *start++;
     if (offset != 2)
         continue;
 
     /* new codon */
     AllocVar(sf);
     sf->start = chromPos - 3;
     sf->end = sf->start + 3;
     if (reverse)
         {
         sf->start = winEnd - sf->start + winStart - 3;
         sf->end = sf->start + 3;
         }
-    sf->grayIx = codonToGrayIx(codon, sf->start % 6 < 3, NULL, FALSE, TRUE);
+    // Base offsets mod 6 for alternating colors: 0,1,2 --> first codon, 3,4,5 --> second codon.
+    bool codonFirstColor = (sf->start % 6 < 3);
+    sf->grayIx = codonToGrayIx(codon, codonFirstColor, NULL, FALSE, TRUE);
     zeroBytes(codon, 4);
     slAddHead(&sfList, sf);
     }
 slReverse(&sfList);
 return sfList;
 }
 
 struct simpleFeature *baseColorCodonsFromGenePred(struct linkedFeatures *lf, 
 	struct genePred *gp, boolean colorStopStart)
 /* Given an lf and the genePred from which the lf was constructed, 
  * return a list of simpleFeature elements, one per codon (or partial 
  * codon if the codon falls on a gap boundary. */
 {
 unsigned *starts = gp->exonStarts;
 unsigned *ends = gp->exonEnds;