56e08dec28f452488f1a5794efd06a8d8aacfde1
tdreszer
  Fri Sep 30 14:25:27 2011 -0700
Changes to fix redmine 4892 composite/view/subtrack inconsistency.
diff --git src/hg/lib/trackDbCustom.c src/hg/lib/trackDbCustom.c
index f93a216..0f1f0bc 100644
--- src/hg/lib/trackDbCustom.c
+++ src/hg/lib/trackDbCustom.c
@@ -673,70 +673,82 @@
 	    printf("%s<BR>\n", origAssembly);
 	else if (stringIn(origAssembly, freeze))
 	    printf("%s<BR>\n", freeze);
 	else
 	    printf("%s (%s)<BR>\n", freeze, origAssembly);
         }
     }
 }
 
 eCfgType cfgTypeFromTdb(struct trackDb *tdb, boolean warnIfNecessary)
 /* determine what kind of track specific configuration is needed,
    warn if not multi-view compatible */
 {
 eCfgType cType = cfgNone;
 char *type = tdb->type;
+assert(type != NULL);
+
 if(startsWith("wigMaf", type))
     cType = cfgWigMaf;
 else if(startsWith("wig", type))
     cType = cfgWig;
 else if(startsWith("bigWig", type))
     cType = cfgWig;
 else if(startsWith("bedGraph", type))
     cType = cfgWig;
-else if(startsWith("netAlign", type))
-    {
+else if(startsWith("netAlign", type)
+     || startsWith("net", tdb->track)) // SPECIAL CASE from hgTrackUi which might not be needed
     cType = cfgNetAlign;
-    warnIfNecessary = FALSE;
-    }
 else if(sameWord("bed5FloatScore",       type)
      || sameWord("bed5FloatScoreWithFdr",type))
     cType = cfgBedScore;
 else if(sameWord("narrowPeak",type)
      || sameWord("broadPeak", type)
      || sameWord("encodePeak",type)
      || sameWord("gappedPeak",type))
     cType = cfgPeak;
-else if(sameWord("genePred",type))
+else if(startsWithWord("genePred",type))
         cType = cfgGenePred;
-else if(sameWord("bedLogR",type) || sameWord("peptideMapping", type))
+else if(sameWord("bedLogR",type)
+     || sameWord("peptideMapping", type))
     cType = cfgBedScore;
-else if(startsWith("bed ", type))
+else if(startsWithWord("bed", type))
     {
     char *words[3];
-    chopLine(cloneString( type), words);
+    int wordCount = chopLine(cloneString( type), words);
     if (trackDbSetting(tdb, "bedFilter") != NULL)
 	   cType = cfgBedFilt;
-    else if (atoi(words[1]) >= 5 && trackDbSettingClosestToHome(tdb, "noScoreFilter") == NULL)
+    else if ((atoi(words[1]) >= 5 || trackDbSetting(tdb, "scoreMin") != NULL)
+         && (wordCount == 3 || !tdbIsTrackUiTopLevel(tdb))) // Historically needed 'bed n .'
+        {
         cType = cfgBedScore;
+
+        // FIXME: UGLY SPECIAL CASE should be handled in trackDb!
+        if (startsWith("encodeGencodeIntron", tdb->track))
+            cType = cfgNone;
+        }
     }
 else if(startsWith("chain",type))
     cType = cfgChain;
+else if (startsWith("bamWig", type))
+    cType = cfgWig;
 else if (startsWith("bam", type))
     cType = cfgBam;
 else if (startsWith("psl", type))
     cType = cfgPsl;
+else if (sameWord("vcfTabix",type))
+    cType = cfgVcf;
 // TODO: Only these are configurable so far
 
 if(cType == cfgNone && warnIfNecessary)
     {
     if(!startsWith("bed ", type) && !startsWith("bigBed", type)
     && subgroupFind(tdb,"view",NULL))
         warn("Track type \"%s\" is not yet supported in multi-view composites for %s.",type,tdb->track);
     }
 return cType;
 }
 
 char *trackDbSetting(struct trackDb *tdb, char *name)
 /* Look for a trackDb setting from lowest level on up chain of parents. */
 {
 struct trackDb *generation;