src/hg/hgTables/custom.c 1.44

1.44 2010/04/12 05:32:51 kent
Making all fields output work with makeItems.
Index: src/hg/hgTables/custom.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/custom.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -b -B -U 4 -r1.43 -r1.44
--- src/hg/hgTables/custom.c	25 Mar 2010 17:41:25 -0000	1.43
+++ src/hg/hgTables/custom.c	12 Apr 2010 05:32:51 -0000	1.44
@@ -513,21 +513,18 @@
     *retFieldCount = fieldCount;
 return bedList;
 }
 
-void doTabOutCustomTracks(struct trackDb *track, struct sqlConnection *conn,
-	char *fields, FILE *f)
-/* Print out selected fields from custom track.  If fields
+static void doTabOutBedLike(struct customTrack *ct, struct trackDb *track,
+	struct sqlConnection *conn, char *fields, FILE *f)
+/* Print out selected fields from a bed-like custom track.  If fields
  * is NULL, then print out all fields. */
 {
 struct region *regionList = getRegions(), *region;
 struct slName *chosenFields, *field;
 int count = 0;
 if (fields == NULL)
-    {
-    struct customTrack *ct = ctLookupName(track->tableName);
     chosenFields = getBedFields(ct->fieldCount);
-    }
 else
     chosenFields = commaSepToSlNames(fields);
 
 if (f == NULL)
@@ -556,8 +553,26 @@
 if (count == 0)
     explainWhyNoResults(f);
 }
 
+void doTabOutCustomTracks(char *db, struct trackDb *track, struct sqlConnection *conn,
+	char *fields, FILE *f)
+/* Print out selected fields from custom track.  If fields
+ * is NULL, then print out all fields. */
+{
+struct customTrack *ct = ctLookupName(track->tableName);
+char *type = ct->tdb->type;
+if (startsWithWord("makeItems", type))
+    {
+    struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH);
+    doTabOutDb(CUSTOM_TRASH, ct->dbTableName, f, conn, fields);
+    hFreeConn(&conn);
+    }
+else
+    doTabOutBedLike(ct, track, conn, fields, f);
+}
+
+
 void removeNamedCustom(struct customTrack **pList, char *name)
 /* Remove named custom track from list if it's on there. */
 {
 struct customTrack *newList = NULL, *ct, *next;