f3b76f9ac68bc77dfbc2639486d9902d8d6cf4aa
max
Tue Dec 13 14:00:55 2011 -0800
incorporated larrym's changes to source code style
diff --git src/hg/hgc/t2g.c src/hg/hgc/t2g.c
index aca4595..791d9ee 100644
--- src/hg/hgc/t2g.c
+++ src/hg/hgc/t2g.c
@@ -80,32 +80,36 @@
void printSeqHeaders(bool showDesc, bool isClickedSection)
{
printf("
\n", HG_COL_BORDER);
printf("\n", HG_COL_TABLE_LABEL);
if (showDesc)
puts(" Article file | \n");
puts(" Sequence (in bold) with flanking text | \n");
if (t2gDebug)
puts(" Identifiers | \n");
if (!isClickedSection && !t2gDebug)
puts(" Matches | \n");
puts("
\n");
}
-bool printSeqSection(char* docId, char* title, bool showDesc, struct sqlConnection* conn, struct hash* filterIdHash, bool isClickedSection, bool fasta)
+bool printSeqSection(char* docId, char* title, bool showDesc, struct sqlConnection* conn, struct hash* clickedSeqs, bool isClickedSection, bool fasta)
/* print 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 FROM %s WHERE articleId='%s';", sequenceTable, docId);
if (t2gDebug)
puts(query);
struct sqlResult *sr = sqlGetResult(conn, query);
// construct title for section
char fullTitle[5000];
safef(fullTitle, sizeof(fullTitle),
"%s (switch fasta format)",
title, cartSidUrlString(cart), cgiString("o"), cgiString("t"), cgiString("g"), cgiString("i"),
!fasta);
@@ -121,31 +125,31 @@
{
char* fileDesc = row[0];
char* snippet = row[1];
char* locList = row[2];
char* artId = row[3];
char* fileId = row[4];
char* seqId = row[5];
char* seq = row[6];
// annotation (=sequence) ID is a 64 bit int with 10 digits for
// article, 3 digits for file, 5 for annotation
char annotId[100];
safef(annotId, 100, "%010d%03d%05d", atoi(artId), atoi(fileId), atoi(seqId));
// only display this sequence if we're in the right section
- if (filterIdHash!=NULL && ((hashLookup(filterIdHash, annotId)==0) ^ !isClickedSection)) {
+ if (clickedSeqs!=NULL && ((hashLookup(clickedSeqs, annotId)!=0) != isClickedSection)) {
foundSkippedRows = TRUE;
continue;
}
if (fasta)
{
printf(">%s
%s
", annotId, seq);
}
else
{
printf("\n", HG_COL_LOCAL_TABLE);
if (showDesc)
printf("%s\n", fileDesc);
//printf(" | %s | \n", snippet);
printf("%s | \n", snippet);