3c1ba77a75a368afa365015b2cf4a2f34da10582
hiram
  Tue Jan 31 15:27:59 2012 -0800
addComma becomes addCommaSpace
diff --git src/hg/hgGene/synonym.c src/hg/hgGene/synonym.c
index 07dec71..feab9ee 100644
--- src/hg/hgGene/synonym.c
+++ src/hg/hgGene/synonym.c
@@ -158,68 +158,81 @@
     /* since kg is not by location (even though we have a
      * curGeneStart/curGeneEnd), we need to use the location in the 
      * ccdsGeneMap */
     for (ccdsKg = ccdsKgs; ccdsKg != NULL; ccdsKg = ccdsKg->next)
         {
         if (ccdsKg != ccdsKgs)
             hPrintf(", ");
         hPrintf("<A href=\"../cgi-bin/hgc?%s&g=ccdsGene&i=%s&c=%s&o=%d&l=%d&r=%d&db=%s\">%s</A>",
                 cartSidUrlString(cart), ccdsKg->ccdsId, ccdsKg->chrom, ccdsKg->chromStart, ccdsKg->chromStart,
                 ccdsKg->chromEnd, database, ccdsKg->ccdsId);
         }
     hPrintf("<BR>\n");   
     }
 }
 
-char *addComma(char *inStr)
+static char *addCommaSpace(char *inStr)
+/* return all converted character '|' found in inStr to string ', '  */
 {
-char *chp;
+char outStr[2048];
+
+char *chp, *chpOut;
 chp = inStr;
+chpOut = outStr;
 
 while (*chp != '\0')
     {
+    *chpOut = *chp;
     if (*chp == '|')
-       *chp = ',';
+       {
+       *chpOut = ',';
+       chpOut ++;
+       *chpOut = ' ';
+       }
     chp++;
+    chpOut++;
     }
-return inStr;
+*chpOut = '\0';
+
+//return inStr;
+return strdup(outStr);
 }
 
 static void rgdGene2SynonymPrint(struct section *section,
         struct sqlConnection *conn, char *rgdGeneId)
 {
 char *geneSym = NULL, *geneName = NULL;
 char query[256], **row;
 struct sqlResult *sr;
 if (rgdGeneId != NULL)
     {
     safef(query, sizeof(query), 
 	    "select old_symbol, old_name from rgdGene2Raw where gene_rgd_id = '%s'", 
 	    rgdGeneId+4L);
     sr = sqlGetResult(conn, query);
     if ((row = sqlNextRow(sr)) != NULL)
 	{
 	if (row[0][0] != 0 && !sameString(row[0], "n/a"))
 	    {
 	    geneSym = cloneString(row[0]);
-	    hPrintf("<B>Symbol:</B> %s ", addComma(row[0]));
+	    hPrintf("<B>Symbol:</B> %s ", addCommaSpace(row[0]));
 	    hPrintf("<BR>\n");
 	    }
 	if (row[1][0] != 0 && !sameString(row[0], "n/a"))
 	    {
 	    geneName = cloneString(row[1]);
-	    hPrintf("<B>Name:</B> %s ", addComma(geneName));
+	    hPrintf("<B>Name:</B> %s ", addCommaSpace(geneName));
 	    hPrintf("<BR>\n");
 	    }
 	}
     sqlFreeResult(&sr);
 
     safef(query, sizeof(query), 
 	    "select value from rgdGene2ToRefSeq where name= '%s'", rgdGeneId);
     sr = sqlGetResult(conn, query);
     if ((row = sqlNextRow(sr)) != NULL)
 	{
         hPrintf("<B>RefSeq Accession: </B> <A HREF=\"");
 	printOurRefseqUrl(stdout, row[0]);
 	hPrintf("\">%s</A><BR>\n", row[0]);
 	}
     sqlFreeResult(&sr);