2465c757a1d4f44ceb3f7eaedabf4838ec53fcc7
angie
  Wed Nov 25 15:36:04 2015 -0800
Now that annoStreamDb's asObj isn't externally imposed using trackDb,
hAnnoGetAutoSqlForDbTable needs to watch out for the special case of
pgSnp custom tracks -- no tableDescriptions, no trackDb when called
by annoStreamDb, and pgSnp's quirk of including bin in its autoSql.

diff --git src/hg/lib/hAnno.c src/hg/lib/hAnno.c
index 8bbb8d5..a76b333 100644
--- src/hg/lib/hAnno.c
+++ src/hg/lib/hAnno.c
@@ -113,30 +113,34 @@
  * we try tdb & db.tableDescriptions first.  But ultimately we need to return
  * an asObj whose columns match all fields of the table. */
 {
 struct sqlConnection *conn = hAllocConn(db);
 struct sqlFieldInfo *fieldList = sqlFieldInfoGet(conn, table);
 struct asObject *asObj = NULL;
 if (tdb != NULL)
     asObj = asForTdb(conn, tdb);
 if (asObj == NULL)
     asObj = asFromTableDescriptions(conn, table);
 hFreeConn(&conn);
 if (columnsMatch(asObj, fieldList))
     return asObj;
 else
     {
+    // Special case for pgSnp, which includes its bin column in autoSql...
+    struct asObject *pgSnpAsO = pgSnpAsObj();
+    if (columnsMatch(pgSnpAsO, fieldList))
+        return pgSnpAsO;
     return asObjectFromFields(table, fieldList, skipBin);
     }
 }
 
 static char *getBigDataFileName(char *db, struct trackDb *tdb, char *selTable, char *chrom)
 /* Get fileName from bigBed/bigWig/BAM/VCF database table, or bigDataUrl from custom track. */
 {
 char *bigDataUrl = trackDbSetting(tdb, "bigDataUrl");
 if (isNotEmpty(bigDataUrl))
     {
     return bigDataUrl;
     }
 else
     {
     struct sqlConnection *conn = hAllocConn(db);