void doClearSubtrackMerge(struct sqlConnection *conn)
/* Respond to click on clear subtrack merge. */
{
cartRemovePrefix(cart, hgtaSubtrackMergePrefix);
cartRemovePrefix(cart, hgtaNextSubtrackMergePrefix);
doMainPage(conn);
}
Beispiel #2
0
void doAdvFilterClear(struct sqlConnection *conn, struct column *colList)
/* Clear variables in advanced filter page. */
{
cartRemovePrefix(cart, advFilterPrefix);
cartRemovePrefix(cart, advFilterPrefixI);
doAdvFilter(conn, colList);
}
Beispiel #3
0
void dispatch()
/* Set up a connection to database and dispatch control
 * based on hgpDo type var. */
{
struct sqlConnection *conn = sqlConnect(visiDb);
if (cartVarExists(cart, hgpDoThumbnails))
    doThumbnails(conn);
else if (cartVarExists(cart, hgpDoImage))
    doImage(conn);
else if (cartVarExists(cart, hgpDoProbe))
    doProbe(conn);
else if (cartVarExists(cart, hgpDoControls))
    doControls(conn);
else if (cartVarExists(cart, hgpDoId))
    doId(conn);
#ifdef SOON
else if (cartVarExists(cart, hgpDoConfig))
    configPage(conn);
#endif /* SOON */
else if (cartVarExists(cart, hgpDoSearch))
    doDefault(conn, TRUE);
else
    {
    char *oldListSpec = hashFindVal(oldCart, hgpListSpec);
    char *newListSpec = cartOptionalString(cart, hgpListSpec);
    boolean isNew = differentStringNullOk(oldListSpec, newListSpec);
    doDefault(conn, isNew);
    }
cartRemovePrefix(cart, hgpDoPrefix);
}
Beispiel #4
0
void doAdvFilterKeyPasted(struct sqlConnection *conn, struct column *colList, 
    struct column *col)
/* Handle submission in key-paste in form. */
{
char *pasteVarName = colVarName(col, keyWordPastedPrefix);
char *pasteVal = trimSpaces(cartString(cart, pasteVarName));
char *keyVarName = advFilterName(col, "keyFile");

if (pasteVal == NULL || pasteVal[0] == 0)
    {
    /* If string is empty then clear cart variable. */
    cartRemove(cart, keyVarName);
    }
else
    {
    /* Else write variable to temp file and save temp
     * file name. */
    struct tempName tn;
    FILE *f;
    makeTempName(&tn, "near", ".key");
    f = mustOpen(tn.forCgi, "w");
    mustWrite(f, pasteVal, strlen(pasteVal));
    carefulClose(&f);
    cartSetString(cart, keyVarName, tn.forCgi);
    }
cartRemovePrefix(cart, keyWordPastedPrefix);
doAdvFilter(conn, colList);
}
void cartMain(struct cart *theCart)
/* We got the persistent/CGI variable cart.  Now
 * set up the globals and make a web page. */
{
cart = theCart;

/* Break out new block after have set cart */
    {
    int id = cartUsualInt(cart, hgbiId, 1);
    struct sqlConnection *conn = sqlConnect("bioImage");
    char *geneName = bioImageGeneName(conn, id);
    if (cartVarExists(cart, hgbiDoFullSize))
	{
	htmStart(stdout, "BioImage Full Sized Image");
	printf("<IMG SRC=\"/%s\"><BR>\n", bioImageFullSizePath(conn, id));
	printCaption(conn, id, geneName);
	htmlEnd();
	}
    else  /* Default case - start fancy web page. */
	{
	mainPage(conn, id, geneName);
	}

    cartRemovePrefix(cart, hgbiDoPrefix);
    sqlDisconnect(&conn);
    }
}
Beispiel #6
0
void doAdvFilterKeyClear(struct sqlConnection *conn, struct column *colList, 
    struct column *col)
/* Handle upload keyword list button press in advanced filter form. */
{
cartRemovePrefix(cart, keyWordClearPrefix);
cartRemove(cart, advFilterName(col, "keyFile"));
doAdvFilter(conn, colList);
}
Beispiel #7
0
void doDefaultConfigure(struct sqlConnection *conn, struct column *colList)
/* Do configuration starting with defaults. */
{
struct column *col;
for (col=colList; col != NULL; col = col->next)
    col->on = col->defaultOn;
cartRemovePrefix(cart, colConfigPrefix);
cartRemove(cart, colOrderVar);
//restoreDefaultOrder(&colList);
doConfigure(conn, colList); //, NULL);
}
void dispatchPage()
/* Look at command variables in cart and figure out which
 * page to draw. */
{
struct sqlConnection *conn = hAllocConn(database);
if (checkAndClear(hggConfigure))
    {
    configurePage();
    }
else if (checkAndClear(hggConfigureOne))
    {
    configureOnePage();
    }
else if (checkAndClear(hggUpload))
    {
    uploadPage();
    }
else if (checkAndClear(hggSubmitUpload))
    {
    submitUpload(conn);
    }
else if (checkAndClear(hggImport))
    {
    importPage(conn);
    }
else if (checkAndClear(hggSubmitImport))
    {
    submitImport();
    }
else if (checkAndClear(hggCorrelate))
    {
    correlatePage(conn);
    }
else if (checkAndClear(hggBrowse))
    {
    browseRegions(conn);
    }
else if (checkAndClear(hggSort))
    {
    sortGenes(conn);
    }
else
    {
    /* Default case - start fancy web page. */
    if (cgiVarExists(hggPsOutput))
    	handlePostscript(conn);
    else
	mainPage(conn);
    }
cartRemovePrefix(cart, hggDo);
}
Beispiel #9
0
void doAdvFilterKeyPaste(struct sqlConnection *conn, struct column *colList, 
    struct column *col)
