3780663c60d09f782fe8d0a84002dcc1ca7a464b hiram Fri Jan 18 15:19:22 2019 -0800 initial experiment to see if hub structures can be found and examined refs #18869 diff --git src/hg/hubApi/hubApi.c src/hg/hubApi/hubApi.c new file mode 100644 index 0000000..73f3610 --- /dev/null +++ src/hg/hubApi/hubApi.c @@ -0,0 +1,135 @@ +/* hubApi - access mechanism to hub data resources. */ +#include "common.h" +#include "linefile.h" +#include "hash.h" +#include "options.h" +#include "jksql.h" +#include "htmshell.h" +#include "web.h" +#include "cheapcgi.h" +#include "cart.h" +#include "hui.h" +#include "udc.h" +#include "knetUdc.h" +#include "genbank.h" +#include "trackHub.h" +#include "hgConfig.h" +#include "hCommon.h" +#include "hPrint.h" + +/* Global Variables */ +struct cart *cart; /* CGI and other variables */ +struct hash *oldVars = NULL; + +static void trackList(struct trackDb *tdb) +{ +if (tdb) + { + hPrintf(" \n"); + } +} + +static void assemblySettings(struct trackHubGenome *thg) +{ +hPrintf(" \n"); +} + +static void genomeList (struct trackHub *hubTop) +{ +struct trackHubGenome *thg = hubTop->genomeList; + +hPrintf("

genome sequences (and tracks) present in this track hub

\n"); +hPrintf("\n"); +} + +void doMiddle(struct cart *theCart) +/* Set up globals and make web page */ +{ +cart = theCart; +char *database = NULL; +char *genome = NULL; +char *url = "https://genome-test.gi.ucsc.edu/~hiram/hubs/Plants/hub.txt"; +getDbAndGenome(cart, &database, &genome, oldVars); +initGenbankTableNames(database); + +char *docRoot = cfgOptionDefault("browser.documentRoot", DOCUMENT_ROOT); +// fprintf(stderr, "# DBG: docRoot: '%s'\n", docRoot); + +int timeout = cartUsualInt(cart, "udcTimeout", 300); +if (udcCacheTimeout() < timeout) + udcSetCacheTimeout(timeout); +knetUdcInstall(); + +char *pathInfo = getenv("PATH_INFO"); + +if ((NULL == pathInfo) || strlen(pathInfo) < 1) { + pathInfo = cloneString("noPathInfo"); +} +// fprintf(stderr, "# DBG: pathInfo: '%s'\n", pathInfo); + +cartWebStart(cart, database, "access mechanism to hub data resources"); + + +char *urlInput = cartUsualString(cart, "urlHub", url); +struct trackHub *hub = trackHubOpen(urlInput, ""); +hPrintf("
Enter hub URL: "); +hPrintf("\n", urlInput); +hWrites(" "); +// hPrintf("after box"); +hButton("goApi", "go"); +hPrintf("
\n
\n"); + +hPrintf("

URL: %s
\n", urlInput); +hPrintf("name: %s
\n", hub->shortLabel); +hPrintf("description: %s
\n", hub->longLabel); +hPrintf("default db: '%s'
\n", isEmpty(hub->defaultDb) ? "(none available)" : hub->defaultDb); +printf("pathInfo:'%s'
\ndocRoot:'%s'
\n", pathInfo, docRoot); + +if (hub->genomeList) + genomeList(hub); + +hPrintf("

cart dump

"); +hPrintf("
\n");
+cartDump(cart);
+hPrintf("
\n"); +hPrintf("

\n"); +cartWebEnd(); +} + +/* Null terminated list of CGI Variables we don't want to save + * permanently. */ +char *excludeVars[] = {"Submit", "submit", NULL,}; + +int main(int argc, char *argv[]) +/* Process command line. */ +{ +cgiSpoof(&argc, argv); +cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars); +return 0; +}