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

diff --git src/hg/lib/barChartBed.c src/hg/lib/barChartBed.c
index 97b470b..9784bc0 100644
--- src/hg/lib/barChartBed.c
+++ src/hg/lib/barChartBed.c
@@ -234,30 +234,55 @@
 "   name varchar(255) not null,         # Identifier\n"
 "   score int unsigned not null,        # Score from 0-1000\n"
 "   strand char(1) not null,            # + or - for strand\n"
 "   name2 varchar(255) not null,        # Alternative name for item\n"
 "   expCount int unsigned not null,     # Number of experiment values\n"
 "   expScores longblob not null,        # Comma separated list of experiment scores\n"
 "   _dataOffset bigint not null,        # Offset of sample data in data matrix file, for boxplot on details page\n"
 "   _dataLen int not null,              # Length of sample data row in data matrix file\n"
 "   INDEX(name),\n"
 "   INDEX(chrom(20), chromStart)\n"
 ")\n",
     table);
 sqlRemakeTable(conn, table, query);
 }
 
+static char *barChartAutoSqlString =
+"table barChartBed"
+"\"BED6+5 with additional fields for category count and median values, and sample matrix fields\""
+"    ("
+"   string chrom;       \"Reference sequence chromosome or scaffold\""
+"   uint   chromStart;  \"Start position in chromosome\""
+"   uint   chromEnd;    \"End position in chromosome\""
+"   string name;        \"Name or ID of item, ideally both human readable and unique\""
+"   uint   score;       \"Score from 0-1000, typically derived from total of median value from all categories\""
+"   char[1] strand;     \"+ or - for strand. Use . if not applicable\""
+"   string name2;       \"Alternative name for item\""
+"   uint expCount;      \"Number of categories\""
+"   float[expCount] expScores; \"Comma separated list of category values\""
+"   bigint _dataOffset; \"Offset of sample data in data matrix file, for boxplot on details page\""
+"   int _dataLen;       \"Length of sample data row in data matrix file\""
+"   )"
+;
+
+struct asObject *barChartAsObj()
+/* Return asObject describing fields of barChart database table (includes bin) */
+{
+return asParseText(barChartAutoSqlString);
+}
+
+
 struct bed *barChartSimpleBedLoad(char **row)
 /* Load a bed from row containing barChart bed fields. 
  * This reuses autoSql barChartBedLoad, but with a full-size bed.
  Dispose of this with bedFree() */
 {
 struct bed *ret;
 AllocVar(ret);
 ret->chrom = cloneString(row[0]);
 ret->chromStart = sqlUnsigned(row[1]);
 ret->chromEnd = sqlUnsigned(row[2]);
 ret->name = cloneString(row[3]);
 ret->score = sqlUnsigned(row[4]);
 safecpy(ret->strand, sizeof(ret->strand), row[5]);
 // name2 is in row[6]
 ret->expCount = sqlUnsigned(row[7]);
@@ -313,16 +338,15 @@
 {
 int i;
 float maxScore = 0.0;
 assert(categIdRet);
 for (i=0; i<bed->expCount; i++)
     {
     float score = bed->expScores[i];
     if (score > maxScore)
         {
         maxScore = score;
         *categIdRet = i;
         }
     }
 return maxScore;
 }
-