src/hg/hgc/hgc.c 1.1571

1.1571 2009/09/09 17:02:01 markd
integrated carefully reviewed changes from Robert to retro gene details page
Index: src/hg/hgc/hgc.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/hgc.c,v
retrieving revision 1.1570
retrieving revision 1.1571
diff -b -B -U 4 -r1.1570 -r1.1571
--- src/hg/hgc/hgc.c	8 Sep 2009 23:24:44 -0000	1.1570
+++ src/hg/hgc/hgc.c	9 Sep 2009 17:02:01 -0000	1.1571
@@ -2457,8 +2457,11 @@
  * set it up so they can click through to the alignment. */
 if (hGenBankHaveSeq(database, item, NULL))
     {
     printf("<H3>%s/Genomic Alignments</H3>", item);
+    if (sameString("protein", subType))
+        printAlignments(pslList, start, "htcProteinAli", tdb->tableName, item);
+    else
     printAlignments(pslList, start, "htcCdnaAli", tdb->tableName, item);
     }
 else
     {
@@ -5303,9 +5306,9 @@
     return;
     }
 htmlHorizontalLine();
 printf("<H3>%s/Genomic Alignments</H3>", type);
-if (sameString(tdb->tableName, "mrnaBlastz"))
+if (startsWith("mrnaBlastz",tdb->tableName))
     slSort(&pslList, pslCmpScoreDesc);
 
 printAlignments(pslList, start, "htcCdnaAli", table, acc);
 
@@ -6356,8 +6359,9 @@
     fprintf(index, "<A HREF=\"../%s#%d\" TARGET=\"body\">block%d</A><BR>\n",
 	    bodyTn.forCgi, i, i);
     }
 fprintf(index, "<A HREF=\"../%s#ali\" TARGET=\"body\">together</A><BR>\n", bodyTn.forCgi);
+htmEnd(index);
 fclose(index);
 chmod(indexTn.forCgi, 0666);
 
 /* Write (to stdout) the main html page containing just the frame info. */
@@ -6615,12 +6619,19 @@
     sqlFreeResult(&sr);
 
     if (startsWith("ucscRetroAli", track) || startsWith("retroMrnaAli", track) || sameString("pseudoMrna", track))
 	{
-        char *suffix = strstr(acc, ".");
-        if (suffix != NULL)
-            *suffix = '\0';
-        rnaSeq = hDnaSeqGet(database, acc, "retroSeq", "retroExtFile");
+        struct trackDb *tdb = hashMustFindVal(trackHash, track);
+        rnaSeq = NULL;
+        char *spec = trackDbRequiredSetting(tdb, BASE_COLOR_USE_SEQUENCE);
+        char *specCopy = cloneString(spec);
+
+        // value is: extFile seqTbl extFileTbl
+        char *words[3];
+        int nwords = chopByWhite(specCopy, words, ArraySize(words));
+        if ((nwords != ArraySize(words)) || !sameString(words[0], "extFile"))
+            errAbort("invalid %s track setting: %s", BASE_COLOR_USE_SEQUENCE, spec);
+        rnaSeq = hDnaSeqGet(database, acc, words[1], words[2]);
 	}
     else if (sameString("HInvGeneMrna", track))
 	{
 	/* get RNA accession for the gene id in the alignment */