6b5c7b20c21c9ef98687bb8d970ca2b96306c660
max
Tue Apr 23 17:46:02 2013 -0700
additional debug statements
diff --git src/hg/hgc/pubs.c src/hg/hgc/pubs.c
index e9d5388..b5d8b66 100644
--- src/hg/hgc/pubs.c
+++ src/hg/hgc/pubs.c
@@ -483,30 +483,32 @@
safef(query, sizeof(query), "SELECT seqIds,'' FROM %s WHERE name='%s' "
"and chrom='%s' and chromStart=%d;", trackTable, item, seqName, start);
if (pubsDebug)
printf("%s
", query);
// split comma-sep list into parts
char *seqIdCoordString = sqlQuickString(conn, query);
char *seqIdCoords[1024];
int partCount = chopString(seqIdCoordString, ",", seqIdCoords, ArraySize(seqIdCoords));
int i;
struct hash *seqIdHash = NULL;
seqIdHash = newHash(0);
for (i=0; i", seqIdCoords[i]);
hashAdd(seqIdHash, seqIdCoords[i], NULL);
}
return seqIdHash;
}
static void printSeqHeaders(bool showDesc, bool isClickedSection)
/* print table and headers */
{
//style=\"margin: 10px auto; width: 98%%\"style=\"background-color: #fcecc0\"
web2StartTableC("stdTbl centeredStdTbl");
web2StartTheadC("stdTblHead");
if (showDesc)
web2PrintHeaderCell("Article file", 10);
@@ -638,31 +640,31 @@
web2EndSection();
}
static bool printSeqSection(char *articleId, char *title, bool showDesc, struct sqlConnection *conn, struct hash* clickedSeqs, bool isClickedSection, bool fasta, char *pslTable, char *articleTable)
/* print a section with a table of sequences, show only sequences with IDs in hash,
* There are two sections, respective sequences are shown depending on isClickedSection and clickedSeqs
* - seqs that were clicked on (isClickedSection=True) -> show only seqs in clickedSeqs
* - other seqs (isClickedSection=False) -> show all other seqs
*
* */
{
// get data from mysql
char query[4096];
safef(query, sizeof(query),
-"SELECT fileDesc, snippet, locations, articleId, fileId, seqId, sequence, fileUrl "
+"SELECT fileDesc, snippet, locations, annotId, sequence, fileUrl "
"FROM %s WHERE articleId='%s';", pubsSequenceTable, articleId);
if (pubsDebug)
puts(query);
struct sqlResult *sr = sqlGetResult(conn, query);
// construct title for section
char *otherFormat = NULL;
if (fasta)
otherFormat = "table";
else
otherFormat = "fasta";
char fullTitle[5000];
safef(fullTitle, sizeof(fullTitle),
"%s (%s format)\n",
@@ -679,44 +681,45 @@
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;
while ((row = sqlNextRow(sr)) != NULL)
{
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 *seq = row[6];
- char *fileUrl = row[7];
+ //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];
+ //char annotId[100];
// some debugging help
- safef(annotId, 100, "%010d%03d%05d", atoi(artId), atoi(fileId), atoi(seqId));
- if (pubsDebug)
- printf("%s", annotId);
+ //safef(annotId, 100, "%10d%03d%05d", atoi(artId), atoi(fileId), atoi(seqId));
+ //if (pubsDebug)
+ //printf("artId %s, file %s, annot %s -> annotId %s
", artId, fileId, seqId, annotId);
// only display this sequence if we're in the right section
if (clickedSeqs!=NULL && ((hashLookup(clickedSeqs, annotId)!=NULL) != isClickedSection)) {
foundSkippedRows = TRUE;
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;
@@ -734,31 +737,32 @@
{
char linkStr[4096];
safef(linkStr, sizeof(linkStr), "%s", fileUrl, fileDesc);
web2PrintCellS("word-break:break-all", linkStr);
}
// column 2: snippet
web2StartCellS("word-break:break-all");
if (stringIn("yif", articleSource))
removeFlank(snippet);
printAddWbr(snippet, 40);
web2EndCell();
// optional debug info column
if (pubsDebug)
- web2PrintCellF("article %s, file %s, seq %s, annotId %s", artId, fileId, seqId, annotId);
+ //web2PrintCellF("article %s, file %s, seq %s, annotId %s", artId, fileId, seqId, annotId);
+ web2PrintCellF("annotId %s", annotId);
// column 3: print links to locations, only print this in the 2nd section
if (!isClickedSection && !pubsDebug)
{
// format: hg19/chr1:300-400,mm9/chr1:60006-23234
// split on "," then split on "/"
//locs = charSepToSlNames(locString, ',');
web2StartCell();
char *locArr[1024];
int partCount = chopString(locString, ",", locArr, ArraySize(locArr));
if (partCount==0)
printf("No matches");
else
{
@@ -768,30 +772,32 @@
printGbLinks(locs);
printf("
");
slFreeList(&locs);
}
web2EndCell();
}
web2EndRow();
}
}
if (!fasta)
web2EndTable();
web2EndSection();
/* Yale Image finder files contain links to the image itself */
+if (pubsDebug)
+ printf("%s %s %d", articleSource, clickedFileUrl, isClickedSection);
if (stringIn("yif", articleSource) && (clickedFileUrl!=NULL) && isClickedSection)
printYifSection(clickedFileUrl);
freeMem(clickedFileUrl);
sqlFreeResult(&sr);
return foundSkippedRows;
}
static void printSeqInfo(struct sqlConnection *conn, char *trackTable,
char *pslTable, char *articleId, char *item, char *seqName, int start,
bool fileDesc, bool fasta, char *articleTable)
/* print sequences, split into two sections
* two sections: one for sequences that were clicked, one for all others*/
{