src/hg/hgc/hgc.c 1.1537

1.1537 2009/05/08 17:59:36 angie
doKomp: Added explicit inclusion of all targets for given gene, with the Design ID now appended to each gene name.
Index: src/hg/hgc/hgc.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/hgc.c,v
retrieving revision 1.1536
retrieving revision 1.1537
diff -b -B -U 4 -r1.1536 -r1.1537
--- src/hg/hgc/hgc.c	7 May 2009 18:05:52 -0000	1.1536
+++ src/hg/hgc/hgc.c	8 May 2009 17:59:36 -0000	1.1537
@@ -20795,18 +20795,28 @@
 char *extraTable = trackDbSettingOrDefault(tdb, "xrefTable", "kompExtra");
 boolean gotExtra = sqlTableExists(conn, extraTable);
 if (gotExtra)
     {
+    char mgiId[256];
     safef(query, sizeof(query), "select alias from %s where name = '%s'",
 	  extraTable, item);
+    sqlQuickQuery(conn, query, mgiId, sizeof(mgiId));
+    char *ptr = strchr(mgiId, ',');
+    if (!startsWith("MGI:", mgiId) || ptr == NULL)
+	errAbort("Where is the MGI ID?: '%s'", mgiId);
+    else
+	*ptr = '\0';
+    // Use the MGI ID to show all centers that are working on this gene:
+    safef(query, sizeof(query), "select name,alias from %s where alias like '%s,%%'",
+	  extraTable, mgiId);
     sr = sqlGetResult(conn, query);
     char lastMgiId[16];
     lastMgiId[0] = '\0';
     puts("<TABLE BORDERWIDTH=0 CELLPADDING=0>");
     while ((row = sqlNextRow(sr)) != NULL)
 	{
 	char *words[3];
-	int wordCount = chopCommas(row[0], words);
+	int wordCount = chopCommas(row[1], words);
 	if (wordCount >= 3)
 	    {
 	    char *mgiId = words[0], *center = words[1], *status = words[2];
 	    if (!sameString(mgiId, lastMgiId))
@@ -20818,8 +20828,11 @@
 		printf("</TD></TR>\n");
 		safecpy(lastMgiId, sizeof(lastMgiId), mgiId);
 		}
 	    printf("<TR><TD><B>Center: </B>%s</TD>\n", center);
+	    ptr = strrchr(row[0], '_');
+	    if (ptr != NULL)
+		printf("<TD><B>Design ID: </B>%s</TD>\n", ptr+1);
 	    printf("<TD><B>Status: </B>%s</TD></TR>\n", status);
 	    }
 	}
     puts("<TR><TD colspan=2>");