e2e920776dddac39896fdb4aebae84a12bcb52b1
kate
  Tue May 9 11:06:33 2017 -0700
Add table browwser support for barChart custom tracks. refs #18736

diff --git src/hg/hgTables/custom.c src/hg/hgTables/custom.c
index 9ef9425..fcd7cec 100644
--- src/hg/hgTables/custom.c
+++ src/hg/hgTables/custom.c
@@ -81,30 +81,32 @@
 {
 struct hTableInfo *hti;
 int fieldCount = 3;
 
 if (ct == NULL)
     return(NULL);
 
 AllocVar(hti);
 hti->rootName = cloneString(ct->tdb->table);
 hti->isPos = TRUE;
 hti->isSplit = FALSE;
 hti->hasBin = FALSE;
 hti->type = cloneString(ct->tdb->type);
 if (sameString("pgSnp", hti->type))
     fieldCount = 4; /* only 4 bed-like */
+else if (sameString("barChart", hti->type))
+    fieldCount = 6; /* only 6 bed-like */
 else if (sameString("bedDetail", hti->type))
     fieldCount = ct->fieldCount - 2; /* bed part 4-12 */
 else
     fieldCount = ct->fieldCount;
 if (fieldCount >= 3)
     {
     strncpy(hti->chromField, "chrom", 32);
     strncpy(hti->startField, "chromStart", 32);
     strncpy(hti->endField, "chromEnd", 32);
     }
 if (fieldCount >= 4)
     {
     strncpy(hti->nameField, "name", 32);
     }
 if (fieldCount >= 5)
@@ -475,41 +477,46 @@
 /* Get list of beds from custom track of given name that are
  * in current regions and that pass filters.  You can bedFree
  * this when done. */
 {
 struct customTrack *ct = ctLookupName(name);
 struct bedFilter *bf = NULL;
 struct bed *bedList = NULL;
 struct hash *idHash = NULL;
 struct region *region;
 int fieldCount;
 
 if (ct == NULL)
     errAbort("Can't find custom track %s", name);
 char *type = ct->dbTrackType;
 
-if (type != NULL && (startsWithWord("makeItems", type) || sameWord("bedDetail", type) || sameWord("pgSnp", type)))
+if (type != NULL && (startsWithWord("makeItems", type) || 
+        sameWord("bedDetail", type) || 
+        sameWord("barChart", type) || 
+        sameWord("pgSnp", type)))
     {
     struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH);
     bedList = dbGetFilteredBedsOnRegions(conn, CUSTOM_TRASH, db, ct->dbTableName, name,
     	regionList, lm, retFieldCount);
     hFreeConn(&conn);
     fieldCount = 9;
     if (sameWord("bedDetail", type))
         fieldCount = *retFieldCount;
     else if (sameWord("pgSnp", type))
         fieldCount = 4;
+    else if (sameWord("barChart", type))
+        fieldCount = 6;
     }
 else if (ct->wiggle)
     {
     struct bed *wigBedList = NULL, *bed;
 
     /* Grab filtered beds for each region. */
     for (region = regionList; region != NULL; region = region->next)
 	{
 	wigBedList = getWiggleAsBed(NULL, name, region, NULL, NULL, lm, NULL);
 	for (bed = wigBedList; bed != NULL; bed = bed->next)
 	    {
 	    struct bed *copy = lmCloneBed(bed, lm);
 	    slAddHead(&bedList, copy);
 	    }
 	/*bedFree(&wigBedList); do not free local memory*/
@@ -572,31 +579,34 @@
 	++count;
 	}
     lmCleanup(&lm);
     }
 if (count == 0)
     explainWhyNoResults(f);
 }
 
 void doTabOutCustomTracks(char *db, char *table, struct sqlConnection *conn,
 	char *fields, FILE *f)
 /* Print out selected fields from custom track.  If fields
  * is NULL, then print out all fields. */
 {
 struct customTrack *ct = ctLookupName(table);
 char *type = ct->tdb->type;
-if (startsWithWord("makeItems", type) || sameWord("bedDetail", type) || sameWord("pgSnp", type))
+if (startsWithWord("makeItems", type) || 
+        sameWord("bedDetail", type) || 
+        sameWord("barChart", type) ||
+        sameWord("pgSnp", type))
     {
     struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH);
     doTabOutDb(CUSTOM_TRASH, db, ct->dbTableName, table, f, conn, fields);
     hFreeConn(&conn);
     }
 else
     doTabOutBedLike(ct, table, conn, fields, f);
 }
 
 
 void removeNamedCustom(struct customTrack **pList, char *name)
 /* Remove named custom track from list if it's on there. */
 {
 struct customTrack *newList = NULL, *ct, *next;
 for (ct = *pList; ct != NULL; ct = next)