2f1a66397eab200e250d35782ad0ca6955697f9d
max
  Thu Jan 16 22:24:21 2014 -0800
breaking long lines in fasta view of pubs tracks, adding better sequenceIDs (refs #12212)

diff --git src/hg/hgc/pubs.c src/hg/hgc/pubs.c
index e922907..a968d65 100644
--- src/hg/hgc/pubs.c
+++ src/hg/hgc/pubs.c
@@ -1,30 +1,31 @@
 /* pubs.c - display details of publiations literature track (pubsxxx tables) */
 
 #include "common.h"
 #include "jksql.h"
 #include "hdb.h"
 #include "hgc.h"
 #include "hgColors.h"
 #include "trackDb.h"
 #include "web.h"
 #include "hash.h"
 #include "net.h"
 #include "obscure.h"
 #include "common.h"
 #include "string.h"
 #include "dystring.h"
+#include "dnautil.h"
 //#include "ctype.h"
 
 // cgi var to activate debug output
 static int pubsDebug = 0;
 
 // global var for printArticleInfo to indicate if article has suppl info 
 // Most publishers have supp data.
 // If they don't have it, we can skip the fileType column in the table
 bool pubsHasSupp = TRUE; 
 
 // global var for printArticleInfo to indicate if article is elsevier
 // If it's elsevier, we print the copyright line
 bool pubsIsElsevier = FALSE; 
 
 // the article source is used to modify other parts of the page
@@ -892,32 +893,35 @@
 // print filtering link at start of table & table headers
 if (isClickedSection) {
     printFilterLink(pslTable, articleId, articleTable);
     }
 
 if (!fasta) 
     printSeqHeaders(showDesc, isClickedSection);
 
 // output rows
 char **row;
 
 // the URL of the file from the clicked sequences, for YIF
 char *clickedFileUrl = NULL; 
 
 bool foundSkippedRows = FALSE;
+int rowId = 0;
 while ((row = sqlNextRow(sr)) != NULL)
     {
+    rowId++;
+
     char *fileDesc = row[0];
     char *snippet  = row[1];
     char *locString= row[2];
     //char *artId    = row[3];
     //char *fileId   = row[4];
     //char *seqId    = row[5];
     char *annotId = row[3];
     char *seq      = row[4];
     char *fileUrl  = row[5];
 
     // annotation (=sequence) ID is a 64 bit int with 10 digits for 
     // article, 3 digits for file, 5 for annotation
     //char annotId[100];
     
     // some debugging help
@@ -931,31 +935,38 @@
         continue;
     }
     // if we're in the clicked section and the current sequence is one that matched here
     // then keep the current URL, as we might need it afterwards
     else
         clickedFileUrl = cloneString(fileUrl);
 
     // suppress non-matches if the sequences come from YIF as figures can 
     // contain tons of non-matching sequences
     if (stringIn("yif", articleSource) && isEmpty(locString)) {
         foundSkippedRows = TRUE;
         continue;
     }
 
     if (fasta)
-        printf(">%s<br>%s<br>", annotId, seq);
+        {
+        if (strlen(extId)!=0)
+            printf("<tt><pre>&gt;%s-%d\n", extId, rowId);
+        else
+            printf("<tt><pre>&gt;seq%d\n", rowId);
+        writeSeqWithBreaks(stdout, seq, strlen(seq), 80);
+        printf("</pre></tt>\n");
+        }
     else
         {
         web2StartRow();
 
         // column 1: type of file (main or supp)
         if (showDesc) 
             {
             char linkStr[4096];
             if (isEmpty(fileDesc))
                 fileDesc = "main text";
             safef(linkStr, sizeof(linkStr), "<a href=\"%s\">%s</a>", fileUrl, fileDesc);
             web2PrintCellS("word-break:break-all", linkStr);
             }
         
         // column 2: snippet