c46be5cebadbe532ca7f7fc2a5cde930554c7ae7
braney
  Tue May 2 11:20:34 2017 -0700
first check in of hgComposite code.

diff --git src/hg/lib/trackHub.c src/hg/lib/trackHub.c
index add052d..5dfecf2 100644
--- src/hg/lib/trackHub.c
+++ src/hg/lib/trackHub.c
@@ -34,30 +34,31 @@
 #include "bigBed.h"
 #include "hdb.h"
 #include "chromInfo.h"
 #include "grp.h"
 #include "twoBit.h"
 #include "dbDb.h"
 #include "net.h"
 #include "bbiFile.h"
 #include "bPlusTree.h"
 #include "hgFind.h"
 #include "hubConnect.h"
 #include "trix.h"
 #include "vcf.h"
 #include "htmshell.h"
 #include "bigBedFind.h"
+#include "customComposite.h"
 
 static struct hash *hubCladeHash;  // mapping of clade name to hub pointer
 static struct hash *hubAssemblyHash; // mapping of assembly name to genome struct
 static struct hash *hubOrgHash;   // mapping from organism name to hub pointer
 static struct trackHub *globalAssemblyHubList; // list of trackHubs in the user's cart
 static struct hash *trackHubHash;
 
 char *trackHubRelativeUrl(char *hubUrl, char *path)
 /* Return full path (in URL form if it's a remote hub) given
  * path possibly relative to hubUrl. Do a freeMem of result
  * when done. */
 {
 /* If path itself is a URL then just return a copy of it. */
 if (hasProtocol(path))
     return cloneString(path);
@@ -480,30 +481,32 @@
 else return 0;
 }
 
 static struct trackHubGenome *trackHubGenomeReadRa(char *url, struct trackHub *hub)
 /* Read in a genome.ra format url and return it as a list of trackHubGenomes. 
  * Also add it to hash, which is keyed by genome. */
 {
 struct lineFile *lf = udcWrapShortLineFile(url, NULL, 64*1024*1024);
 struct trackHubGenome *list = NULL, *el;
 struct hash *hash = hub->genomeHash;
 
 struct hash *ra;
 while ((ra = raNextRecord(lf)) != NULL)
     {
     // allow that trackDb+hub+genome is in one single file
+    if (hashFindVal(ra, "hub"))
+        continue;
     if (hashFindVal(ra, "track"))
         break;
 
     char *twoBitPath = hashFindVal(ra, "twoBitPath");
     char *genome;
     if (twoBitPath != NULL)
 	genome = addHubName(hashFindVal(ra, "genome"), hub->name);
     else
 	genome = hashFindVal(ra, "genome");
     if (hub->defaultDb == NULL)
 	hub->defaultDb = genome;
     if (genome == NULL)
         badGenomeStanza(lf);
     if (hashLookup(hash, genome) != NULL)
         errAbort("Duplicate genome %s in stanza ending line %d of %s",
@@ -758,52 +761,55 @@
     if ((superTrack != NULL) && startsWith("on", superTrack))
 	isSuper = TRUE;
 
     if (!(trackDbSetting(tdb, "compositeTrack") ||
           trackDbSetting(tdb, "container") || 
 	  isSuper))
         {
 	errAbort("Parent track %s is not compositeTrack, container, or superTrack in hub %s genome %s", 
 		tdb->track, hub->url, genome->name);
 	}
     }
 else
     {
     /* Check type field. */
     char *type = requiredSetting(hub, genome, tdb, "type");
+    if (!( isCustomComposite(tdb) && startsWithWord("wig", type)))
+        {
         if (!(startsWithWord("bigWig", type) ||
               startsWithWord("bigBed", type) ||
 #ifdef USE_HAL
               startsWithWord("pslSnake", type) ||
               startsWithWord("halSnake", type) ||
 #endif
               startsWithWord("vcfTabix", type) ||
               startsWithWord("bigPsl", type) ||
               startsWithWord("bigMaf", type) ||
               startsWithWord("longTabix", type) ||
               startsWithWord("bigGenePred", type) ||
               startsWithWord("bigChain", type) ||
               startsWithWord("bigBarChart", type) ||
               startsWithWord("bam", type)))
             {
             errAbort("Unsupported type '%s' in hub %s genome %s track %s", type,
                 hub->url, genome->name, tdb->track);
             }
 
         requiredSetting(hub, genome, tdb, "bigDataUrl");
         }
     }
+}
 
 static void markContainers( struct trackHub *hub, 
     struct trackHubGenome *genome, struct trackDb *tdbList)
 /* Mark containers that are parents, or have them. */
 {
 struct hash *hash = hashNew(0);
 struct trackDb *tdb;
 
 // add all the track names to a hash
 for (tdb = tdbList; tdb != NULL; tdb = tdb->next)
     {
     if (hashLookup(hash, tdb->track))
         errAbort("Track %s appears more than once in genome %s.", tdb->track, genome->name);
     hashAdd(hash, tdb->track, tdb);
     }