7b89c304567373d9f309086a965706dcaa2a7670
braney
  Wed Sep 28 15:49:42 2016 -0700
if there is a maf with just the default species, use that instead of the
main maf

diff --git src/hg/hgTracks/wigMafTrack.c src/hg/hgTracks/wigMafTrack.c
index 3901c06..3f1d0dd 100644
--- src/hg/hgTracks/wigMafTrack.c
+++ src/hg/hgTracks/wigMafTrack.c
@@ -582,30 +582,49 @@
 
 struct mafPriv *mp = getMafPriv(track);
 mp->list = (char *)-1;   /* no maf's loaded or attempted to load */
 
 /* if we're out in summary view and rendering a custom
  * track we force dense mode since we don't have
  * a summary table (yet). */
 if (inSummaryMode(cart, track->tdb, winBaseCount) && isCustomTrack(track->table))
     track->limitedVis = tvDense;
 
 /* Load up mafs and store in track so drawer doesn't have
  * to do it again. */
 /* Make up tracks for display. */
 if (track->limitedVis == tvFull || track->limitedVis == tvPack)
     {
+    char *defaultOn = trackDbSetting(track->tdb, "speciesDefaultOn");
+    char *defaultMaf = trackDbSetting(track->tdb, "defaultMaf");
+
+    // check to see if all species that are on are in defaultMaf
+    if (defaultOn && defaultMaf && hTableExists(database, defaultMaf))
+        {
+        struct wigMafItem *speciesList = newSpeciesItems(track, tl.fontHeight), *wmi;
+        struct slName *defaultNames = slNameListFromString(defaultOn, ' ');
+        
+        boolean allOnInDefault = TRUE;
+        for(wmi = speciesList; wmi; wmi = wmi->next)
+            {
+            if (!slNameInList(defaultNames, wmi->db))
+                allOnInDefault = FALSE;
+            }
+
+        if (allOnInDefault)
+            track->table = defaultMaf;
+        }
     if (isBaseLevel)
 	{
 	miList = loadBaseByBaseItems(track);
 	}
     /* zoomed out */
     else
 	{
 	miList = loadPairwiseItems(track);
 	}
     }
 else if (track->limitedVis == tvSquish)
     {
     if (!wigTrack)
         {
         scoreHeight = tl.fontHeight * 4;