83441959486f273119187ddcc84eba2a70021ce2 max Sat May 16 07:30:32 2015 -0700 hgc: tolerate the absence of two big Genbank tables in refseq, with a warning diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 9fa8286..38fa392 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -9767,30 +9767,32 @@ hFreeConn(&conn2); } void doDecipher(struct trackDb *tdb, char *item, char *itemForUrl) /* Put up DECIPHER track info. */ { genericHeader(tdb, item); printDecipherDetails(tdb, item, FALSE); printTrackHtml(tdb); } char *gbCdnaGetDescription(struct sqlConnection *conn, char *acc) /* return mrna description, or NULL if not available. freeMem result */ { char query[1024]; +if (!hTableExists(database, "gbCdnaInfo")) + return NULL; sqlSafef(query, sizeof(query), "select description.name from gbCdnaInfo,description where (acc = '%s') and (gbCdnaInfo.description = description.id)", acc); char *desc = sqlQuickString(conn, query); if ((desc == NULL) || sameString(desc, "n/a") || (strlen(desc) == 0)) freez(&desc); return desc; } void printOmimGeneDetails(struct trackDb *tdb, char *itemName, boolean encode) /* Print details of an OMIM Gene entry. */ { struct sqlConnection *conn = hAllocConn(database); struct sqlConnection *conn2 = hAllocConn(database); char query[256]; struct sqlResult *sr; @@ -10982,32 +10984,43 @@ printf("", imgPath); /* add text column, if exists */ safef(textPath, sizeof(textPath), "../htdocs/geneExtra/%s.txt", geneFileBase); if (access(textPath, R_OK) == 0) { FILE *fh = mustOpen(textPath, "r"); printf(""); copyOpenFile(fh, stdout); fclose(fh); } } int gbCdnaGetVersion(struct sqlConnection *conn, char *acc) /* return mrna/est version, or 0 if not available */ +// define hHasTable(db,table) hTableExists(db,table) // like hFieldExists + { int ver = 0; +if (!hTableExists(database, "gbCdnaInfo")) + { + warn("Genbank information not shown below, the table %s.gbCdnaInfo is not installed " + "on this server. ", database); + //"The information below is a shortened version of the one shown on the " + //"UCSC site", database); + return 0; + } + if (hHasField(database, "gbCdnaInfo", "version")) { char query[128]; sqlSafef(query, sizeof(query), "select version from gbCdnaInfo where acc = '%s'", acc); ver = sqlQuickNum(conn, query); } return ver; } static void prRefGeneXenoInfo(struct sqlConnection *conn, struct refLink *rl) /* print xeno refseq info, including linking to the browser, if any */ { char query[256]; sqlSafef(query, sizeof(query), "select organism.name from gbCdnaInfo,organism " @@ -11472,34 +11485,40 @@ /* optional summary text */ summary = getRefSeqSummary(conn, sqlRnaName); if (summary != NULL) { htmlHorizontalLine(); printf("

Summary of %s

\n", rl->name); printf("

%s

\n", summary); freeMem(summary); } htmlHorizontalLine(); /* print alignments that track was based on */ { char *aliTbl = (sameString(tdb->table, "refGene") ? "refSeqAli" : "xenoRefSeqAli"); +if (hTableExists(database, aliTbl)) + { struct psl *pslList = getAlignments(conn, aliTbl, rl->mrnaAcc); printf("

mRNA/Genomic Alignments

"); printAlignments(pslList, start, "htcCdnaAli", aliTbl, rl->mrnaAcc); } +else + warn("Sequence alignment links not shown below, the table %s.refSeqAli is not installed " + "on this server", database); +} htmlHorizontalLine(); struct palInfo *palInfo = NULL; if (genbankIsRefSeqCodingMRnaAcc(rnaName)) { AllocVar(palInfo); palInfo->chrom = chrom; palInfo->left = left; palInfo->right = right; palInfo->rnaName = rnaName; } geneShowPosAndLinksPal(rl->mrnaAcc, rl->protAcc, tdb, "refPep", "htcTranslatedProtein",