/* Handle upload keyword list button press in advanced filter form. */
{
char *varName = NULL;
char buf[1024];
cartRemovePrefix(cart, keyWordPastePrefix);
safef(buf, sizeof(buf), "Paste List : %s - %s", col->shortLabel, col->longLabel);
makeTitle(buf, NULL);
hPrintf("<FORM ACTION=\"../cgi-bin/hgNear\" METHOD=POST>\n");
cartSaveSession(cart);
hPrintf("Paste in a list of items to match. ");
cgiMakeButton("submit", "submit");
hPrintf("<BR>\n");
varName = colVarName(col, keyWordPastedPrefix);
cgiMakeTextArea(varName, "", 10, 60);
hPrintf("</FORM>");
}
Beispiel #10
0
void doMiddle(struct cart *theCart)
/* Write the middle parts of the HTML page.
 * This routine sets up some globals and then
 * dispatches to the appropriate page-maker. */
{
cart = theCart;

if (hIsGisaidServer())
    {
    validateGisaidUser(cart);
    }

if (cartVarExists(cart, confVarName))
    doConfigure(conn, colList);
else if (cartVarExists(cart, defaultConfName))
    doDefaultConfigure(conn, colList);
else if (cartVarExists(cart, hideAllConfName))
    doConfigHideAll(conn, colList);
else if (cartVarExists(cart, showAllConfName))
    doConfigShowAll(conn, colList);

else if (cartVarExists(cart, getSeqPageVarName))
    doGetSeqPage(conn, colList);

else if (cartVarExists(cart, advFilterVarName))
    doAdvFilter(conn, colList);
else if (cartVarExists(cart, advFilterClearVarName))
    doAdvFilterClear(conn, colList);

else if ((col = advFilterKeyPastePressed(colList)) != NULL)
    doAdvFilterKeyPaste(conn, colList, col);
else if ((col = advFilterKeyPastedPressed(colList)) != NULL)
    doAdvFilterKeyPasted(conn, colList, col);
else if ((col = advFilterKeyUploadPressed(colList)) != NULL)
    doAdvFilterKeyUpload(conn, colList, col);
else if ((col = advFilterKeyClearPressed(colList)) != NULL)
    doAdvFilterKeyClear(conn, colList, col);
else
    displayData(conn, colList);

cartRemovePrefix(cart, "gisaidTable.do.");

}
Beispiel #11
0
void doAdvFilterKeyUpload(struct sqlConnection *conn, struct column *colList, 
    struct column *col)
/* Handle upload keyword list button press in advanced filter form. */
{
char *varName = NULL;
char buf[1024];
cartRemovePrefix(cart, keyWordUploadPrefix);
safef(buf, sizeof(buf), "Upload List : %s - %s", col->shortLabel, col->longLabel);
makeTitle(buf, NULL);
hPrintf("<FORM ACTION=\"../cgi-bin/hgNear\" METHOD=POST ENCTYPE=\"multipart/form-data\">\n");
cartSaveSession(cart);
hPrintf("Enter the name of a file from your computer that contains a list");
hPrintf("of items separated by a space, tab or line.<BR>");

varName = colVarName(col, keyWordPastedPrefix);
hPrintf("<INPUT TYPE=FILE NAME=\"%s\"> ", varName);
cgiMakeButton("submit", "submit");
hPrintf("</FORM>");
}
Beispiel #12
0
void doOutSelectedFields(char *table, struct sqlConnection *conn)
/* Put up select fields (for tab-separated output) page. */
{
if (anySubtrackMerge(database, curTable))
    errAbort("Can't do selected fields output when subtrack merge is on. "
    "Please go back and select another output type, or clear the subtrack merge.");
else if (anyIntersection())
    errAbort("Can't do selected fields output when intersection is on. "
    "Please go back and select another output type, or clear the intersection.");
else
    {
    char *fsTable = cartOptionalString(cart, hgtaFieldSelectTable);
    char *dbTable = NULL;
    table = connectingTableForTrack(table);
    dbTable = getDbTable(database, table);
    /* Remove cart state if table has been changed: */
    if (fsTable && ! sameString(fsTable, dbTable))
	{
	cartRemovePrefix(cart, hgtaFieldSelectPrefix);
	cartRemove(cart, hgtaFieldSelectTable);
	}
    doBigSelectPage(database, table);
    }
}
Beispiel #13
0
static boolean allelesExists(struct section *section,
        struct sqlConnection *conn, char *geneId)
