3589900a038034a6c2112c308946f67889c11170 braney Fri May 15 11:40:30 2020 -0700 fix URL to Comparative Toxicogenomics Database diff --git src/hg/hgGene/ctd.c src/hg/hgGene/ctd.c index 25129ab..c638e16 100644 --- src/hg/hgGene/ctd.c +++ src/hg/hgGene/ctd.c @@ -1,145 +1,145 @@ /* ctd - do CTD section. */ /* Copyright (C) 2013 The Regents of the University of California * See README in this or parent directory for licensing information. */ #include "common.h" #include "hash.h" #include "linefile.h" #include "dystring.h" #include "cheapcgi.h" #include "spDb.h" #include "hgGene.h" #include "hdb.h" #include "net.h" static boolean ctdExists(struct section *section, struct sqlConnection *conn, char *geneId) /* Return TRUE if CTD database exists and it has an entry with the gene symbol */ { char query[1024]; char *geneSymbol; if (isRgdGene(conn)) { if (sqlTableExists(conn, "rgdGene2Xref") == FALSE) return FALSE; } else { if (sqlTableExists(conn, "kgXref") == FALSE) return FALSE; } if (sqlTableExists(conn, "hgFixed.ctdSorted") == TRUE) { if (isRgdGene(conn)) { sqlSafef(query, sizeof(query), "select ChemicalId from rgdGene2Xref x, hgFixed.ctdSorted c" " where x.info=c.GeneSymbol and infoType = 'Name' and rgdGeneId='%s' limit 1", geneId); geneSymbol = sqlQuickString(conn, query); } else { sqlSafef(query, sizeof(query), "select ChemicalId from kgXref x, hgFixed.ctdSorted c" " where x.geneSymbol=c.GeneSymbol and kgId='%s' limit 1", geneId); geneSymbol = sqlQuickString(conn, query); } if (geneSymbol != NULL) return(TRUE); } return(FALSE); } static void ctdPrint(struct section *section, struct sqlConnection *conn, char *geneId) /* Print out CTD section. */ { char query[256]; struct sqlResult *sr; char **row; char *chemId, *chemName; int chemCnt; int first = 1; boolean showCompleteCtdList; struct dyString *currentCgiUrl; showCompleteCtdList = FALSE; if (cgiOptionalString("showAllCtdRef") != NULL) { if (sameWord(cgiOptionalString("showAllCtdRef"), "Y") || sameWord(cgiOptionalString("showAllCtdRef"), "y") ) { showCompleteCtdList = TRUE; } cartRemove(cart, "showAllCtdRef"); } currentCgiUrl = cgiUrlString(); /* List chemicals related to this gene */ if (isRgdGene(conn)) { sqlSafef(query, sizeof(query), "select ChemicalId, ChemicalName from rgdGene2Xref x, hgFixed.ctdSorted c where x.info=c.GeneSymbol and rgdGeneId='%s' and infoType='Name'", geneId); } else { sqlSafef(query, sizeof(query), "select ChemicalId, ChemicalName from kgXref x, hgFixed.ctdSorted c where x.geneSymbol=c.GeneSymbol and kgId='%s'", geneId); } sr = sqlMustGetResult(conn, query); row = sqlNextRow(sr); chemCnt = 0; while (row != NULL) { chemId = cloneString(row[0]); chemName = cloneString(row[1]); if (first) { printf("The following chemicals interact with this gene\n"); printf("