src/hg/hgTables/joining.c 1.53

1.53 2009/03/17 17:24:51 kent
Simplifying some logic where code was unnecessarily distinguishing between hPrintf and fprintf(stdout - which is an issue in the Genome Browser, but not here in the Table Browser. Also enabling select fields user interface.
Index: src/hg/hgTables/joining.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/joining.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -b -B -U 4 -r1.52 -r1.53
--- src/hg/hgTables/joining.c	17 Mar 2009 04:28:39 -0000	1.52
+++ src/hg/hgTables/joining.c	17 Mar 2009 17:24:51 -0000	1.53
@@ -320,8 +320,20 @@
 makeOrderedCommaFieldList(fieldList, dtfList, dy);
 slFreeList(&fieldList);
 }
 
+static void makeBigBedOrderedCommaFieldList(struct joinerDtf *dtfList,
+	struct dyString *dy)
+/* Make comma-separated field list in same order as fields are in
+ * big bed. */
+{
+struct sqlConnection *conn = hAllocConn(dtfList->database);
+struct slName *fieldList = bigBedGetFields(dtfList->table, conn);
+makeOrderedCommaFieldList(fieldList, dtfList, dy);
+slFreeList(&fieldList);
+hFreeConn(&conn);
+}
+
 struct tableJoiner
 /* List of fields in a single table. */
     {
     struct tableJoiner *next;	/* Next in list. */
@@ -958,9 +970,11 @@
     {
     struct sqlConnection *conn = sqlConnect(dtfList->database);
     struct dyString *dy = dyStringNew(0);
     
-    if (isCustomTrack(dtfList->table))
+    if (isBigBed(dtfList->table))
+	makeBigBedOrderedCommaFieldList(dtfList, dy);
+    else if (isCustomTrack(dtfList->table))
         makeCtOrderedCommaFieldList(dtfList, dy);
     else
 	makeDbOrderedCommaFieldList(conn, dtfList->table, dtfList, dy);
     doTabOutTable(dtfList->database, dtfList->table, f, conn, dy->string);