20d72f662e55fd7c611413dbb471a3a2714b9684
hiram
  Thu Oct 10 14:09:53 2019 -0700
newly supported type wigMaf refs #23589

diff --git src/hg/hubApi/apiUtils.c src/hg/hubApi/apiUtils.c
index bb5f4bb..c4c5d48 100644
--- src/hg/hubApi/apiUtils.c
+++ src/hg/hubApi/apiUtils.c
@@ -482,32 +482,30 @@
 while ((row = sqlNextRow(sr)) != NULL)
     {
     el = dbDbLoad(row);
     slAddHead(&dbList, el);
     }
 sqlFreeResult(&sr);
 hDisconnectCentral(&conn);
 slSort(&dbList, dbDbCmpName);
 return dbList;
 }
 
 boolean isSupportedType(char *type)
 /* is given type in the supportedTypes list ? */
 {
 boolean ret = FALSE;
-if (startsWith("wigMaf", type))	/* not wigMaf at this time */
-    return ret;
 struct slName *el;
 for (el = supportedTypes; el; el = el->next)
     {
     if (startsWith(el->name, type))
 	{
 	ret = TRUE;
 	break;
 	}
     }
 return ret;
 }
 
 void wigColumnTypes(struct jsonWrite *jw)
 /* output column headers for a wiggle data output schema */
 {
@@ -531,31 +529,31 @@
 jsonWriteString(jw, "name", "value");
 jsonWriteString(jw, "sqlType", "float");
 jsonWriteString(jw, "jsonType", "number");
 jsonWriteString(jw, "description", "numerical data value for this location:start-end");
 jsonWriteObjectEnd(jw);
 
 jsonWriteListEnd(jw);
 }	/* void wigColumnTypes(struct jsonWrite jw) */
 
 void outputSchema(struct trackDb *tdb, struct jsonWrite *jw,
     char *columnNames[], char *columnTypes[], int jsonTypes[],
 	struct hTableInfo *hti, int columnCount, int asColumnCount,
 	    struct asColumn *columnEl)
 /* print out the SQL schema for this trackDb */
 {
-if (tdb && startsWith("wig", tdb->type))
+if (tdb && isWiggleDataTable(tdb->type))
     {
         wigColumnTypes(jw);
     }
 else
     {
     jsonWriteListStart(jw, "columnTypes");
     int i = 0;
     for (i = 0; i < columnCount; ++i)
         {
         jsonWriteObjectStart(jw, NULL);
         jsonWriteString(jw, "name", columnNames[i]);
         jsonWriteString(jw, "sqlType", columnTypes[i]);
         jsonWriteString(jw, "jsonType", jsonTypeStrings[jsonTypes[i]]);
         if ((0 == i) && (hti && hti->hasBin))
             jsonWriteString(jw, "description", "Indexing field to speed chromosome range queries");
@@ -641,15 +639,29 @@
 else if (sameOk(tableName, "lovd"))
   ret = TRUE;
 else if (sameOk(tableName, "hgmd"))
   ret = TRUE;
 else
     {
     if (tdb)	/* may not have a tdb at this time */
 	{
 	char *tbOff = trackDbSetting(tdb, "tableBrowser");
 	if (tbOff && startsWithWord("off", tbOff))
 	    ret = TRUE;
 	}
     }
 return ret;
 }
+
+boolean isWiggleDataTable(char *type)
+/* is this a wiggle data track table */
+{
+if (startsWith("wig", type))
+    {
+    if (startsWith("wigMaf", type))
+	return FALSE;
+    else
+	return TRUE;
+    }
+else
+     return FALSE;
+}