b1522ad0cbfeb2a6349472b7c753878bea3770c7
kate
Tue May 7 14:27:39 2013 -0700
Create version of track clustered by target protein. refs #10097
diff --git src/hg/hgc/peakClusters.c src/hg/hgc/peakClusters.c
index 8ebdf04..93b6b10 100644
--- src/hg/hgc/peakClusters.c
+++ src/hg/hgc/peakClusters.c
@@ -338,30 +338,114 @@
else
errAbort("Missing required trackDb setting %s for track %s",
"inputTableFieldDisplay", tdb->track);
webPrintLinkTableEnd();
}
printf("", hgcPathAndSettings(),
tdb->track);
printf("List all items assayed");
printf("
\n");
webNewSection("Track Description");
printTrackHtml(tdb);
cartWebEnd();
hFreeConn(&conn);
}
+struct factorSourceInfo
+/* Cell type and description */
+ {
+ struct factorSourceInfo *next;
+ char *name;
+ char *description;
+ };
+
+int factorSourceInfoCmp(const void *va, const void *vb)
+/* Compare two factorSourceInfo's, sorting on description field */
+{
+static char bufA[64], bufB[64];
+const struct factorSourceInfo *a = *((struct factorSourceInfo **)va);
+const struct factorSourceInfo *b = *((struct factorSourceInfo **)vb);
+safef(bufA, 64, "%s+%s", a->name, a->description);
+safef(bufB, 64, "%s+%s", b->name, b->description);
+return strcmp(bufA, bufB);
+}
+
+void factorSourceAbbreviationTable(struct sqlConnection *conn, char *sourceTable, boolean cellsOnly)
+/* Print out table of abbreviations. Optionally, extract cell name only (before '+') and uniqify */
+{
+char *label = "Cell Type";
+if (!cellsOnly)
+ {
+ hPrintAbbreviationTable(conn, sourceTable, label);
+ return;
+ }
+char query[256];
+safef(query, sizeof(query), "select name,description from %s order by name", sourceTable);
+struct sqlResult *sr = sqlGetResult(conn, query);
+webPrintLinkTableStart();
+webPrintLabelCell("Symbol");
+webPrintLabelCell(label);
+char **row;
+char *plus;
+struct factorSourceInfo *source = NULL, *sources = NULL;
+while ((row = sqlNextRow(sr)) != NULL)
+ {
+ char *name = row[0];
+ char *description = row[1];
+ if (cellsOnly)
+ {
+ // truncate description to just the cell type
+ if ((plus = strchr(description, '+')) != NULL)
+ *plus = 0;
+ }
+ AllocVar(source);
+ source->name = cloneString(name);
+ source->description = cloneString(description);
+ slAddHead(&sources, source);
+ }
+slUniqify(&sources, factorSourceInfoCmp, NULL);
+int count = 0;
+/*
+while ((source = slPopHead(&sources)) != NULL)
+ {
+ printf("