8cbe92ce4bcae03bb4a7a896698fbbcd8e6daac6
fanhsu
  Mon Aug 1 10:11:10 2011 -0700
Renamed htmlPrintSecStrDrawing to htmlPrintSecStrEvofoldDrawing for clarity.  And added function for evofoldV2.
diff --git src/hg/hgc/rnaFoldClick.c src/hg/hgc/rnaFoldClick.c
index e1539fa..7e7f01b 100644
--- src/hg/hgc/rnaFoldClick.c
+++ src/hg/hgc/rnaFoldClick.c
@@ -305,31 +305,31 @@
     if ((mcThis = mafMayFindCompSpecies(maf, species[i], '.')) == NULL)
 	continue;
     newOrder[mcCount++] = mcThis;
   }
 
 maf->components = NULL;
 for (i = 0; i < mcCount; i++)
   {
     newOrder[i]->next = 0;
     slAddHead(&maf->components, newOrder[i]);
   }
 
 slReverse(&maf->components);
 }
 
-void htmlPrintSecStrDrawing(FILE *f, struct rnaSecStr *item)
+void htmlPrintSecStrEvofoldDrawing(FILE *f, struct rnaSecStr *item)
 {
 char fileName[512];
 struct dnaSeq *seq;
 seq = hChromSeq(database, item->chrom, item->chromStart, item->chromEnd);
 touppers(seq->dna);
 if (item->strand[0] == '-')
     reverseComplement(seq->dna, seq->size);
 memSwapChar(seq->dna, seq->size, 'T', 'U');
 
 safef(fileName, sizeof(fileName), "/gbdb/%s/evoFold/%s/%s.png",
        database, item->chrom, item->name);
 if (fileExists(fileName))
     {
     fprintf(f, "<center><h2> RNA secondary structure drawing </h2></center>");
     fprintf(f,"<B>");
@@ -337,30 +337,62 @@
     // Could consider to serve up all EvoFold .png files from our public server in the future
     // fprintf(f,"<IMG SRC=\"http://genome.ucsc.edu/evoFold/%s/%s/%s.png\" border = '2' ALT=\"ERROR: VARA plotting failed.\"</B><BR>",
     fprintf(f,"<IMG SRC=\"../evoFold/%s/%s/%s.png\" border = '2' ALT=\"ERROR: VARA plotting failed.\"</B><BR>",
             database, item->chrom, item->name);
     fprintf(f,"</B>");
     }
 
 freeMem(seq);
 printf("<p>The UCSC Genome Browser mirror site at the Molecular Diagnostic Laboratory (MDL) at Aarhus University Hospital Skejby in Denmark offers a VARNA Java applet to view the above RNA structure with more options, ");
 printf("<A HREF=\"");
 printf("http://moma.ki.au.dk/genome-mirror/cgi-bin/hgc?db=%s&o=%d&t=%d&g=evofold&i=%s",
 database, item->chromStart, item->chromEnd, cgiEncode(item->name));
 printf("\" TARGET=_blank>%s</A></p>", "click here to go to moma.ki.au.dk/genome-mirror.");
 }
 
+void htmlPrintSecStrEvofoldV2Drawing(FILE *f, struct rnaSecStr *item)
+{
+char fileName[512];
+struct dnaSeq *seq;
+seq = hChromSeq(database, item->chrom, item->chromStart, item->chromEnd);
+touppers(seq->dna);
+if (item->strand[0] == '-')
+    reverseComplement(seq->dna, seq->size);
+memSwapChar(seq->dna, seq->size, 'T', 'U');
+
+safef(fileName, sizeof(fileName), "/gbdb/%s/evoFoldV2/%s/%s.png",
+       database, item->chrom, item->name);
+if (fileExists(fileName))
+    {
+    fprintf(f, "<center><h2> RNA secondary structure drawing </h2></center>");
+    fprintf(f,"<B>");
+
+    // Could consider to serve up all EvoFold .png files from our public server in the future
+    // fprintf(f,"<IMG SRC=\"http://genome.ucsc.edu/evoFold/%s/%s/%s.png\" border = '2' ALT=\"ERROR: VARA plotting failed.\"</B><BR>",
+    fprintf(f,"<IMG SRC=\"../evoFoldV2/%s/%s/%s.png\" border = '2' ALT=\"ERROR: VARA plotting failed.\"</B><BR>",
+            database, item->chrom, item->name);
+    fprintf(f,"</B>");
+    }
+
+freeMem(seq);
+printf("<p>The UCSC Genome Browser mirror site at the Molecular Diagnostic Laboratory (MDL) at Aarhus University Hospital Skejby in Denmark offers a VARNA Java applet to view the above RNA structure with more options, ");
+printf("<A HREF=\"");
+printf("http://moma.ki.au.dk/genome-mirror/cgi-bin/hgc?db=%s&o=%d&t=%d&g=evofoldV2&i=%s",
+database, item->chromStart, item->chromEnd, cgiEncode(item->name));
+printf("\" TARGET=_blank>%s</A></p>", "click here to go to moma.ki.au.dk/genome-mirror.");
+}
+
 void doRnaSecStr(struct trackDb *tdb, char *itemName)
 /* Handle click on rnaSecStr type elements. */
 {
 char *table = tdb->table;
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr;
 struct rnaSecStr *item;
 char extraWhere[256];
 char **row;
 int  rowOffset = 0;
 char *mafTrack = trackDbRequiredSetting(tdb, "mafTrack");
 int start = cartInt(cart, "o");
 struct mafAli *maf;
 char option[128];
 char *speciesOrder = NULL;
@@ -383,27 +415,34 @@
 speciesOrder = cartUsualString(cart, option, NULL);
 if (speciesOrder == NULL)
   speciesOrder = trackDbSetting(tdb, "speciesOrder");
 if (speciesOrder)
   mafSortBySpeciesOrder(maf, speciesOrder);
 
 mafAndFoldHeader(stdout);
 htmlPrintMafAndFold(stdout, maf, item->secStr, item->conf, 100);
 
 mafAndFoldLegend(stdout);
 
 /* Draw structure for evoFold */
 if (sameWord(tdb->table, "evofold"))
     {
 htmlHorizontalLine();
-htmlPrintSecStrDrawing(stdout, item);
+    htmlPrintSecStrEvofoldDrawing(stdout, item);
+    }
+
+/* Draw structure for evoFoldV2 */
+if (sameWord(tdb->table, "evofoldV2"))
+    {
+    htmlHorizontalLine();
+    htmlPrintSecStrEvofoldV2Drawing(stdout, item);
     }
 
 /* track specific html */
 printTrackHtml(tdb);
 
 /* clean up */
 mafAliFree(&maf);
 rnaSecStrFree(&item);
 sqlFreeResult(&sr);
 hFreeConn(&conn);
 }