d04a08d19a00407fb26c1abb5afa80247e84776c braney Wed Jul 29 15:11:32 2020 -0700 support hgGene calls without specifying a track. Also look for default gene track if table specified is knownGene diff --git src/hg/hgGene/hgGene.c src/hg/hgGene/hgGene.c index 11f279d..15bf3dd 100644 --- src/hg/hgGene/hgGene.c +++ src/hg/hgGene/hgGene.c @@ -710,31 +710,48 @@ doTxInfoDescription(); else { struct sqlConnection *conn = NULL; char *geneName = cartUsualString(cart, hggGene, NULL); if (isEmpty(geneName)) { // Silly googlebots. hUserAbort("Error: the hgg_gene parameter is missing from the cart and the CGI params."); } /* if kgProtMap2 table exists, this means we are doing KG III */ if (hTableExists(database, "kgProtMap2")) kgVersion = KG_III; char *tableName = cartUsualString(cart, hggType, NULL); + char *knownDb = hdbDefaultKnownDb(database); + + // if no table has been given to us, try knownGene + if (tableName == NULL) + tableName = "knownGene"; + struct trackDb *tdb = hTrackDbForTrack(database, tableName); + + if ((tdb == NULL) && sameString(tableName, "knownGene") && differentString(database, knownDb)) + { + // if no table or knownGene has been given to us, and knownGene doesn't work, try the default gene track. + tableName = hdbGetMasterGeneTrack(knownDb); + tdb = hTrackDbForTrack(database, tableName); + } + + if (tdb == NULL) + hUserAbort("Error: cannot open gene track %s.", tableName); + globalTdb = tdb; char *externalDb = trackDbSetting(tdb, "externalDb"); if (externalDb != NULL) conn = hAllocConn(externalDb); else conn = hAllocConn(database); curGeneId = findGeneId(conn, geneName); getGenePosition(conn); curGenePred = getCurGenePred(conn); curGeneName = getGeneName(curGeneId, conn); spConn = hAllocConn(UNIPROT_DB_NAME); swissProtAcc = getSwissProtAcc(conn, spConn, curGeneId); if (isRgdGene(conn)) swissProtAcc=getRgdGeneUniProtAcc(curGeneId, conn); /* Check command variables, and do the ones that