src/hg/hgTables/microarrayTables.c 1.1

1.1 2009/03/17 10:13:27 aamp
Adding microarray stuff to output microarray names in the microarrayGroupings.ra file. Also put in some bits to output the microarray groupings themselves but that's incomplete currently.
Index: src/hg/hgTables/microarrayTables.c
===================================================================
RCS file: src/hg/hgTables/microarrayTables.c
diff -N src/hg/hgTables/microarrayTables.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/hg/hgTables/microarrayTables.c	17 Mar 2009 10:13:27 -0000	1.1
@@ -0,0 +1,43 @@
+/* Stuff to handle microarray tables */
+
+#include "common.h"
+#include "hash.h"
+#include "linefile.h"
+#include "trackDb.h"
+#include "customTrack.h"
+#include "microarray.h"
+#include "hgTables.h"
+
+boolean isMicroarray(struct trackDb *curTrack, char *table)
+/* Return TRUE if table is specified as a microarray in the current database's 
+ * trackDb. */
+{
+if (curTrack && sameString(curTrack->tableName, table))
+    return (startsWith("expRatio", curTrack->type) || startsWith("array", curTrack->type));
+else
+    {
+    struct trackDb *tdb = hTrackDbForTrack(database, table);
+    return (tdb && (startsWith("expRatio", tdb->type) || startsWith("array", tdb->type)));
+    }
+return FALSE;
+}
+
+void doOutMicroarrayNames(struct trackDb *tdb)
+/* Show the microarray names from .ra file */
+{
+struct microarrayGroups *allGroups = maGetTrackGroupings(database, tdb);
+if (allGroups)
+    {
+    struct maGrouping *allArrays = allGroups->allArrays;
+    int i;
+    if (allArrays)
+	{
+	textOpen();
+	printf("#expId\tname\n");
+	for (i = 0; i < allArrays->size; i++)
+	    {
+	    printf("%d\t%s\n", allArrays->expIds[i], allArrays->names[i]);
+	    }
+	}
+    }
+}