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("<TABLE style=\"background-color: #%s\" WIDTH=\"100%%\" CELLPADDING=\"2\">\n", HG_COL_BORDER); printf("<TR style=\"background-color: #%s; color: #FFFFFF\">\n", HG_COL_TABLE_LABEL); if (showDesc) puts(" <TH style=\"width: 10%\">Article file</TH>\n"); puts(" <TH style=\"width: 70%\">Sequence (in bold) with flanking text</TH>\n"); if (t2gDebug) puts(" <TH style=\"width: 30%\">Identifiers</TH>\n"); if (!isClickedSection && !t2gDebug) puts(" <TH style=\"width: 20%\">Matches</TH>\n"); puts("</TR>\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 <A HREF=\"../cgi-bin/hgc?%s&o=%s&t=%s&g=%s&i=%s&fasta=%d\"><SMALL>(switch fasta format)</SMALL></A>", 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("<TT>>%s<BR>%s<BR></TT>", annotId, seq); } else { printf("<TR style=\"background-color: #%s\">\n", HG_COL_LOCAL_TABLE); if (showDesc) printf("<TD style=\"word-break: normal\">%s\n", fileDesc); //printf("<TD><I>%s</I></TD>\n", snippet); printf("<TD style=\"word-break: normal\"><I>%s</I></TD>\n", snippet);