16ec9357014d6670ffe6464487e962a4e3ed9332
braney
Thu Apr 16 16:41:19 2020 -0700
add secondary structure picture
diff --git src/hg/hgc/rnaFoldClick.c src/hg/hgc/rnaFoldClick.c
index 36e514b..3c1c30f 100644
--- src/hg/hgc/rnaFoldClick.c
+++ src/hg/hgc/rnaFoldClick.c
@@ -5,30 +5,31 @@
#include "common.h"
#include "jksql.h"
#include "hgMaf.h"
#include "maf.h"
#include "cart.h"
#include "hgc.h"
#include "hCommon.h"
#include "hgColors.h"
#include "obscure.h"
#include "customTrack.h"
#include "htmshell.h"
#include "rnautil.h"
#include "rnaSecStr.h"
#include "memalloc.h"
+#include "hgConfig.h"
/* Taken from hgc.c (should probably be in hgc.h)*/
#define RED 0xFF0000
#define GREEN 0x00FF00
#define BLUE 0x0000FF
#define BLACK 0x000000
#define CYAN 0x00FFFF
#define GRAY 0xcccccc
#define LTGRAY 0x999999
#define ORANGE 0xDD6600
#define MAGENTA 0xFF00FF
#define LTPURPLE 0x9966CC
#define SCORE_SHADES_COUNT 10
@@ -356,30 +357,70 @@
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)
+/* 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);
+
+char command[512];
+char psName[512];
+safef(psName, sizeof(psName), "../trash/%s/%s_%s.ps", table, table, item->name);
+FILE *of = popen(rnaPlotPath, "w");
+if (of != NULL)
+ {
+ 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("", 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);
if (fileExists(fileName))
{
fprintf(f, "