9705bb76d49dcf669b40cb926c2f00e5827cc61f
kent
  Tue Jan 18 23:57:14 2011 -0800
Moving a bbiFile processing routine from hgTracks to library, so hgc could use it too.  Using it to make hgc on bigBed work better.
diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c
index f863c3d..dab63a0 100644
--- src/hg/lib/hdb.c
+++ src/hg/lib/hdb.c
@@ -4869,16 +4869,31 @@
 {
 char *tdbType = findTypeForTable(database, parent, table, ctLookupName);
 return (tdbType && startsWithWord(type, tdbType));
 }
 
 boolean hIsBigBed(char *database, char *table, struct trackDb *parent, struct customTrack *(*ctLookupName)(char *table))
 /* Return TRUE if table corresponds to a bigBed file.
  * if table has no parent trackDb pass NULL for parent
  * If this is a custom track, pass in function ctLookupName(table) which looks up a
  * custom track by name, otherwise pass NULL
  */
 {
 return trackIsType(database, table, parent, "bigBed", ctLookupName);
 }
 
+char *bbiNameFromSettingOrTable(struct trackDb *tdb, struct sqlConnection *conn, char *table)
+/* Return file name from bigDataUrl or little table. */
+{
+char *fileName = cloneString(trackDbSetting(tdb, "bigDataUrl"));
+if (fileName == NULL)
+    {
+    char query[256];
+    safef(query, sizeof(query), "select fileName from %s", table);
+    fileName = sqlQuickString(conn, query);
+    if (fileName == NULL)
+	errAbort("Missing fileName in %s table", table);
+    }
+return fileName;
+}
+