700758c7e3fabc5cd1f925d8da37c5ee4bee3bd0 max Sat Mar 17 13:56:32 2012 -0700 fixed wbr bug and added pmid output redmine #6833 diff --git src/hg/hgc/pubs.c src/hg/hgc/pubs.c index c731e05..a722cbc 100644 --- src/hg/hgc/pubs.c +++ src/hg/hgc/pubs.c @@ -174,46 +174,52 @@ if (pubsDebug) printf("articleId=%s", articleId); printf("%s

", snippets); printf("


"); } freeMem(sectionList); sqlFreeResult(&sr); } static char* printArticleInfo(struct sqlConnection *conn, char* item) /* Header with information about paper, return documentId */ { char query[512]; - safef(query, sizeof(query), "SELECT articleId, url, title, authors, citation, abstract FROM %s WHERE displayId='%s'", pubsArticleTable, item); + safef(query, sizeof(query), "SELECT articleId, url, title, authors, citation, abstract, pmid FROM %s WHERE displayId='%s'", pubsArticleTable, item); struct sqlResult *sr = sqlGetResult(conn, query); char **row; char *articleId=NULL; if ((row = sqlNextRow(sr)) != NULL) { + char* cit = row[4]; char* abstract = row[5]; + char* pmid = row[6]; + if (strlen(abstract)==0) { abstract = "(No abstract found for this article. Please use the link to the fulltext above.)"; } articleId = cloneString(row[0]); printf("

%s

\n", row[3]); printf("%s\n", row[1], row[2]); - printf("

%s

\n", row[4]); + printf("

%s", cit); + if (nullIfAllSpace(pmid)!=NULL) + printf(", PMID%s\n", pmid, pmid); + printf("

\n"); printf("

%s

\n", abstract); } sqlFreeResult(&sr); return articleId; } static struct hash* getSeqIdHash(struct sqlConnection* conn, char* trackTable, \ char* articleId, char *item, char* seqName, int start) /* return a hash with the sequence IDs for a given chain of BLAT matches */ { char query[512]; /* check first if the column exists (some debugging tables on hgwdev don't have seqIds) */ safef(query, sizeof(query), "SHOW COLUMNS FROM %s LIKE 'seqIds';", trackTable); char* seqIdPresent = sqlQuickString(conn, query); if (!seqIdPresent) { @@ -263,33 +269,39 @@ if (!isClickedSection && !pubsDebug) puts(" Feature that includes this match\n"); puts("\n"); } static void printAddWbr(char* text, int distance) /* a crazy hack for firefox/mozilla that is unable to break long words in tables * We need to add a tag every x characters in the text to make text breakable. */ { int i; i = 0; char* c; c = text; +bool doNotBreak = FALSE; while (*c != 0){ { - if (i % distance == 0) + if (*c=='&') + doNotBreak = TRUE; + if (*c==';') + doNotBreak = FALSE; + + if (i % distance == 0 && ! doNotBreak) printf(""); printf("%c", *c); c++; i++; } } } static bool printSeqSection(char* articleId, 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 * * */