429278d46bf69bb0b1228d8e8bb38e34afc26cc8 chinhli Thu Aug 18 16:09:04 2011 -0700 Finished geneReviews for OMIM genes diff --git src/hg/hgGene/geneReviews.c src/hg/hgGene/geneReviews.c index 0bdbbb0..44ff0cd 100644 --- src/hg/hgGene/geneReviews.c +++ src/hg/hgGene/geneReviews.c @@ -1,86 +1,87 @@ /* GeneReviews - print out GeneReviews for this gene. */ #include "common.h" #include "hash.h" #include "hdb.h" #include "linefile.h" #include "dystring.h" #include "hgGene.h" static void geneReviewsPrint(struct section *section, struct sqlConnection *conn, char *itemName) /* print GeneReviews short label associated to this refGene item */ { char query[256]; char * geneSymbol; if (sqlTablesExist(conn, "geneReviews")) { safef(query, sizeof(query), "select geneSymbol from kgXref where kgId = '%s'", itemName); geneSymbol = sqlQuickString(conn, query); if (geneSymbol != NULL) { prGRShortKg(conn,geneSymbol); } else { hPrintf("<B>No GeneReviews for this gene </B><BR>" ); } } } void prGRShortKg(struct sqlConnection *conn, char *itemName) /* print GeneReviews short label associated to this refGene item */ { struct sqlResult *sr; char **row; char query[512]; boolean firstTime = TRUE; safef(query, sizeof(query), "select geneSymbol, grShort, diseaseID, diseaseName from geneReviewsRefGene where geneSymbol='%s'", itemName); sr = sqlGetResult(conn, query); while ((row = sqlNextRow(sr)) != NULL) { if (firstTime) { printf("<B> Gene Symbol: </B>%s<BR>", row[0]); firstTime = FALSE; } printf("<A HREF=\"http://www.ncbi.nlm.nih.gov/books/n/gene/%s\" TARGET=_blank><B>%s:</B></A>",row[1], row[1]); - printf(" %s (Id: %s)<BR>", row[3], row[2]); + printf(" ( %s )<BR>", row[3]); } + sqlFreeResult(&sr); } static boolean geneReviewsExists(struct section *section, struct sqlConnection *conn, char *geneId) /* Return TRUE if geneReviews table exist and have GeneReviews articles * on this one. */ { char query[256]; char * geneSymbol; char * grSymbol; if (sqlTablesExist(conn, "geneReviews")) { safef(query, sizeof(query), "select geneSymbol from kgXref where kgId = '%s'", geneId); geneSymbol = sqlQuickString(conn, query); if (geneSymbol != NULL) { safef(query, sizeof(query), "select geneSymbol from geneReviewsRefGene where geneSymbol='%s'", geneSymbol); grSymbol = sqlQuickString(conn, query); if (grSymbol != NULL) { return TRUE; } } } return FALSE; } struct section *geneReviewsSection(struct sqlConnection *conn, struct hash *sectionRa) -/* Create geneReviews (aka Other Names) section. */ +/* Create geneReviews section. */ { struct section *section = sectionNew(sectionRa, "geneReviews"); section->exists = geneReviewsExists; section->print = geneReviewsPrint; return section; }