5a15682a86322400de523cace0e20f51a4d9e56d
max
  Tue Apr 2 10:48:43 2013 -0700
trying to come up with better color shades for impact coloring
diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c
index 252695d..32a29ae 100644
--- src/hg/hgTracks/simpleTracks.c
+++ src/hg/hgTracks/simpleTracks.c
@@ -12189,68 +12189,71 @@
     extra->label = pubsFeatureLabel(firstAuthor, year);
     if (isEmpty(title))
         extra->mouseOver = extra->label;
     else
         extra->mouseOver = cloneString(title);
     extra->color  = NULL;
     extra->shade  = -1;
 
     if (newFormat) 
         {
         impact  = row[3];
         classes = row[4];
         if (!isEmpty(impact)) 
             {
             char *colorBy = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "pubsColorBy");
+            if ((colorBy==NULL) || strcmp(colorBy,"topic")==0) 
+                {
+                char *class;
+                while ((class=cloneNextWordByDelimiter(&classes, ','))!=NULL)
+                    {
+                    struct rgbColor *col = (struct rgbColor*) hashFindVal(pubsClassColors, class);
+                    extra->color = col;
+                    }
+                }
+            else 
+                {
             if (strcmp(colorBy,"impact")==0) 
                 {
                 char impInt = atoi(impact);
                 extra->shade = impInt/25;
                 }
             if (strcmp(colorBy,"year")==0) 
                 {
                 int relYear = (atoi(year)-1990); 
                 extra->shade = min(relYear/3, 10);
                 //extra->color = shadesOfGray[yearShade];
                 }
-            if (strcmp(colorBy,"topic")==0) 
-                {
-                char *class;
-                while ((class=cloneNextWordByDelimiter(&classes, ','))!=NULL)
-                    {
-                    struct rgbColor *col = (struct rgbColor*) hashFindVal(pubsClassColors, class);
-                    extra->color = col;
-                    }
                 }
-
             }
         }
     }
 
 
 sqlFreeResult(&sr);
 return extra;
 }
 
 static void pubsAddExtra(struct track* tg, struct linkedFeatures* lf)
 /* add authorYear and title to linkedFeatures->extra */
 {
 char *articleTable = trackDbSettingClosestToHome(tg->tdb, "pubsArticleTable");
 if(isEmpty(articleTable))
     return;
-if (lf->extra != NULL)
+if (lf->extra != NULL) {
     return;
+    }
 
 struct sqlConnection *conn = hAllocConn(database);
 struct pubsExtra* extra = pubsMakeExtra(tg, articleTable, conn, lf);
 lf->extra = extra;
 hFreeConn(&conn);
 }
 
 static void pubsLoadKeywordYearItems(struct track *tg)
 /* load items that fulfill keyword and year filter */
 {
 pubsParseClassColors();
 struct sqlConnection *conn = hAllocConn(database);
 char *keywords = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "pubsKeywords");
 char *yearFilter = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "pubsYear");
 char *articleTable = pubsArticleTable(tg);