src/hg/hgc/hgc.c 1.1605
1.1605 2010/03/19 18:38:15 fanhsu
Updated logic for tRNAs to fix problems with image file names containing '?'.
Index: src/hg/hgc/hgc.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/hgc.c,v
retrieving revision 1.1604
retrieving revision 1.1605
diff -b -B -U 4 -r1.1604 -r1.1605
--- src/hg/hgc/hgc.c 15 Mar 2010 21:19:29 -0000 1.1604
+++ src/hg/hgc/hgc.c 19 Mar 2010 18:38:15 -0000 1.1605
@@ -10441,8 +10441,12 @@
/* use TABLE to align image with other info side by side */
printf("<TABLE>");
while ((row = sqlNextRow(sr)) != NULL)
{
+ char imgFileName[512];
+ char encodedName[255];
+ char *chp1, *chp2;
+ int i, len;
printf("<TR>");
printf("<TD valign=top>");
trna = tRNAsLoad(row+rowOffset);
@@ -10470,10 +10474,43 @@
printf("</TD>");
printf("<TD>");
- printf("<img align=right src=\"../RNA-img/%s/%s-%s.gif\" alt='tRNA secondary structure is not available for %s'>\n",
+
+ /* encode '?' in tRNA name into "%3F" */
+ len = strlen(trna->name);
+ chp1 = trna->name;
+ chp2 = encodedName;
+ for (i=0; i<len; i++)
+ {
+ if (*chp1 == '?')
+ {
+ *chp2 = '%';
+ chp2++; *chp2 = '3';
+ chp2++; *chp2 = 'F';
+ }
+ else
+ {
+ *chp2 = *chp1;
+ }
+ chp1++;
+ chp2++;
+ }
+ *chp2 = '\0';
+
+ sprintf(imgFileName, "../htdocs/RNA-img/%s/%s-%s.gif", database,database,trna->name);
+ if (fileExists(imgFileName))
+ {
+ printf(
+ "<img align=right src=\"../RNA-img/%s/%s-%s.gif\" alt='tRNA secondary structure for %s'>\n",
+ database,database,encodedName,trna->name);
+ }
+ else
+ {
+ printf(
+ "<img align=right src=\"../RNA-img/%s/%s-%s.gif\" alt='tRNA secondary structure is not available for %s'>\n",
database,database,trna->name,trna->name);
+ }
printf("</TD>");
printf("</TR>");
}