src/hg/gsid/gsidTable/gsidTable.c 1.42

1.42 2009/08/06 17:24:49 fanhsu
Added logic to handle missing immuno data.
Index: src/hg/gsid/gsidTable/gsidTable.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/gsid/gsidTable/gsidTable.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -b -B -U 4 -r1.41 -r1.42
--- src/hg/gsid/gsidTable/gsidTable.c	17 Sep 2008 16:13:22 -0000	1.41
+++ src/hg/gsid/gsidTable/gsidTable.c	6 Aug 2009 17:24:49 -0000	1.42
@@ -364,10 +364,12 @@
 cartSaveSession(cart);
 printf("<font size=5><B>Table View</B></font>");
 mainControlPanel();
 if (subjList != NULL)
+    {
+printf("Use the \"configure\" button above to access additional data fields, including infection date details, sequencing and ART date information, <BR>and immunogenicity data.");
     bigTable(conn, colList,subjList);
-
+    }
 printf("<br>* Estimated Study Day of Infection (ESDI), ");
 printf("click <a href=\"http://www.gsid.org/downloads/methods_and_conventions.pdf\" target=_blank> here </a>");
 printf(" for further explanation.\n");
 printf("<br>* Days After Estimated Infection (DAEI), ");
@@ -924,8 +926,22 @@
     return answer;
     }
 }
 
+char NDString[10] = {"yyN/D"};
+char *stringCellValx(struct column *col, struct subjInfo *si,
+        struct sqlConnection *conn)
+/* Return clone of geneId */
+{
+return(NDString);
+/*
+if (col->query)
+    return queryCellVal(col,si,conn);
+else
+    return cloneString(si->fields[col->colNo]);
+*/
+}
+
 char *stringCellVal(struct column *col, struct subjInfo *si,
         struct sqlConnection *conn)
 /* Return clone of geneId */
 {
@@ -948,8 +964,57 @@
 boolean special;
 special = FALSE;
 char *s = col->cellVal(col, si, conn);
 hPrintf("<TD align=right>");
+/* special processing for missing data */
+if (sameWord(col->name, "SDayLastPTest"))
+    {
+    if (sameWord(s, "-1"))
+	{
+	hPrintf("N/A");
+	special = TRUE;
+	}
+    }
+if (sameWord(col->name, "SDayLastTrTest"))
+    {
+    if (sameWord(s, "-1"))
+	{
+	hPrintf("N/A");
+	special = TRUE;
+	}
+    }
+if (sameWord(col->name, "SDayLastTrTest"))
+    {
+    if (sameWord(s, "-2"))
+	{
+	hPrintf("N/D");
+	special = TRUE;
+	}
+    }
+if (sameWord(col->name, "LastTrVisit"))
+    {
+    if (sameWord(s, "-1"))
+	{
+	hPrintf("N/A");
+	special = TRUE;
+	}
+    }
+if (sameWord(col->name, "LastTrVisit"))
+    {
+    if (sameWord(s, "-2"))
+	{
+	hPrintf("N/D");
+	special = TRUE;
+	}
+    }
+if (sameWord(col->name, "LastTrMnNeutral"))
+    {
+    if (sameWord(s, "-3"))
+    	{
+    	hPrintf("&nbsp");
+	special = TRUE;
+	}
+    }
 if (sameWord(col->name, "cd4Count"))
     {
     if (sameWord(s, "-1") || sameWord(s, "0"))
 	{
@@ -1012,9 +1077,53 @@
 char buf[256];
 if (sameString(s,"."))  // known bad data value
     safef(buf,sizeof(buf),"%s", s);
 else
+    {
+    if (sameWord(col->name, "LastPVisit") ||sameWord(col->name, "LastPCD4Blk"))
+    	{
+    	if (sameWord(s, "-1"))
+	   {
+    	   safef(buf,sizeof(buf),"N/A");
+	   }
+    	else if (sameWord(s, "-2"))
+	   {
+    	   safef(buf,sizeof(buf),"N/D");
+	   }
+    	else if (sameWord(s, "-3"))
+	   {
+    	   safef(buf,sizeof(buf),"&nbsp");
+	   }
+	else
+	    {
+    	    safef(buf,sizeof(buf),"%.1f",sqlDouble(s));
+	    }
+	}
+    else
+    if (sameWord(col->name, "LastTrCD4Blk") || sameWord(col->name, "LastTrAntiGP120"))
+    	{
+    	if (sameWord(s, "-3"))
+	   {
+    	   safef(buf,sizeof(buf),"&nbsp");
+	   }
+    	else if (sameWord(s, "-2"))
+	   {
+    	   safef(buf,sizeof(buf),"N/D");
+	   }
+    	else if (sameWord(s, "-1"))
+	   {
+    	   safef(buf,sizeof(buf),"N/A");
+	   }
+	else
+	    {
+    	    safef(buf,sizeof(buf),"%.3f",sqlDouble(s));
+	    }
+	}
+    else
+	{
     safef(buf,sizeof(buf),"%.1f",sqlDouble(s));
+	}
+    }
 freeMem(s);
 hPrintf("<TD align=right>");
 hPrintf("%s", buf);
 hPrintf("</TD>");