41bbd268df98df338d98b6b98c62ab595d85aff1
braney
  Mon May 4 14:19:12 2020 -0700
don't print out conf field in rnaStruct tables if not present.   Added
link to PseudoViewer

diff --git src/hg/hgc/rnaFoldClick.c src/hg/hgc/rnaFoldClick.c
index 3c1c30f..5d8804f 100644
--- src/hg/hgc/rnaFoldClick.c
+++ src/hg/hgc/rnaFoldClick.c
@@ -357,31 +357,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 htmlPrintSecStr(FILE *f, char *table, struct rnaSecStr *item)
+void htmlPrintSecStr(FILE *f, char *table, struct rnaSecStr *item, int start)
 /* Print out the details for an rnaStruct* table. */
 {
 // grab the sequence
 struct dnaSeq *seq = hChromSeq(database, item->chrom, item->chromStart, item->chromEnd);
 touppers(seq->dna);
 if (item->strand[0] == '-')
     reverseComplement(seq->dna, seq->size);
 toRna(seq->dna);
 
 // make sure the dna is not longer than the paren string
 seq->dna[strlen(item->secStr)] = 0;
 
 char *rnaPlotPath = cfgOptionDefault("rnaPlotPath", "../cgi-bin/RNAplot");
 mkdirTrashDirectory(table);
 
@@ -394,30 +394,33 @@
     fprintf(of, ">%s\n", psName);        /* This tells where to put file. */
     fprintf(of, "%s\n%s\n", seq->dna, item->secStr);
     pclose(of);
     }
 
 char pngName[256];
 char *rootName = cloneString(psName);
  
 chopSuffix(rootName);
 safef(pngName, sizeof(pngName), "%s.png", rootName);
 
 safef(command, sizeof(command),
     "gs -g768x768 -sDEVICE=png16m -sOutputFile=%s -dBATCH -dNOPAUSE -q %s" , pngName, psName);
 mustSystem(command);
 
+printf("<a target=blank href='http://pseudoviewer.inha.ac.kr/WSPV_quickSender.asp?seq=%s&str=%s&start=%d'>Display on PseudoViewer</a><BR>", seq->dna, item->secStr, start);
+htmlHorizontalLine();
+printf("RNAFold diagram:<BR>");
 printf("<IMG SRC='%s' border = '2'>", pngName);
 }
 
 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);
@@ -485,65 +488,69 @@
 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 = trackDbSetting(tdb, "mafTrack");
 int start = cartInt(cart, "o");
 struct mafAli *maf;
 char option[128];
 char *speciesOrder = NULL;
+boolean hasConf = sqlColumnExists(conn, table, "conf");
 
 /* print header */
 genericHeader(tdb, itemName);
 /* printRfamUrl(itemName); */
 genericBedClick(conn, tdb, itemName, start, 6);
-htmlHorizontalLine();
 
 /* get the rnaSecStr and maf from db */
 sprintf(extraWhere, "chromStart = %d and name = '%s'", start, itemName);
 sr   = hExtendedChromQuery(conn, table, seqName, extraWhere,  FALSE, NULL, &rowOffset);
 row  = sqlNextRow(sr);
+if (hasConf)
+    item = rnaSecStrLoadConf(row + rowOffset);
+else
     item = rnaSecStrLoad(row + rowOffset);
 if (mafTrack)
     {
+    htmlHorizontalLine();
     maf  = mafFromRnaSecStrItem(mafTrack, item);
 
     /* order maf by species */
     safef(option, sizeof(option), "%s.speciesOrder", tdb->track);
     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 rnaStruct* table */
 if (startsWith("rnaStruct", tdb->table))
     {
     htmlHorizontalLine();
-    htmlPrintSecStr(stdout, tdb->table, item);
+    htmlPrintSecStr(stdout, tdb->table, item, start);
     }
 if (sameWord(tdb->table, "evofold"))
     {
     htmlHorizontalLine();
     htmlPrintSecStrEvofoldDrawing(stdout, item);
     }
 
 /* Draw structure for evoFoldV2 */
 if (sameWord(tdb->table, "evofoldV2"))
     {
     htmlHorizontalLine();
     htmlPrintSecStrEvofoldV2Drawing(stdout, item);
     }
 
 /* track specific html */