// Return TRUE if common haplotype alleles exist.
{
// If there was a reset then clear out settings
if (cartUsualBoolean(cart, HAPLO_RESET_ALL, FALSE))
    cartRemovePrefix(cart,HAPLO_TABLE "_" );

// Start with the default variables for haplotype retrieval
struct haploExtras *he = haplotypeExtrasDefault(database, 0);
section->extras = he;

// Need to get genePred struct from geneId
char where[128];
safef(where,sizeof(where),"name = '%s'",geneId);
struct genePred *gp = genePredReaderLoadQuery(conn,he->geneTable, where);
if (gp == NULL || gp->cdsStart == gp->cdsEnd)  // Ain't interested in non-protein coding genes
    {
    haplotypeExtrasFree(&he);
    return FALSE;
    }

he->chrom = gp->chrom; // Probably not needed
he->justModel = lmCloneString(he->lm,geneId);
//he->growTree = FALSE; // Tree growing not needed here

// Need to determine the correct vcf file and open it
if (haplotypesDiscoverVcfFile(he, gp->chrom) == NULL)
    {
    haplotypeExtrasFree(&he);
    return FALSE;
    }

struct vcfFile *vcff = vcfTabixFileMayOpen(he->inFile, NULL, 0, 0,VCF_IGNORE_ERRS, 0);
if (vcff == NULL)
    {
    haplotypeExtrasFree(&he);
    return FALSE;
    }
vcfFileMakeReusePool(vcff,1024 * 1024);

// All or Limit to the 99%
boolean rareVars =  cartUsualBoolean(cart, HAPLO_RARE_VAR, FALSE);
if (rareVars)
    he->synonymous = TRUE;
else
    he->variantMinPct = HAPLO_COMMON_VARIANT_MIN_PCT;

// Lets show the population distribution
he->populationsToo   = cartUsualBoolean(cart, HAPLO_MAJOR_DIST, FALSE);
he->populationsMinor = cartUsualBoolean(cart, HAPLO_MINOR_DIST, FALSE);
if (he->populationsToo)
    he->populationMinPct = 5;
else if (he->populationsMinor)
    {
    he->populationsMinor = FALSE;
    cartRemove(cart, HAPLO_MINOR_DIST );
    }

// Need to generate haplotypes
section->items = geneHapSetForOneModel(he,vcff,gp,TRUE);

return TRUE;// (section->items != NULL);
}
Beispiel #14
0
void cartMain(struct cart *theCart)
/* We got the persistent/CGI variable cart.  Now
 * set up the globals and make a web page. */
{
hgBotDelay();
cart = theCart;
getDbAndGenome(cart, &database, &genome, oldVars);
initGenbankTableNames(database);
getGenomeSettings();
if (cartVarExists(cart, hggDoKgMethod))
    doKgMethod();
else if (cartVarExists(cart, hggDoTxInfoDescription))
    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;

    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
     * don't want to put up the hot link bar etc. */
    if (cartVarExists(cart, hggDoGetMrnaSeq))
	doGetMrnaSeq(conn, curGeneId, curGeneName);
    else if (cartVarExists(cart, hggDoWikiTrack))
	doWikiTrack(conn);
    else if (cartVarExists(cart, hggDoGetProteinSeq))
	doGetProteinSeq(conn, curGeneId, curGeneName);
    else if (cartVarExists(cart, hggDoRnaFoldDisplay))
	doRnaFoldDisplay(conn, curGeneId, curGeneName);
    else if (cartVarExists(cart, hggDoOtherProteinSeq))
	doOtherProteinSeq(conn, curGeneName);
    else if (cartVarExists(cart, hggDoOtherProteinAli))
	doOtherProteinAli(conn, curGeneId, curGeneName);
    else
	{
	/* Default case - start fancy web page. */
	measureTiming =  isNotEmpty(cartOptionalString(cart, "measureTiming"));
        struct trackDb *tdb = hTrackDbForTrack(database, genomeSetting("knownGene"));
        isGencode = trackDbSettingOn(tdb, "isGencode");
        isGencode2 = trackDbSettingOn(tdb, "isGencode2");
	cartWebStart(cart, database, "%s Gene %s (%s) Description and Page Index",
	    genome, curGeneName, isGencode2 ? curGeneId : curAlignId);
	webMain(conn, tdb);
	cartWebEnd();
	}
    hFreeConn(&spConn);
    hFreeConn(&conn);
    }
cartRemovePrefix(cart, hggDoPrefix);
}
Beispiel #15
0
static void removeFilterVars()
/* Remove filter variables from cart. */
{
cartRemovePrefix(cart, hgtaFilterPrefix);
cartRemove(cart, hgtaFilterTable);
}