/* This is very similar to doForm except it's for Zoo species */
void doFormZoo(struct cart *lCart) 
/** Print out the form for users */
{
char **genomeList = NULL;
int genomeCount = 0;
char *dbChoice = NULL;
int i = 0;
cart = lCart;
cartWebStart(cart, databases, "Converting Coordinates Between Species");
puts( 
     "<p>This page attempts to convert coordinates from one Zoo species' CFTR region\n"
     "to another. The mechanism for doing this is to use the blastz alignments which have been\n"
     "done between each Zoo species and use this to convert coordinates.  In general these should\n"
     "be reasonable conversions however the user is advised to not take the conversions as absolute \n"
     "standards.  Furthermore a given region from a given species is not necessarily alignable to any\n"
     "region in a different species.\n"
     );

/* Get all Zoo species since we are using blastz static alignments */ 
getIndexedGenomeDescriptionsZoo(&genomeList, &genomeCount,FALSE);

/* choose whether to use the db supplied by cgi or our default */
if(origDb != NULL && strstr(origDb, "zoo") == NULL)
    errAbort("Sorry, this mode of the program only works between zoo species.");
dbChoice = chooseDb(origDb, genomeList[0]); 

printf("<form action=\"../cgi-bin/hgCoordConv\" method=get>\n");
printf("<br><br>\n");
printf("<table><tr>\n");
printf("<b><td><table><tr><td>Original Species: </b>\n");
cgiMakeDropList("origGenome", genomeList, genomeCount, dbChoice);
printf("</td></tr></table></td>\n");
printf("  <b><td><table><tr><td>Original Position:  </b>\n");

/* if someone has passed in a position fill it in for them */
if(position == NULL) 
    cgiMakeTextVar("position",defaultPos, 30);
else
    cgiMakeTextVar("position",position, 30);
printf("</td></tr></table></td>\n");
printf("<b><td><table><tr><td>New Species: </b>\n");

freez(&genomeList);
genomeCount =0;
getIndexedGenomeDescriptionsZoo(&genomeList, &genomeCount, FALSE);
cgiMakeDropList("newGenome", genomeList, genomeCount, genomeList[genomeCount -1]);
printf("</td></tr></table></td></tr>\n");
printf("<tr><td colspan=6 align=right><br>\n");
cgiMakeButton("Submit","submit");
printf("</center></td></tr></table>\n");
cgiMakeHiddenVar("calledSelf", "on");
printf("</form>\n");
cartWebEnd();
}
void doForm(struct cart *lCart) 
/** Print out the form for users */
{
char **genomeList = NULL;
int genomeCount = 0;
char *dbChoice = NULL;
int i = 0;
cart = lCart;
cartWebStart(cart, databases, "Converting Coordinates Between Drafts");
puts( 
     "<p>This page attempts to convert coordinates from one draft of the human genome\n"
     "to another. The mechanism for doing this is to cut out and align pieces from the\n"
     "old draft and align them to the new draft making sure that\n"
     "they are in the same order and orientation. In general the smaller the sequence the better\n"
     "the chances of successful conversion.\n"
     );

getIndexedGenomeDescriptions(&genomeList, &genomeCount, TRUE);

/* choose whether to use the db supplied by cgi or our default */
if(origDb != NULL && strstr(origDb, "hg") == NULL)
    errAbort("Sorry, currently the conversion program only works with human genomes.");
dbChoice = chooseDb(origDb, genomeList[0]); 

printf("<form action=\"../cgi-bin/hgCoordConv\" method=get>\n");
printf("<br><br>\n");
printf("<table><tr>\n");
printf("<b><td><table><tr><td>Original Draft: </b>\n");
cgiMakeDropList("origGenome", genomeList, genomeCount, dbChoice);
printf("</td></tr></table></td>\n");
printf("  <b><td><table><tr><td>Original Position:  </b>\n");

/* if someone has passed in a position fill it in for them */
if(position == NULL) 
    cgiMakeTextVar("position",defaultPos, 30);
else
    cgiMakeTextVar("position",position, 30);
printf("</td></tr></table></td>\n");
printf("<b><td><table><tr><td>New Draft: </b>\n");

freez(&genomeList);
genomeCount =0;
getIndexedGenomeDescriptions(&genomeList, &genomeCount, TRUE);
cgiMakeDropList("newGenome", genomeList, genomeCount, genomeList[genomeCount -1]);
printf("</td></tr></table></td></tr>\n");
printf("<tr><td colspan=6 align=right><br>\n");
cgiMakeButton("Submit","submit");
printf("</center></td></tr></table>\n");
cgiMakeHiddenVar("calledSelf", "on");
printf("</form>\n");
cartWebEnd();
}
static void showWiggleMergeOptions()
/* Show subtrack merge operation options for wiggle/bedGraph tables. */
{
char *setting = cartUsualString(cart, hgtaNextSubtrackMergeWigOp, "average");
makeWigOpButton("average", setting);
printf("Average (at each position) of all selected subtracks' scores<BR>\n");
makeWigOpButton("sum", setting);
printf("Sum (at each position) of all selected subtracks' scores<BR>\n");
makeWigOpButton("product", setting);
printf("Product (at each position) of all selected subtracks' scores<BR>\n");
makeWigOpButton("min", setting);
printf("Minimum (at each position) of all selected subtracks' scores<BR>\n");
makeWigOpButton("max", setting);
printf("Maximum (at each position) of all selected subtracks' scores<P>\n");

cgiMakeCheckBox(hgtaNextSubtrackMergeRequireAll,
		cartUsualBoolean(cart, hgtaSubtrackMergeRequireAll, FALSE));
printf("Discard scores for positions at which one or more selected subtracks "
       "have no data.<BR>\n");
cgiMakeCheckBox(hgtaNextSubtrackMergeUseMinScore,
		cartUsualBoolean(cart, hgtaSubtrackMergeUseMinScore, FALSE));
printf("Discard scores less than \n");
setting = cartCgiUsualString(cart, hgtaNextSubtrackMergeMinScore, "0.0");
cgiMakeTextVar(hgtaNextSubtrackMergeMinScore, setting, 5);
printf(" after performing the above operation.<P>\n");
}
Ejemplo n.º 4
0
void palOptions(struct cart *cart,
	struct sqlConnection *conn, void (*addButtons)(),
	char *extraVar)
/* output the options dialog (select MAF file, output options */
{
char *database = sqlGetDatabase(conn);

hPrintf("<FORM ACTION=\"%s\" NAME=\"mainForm\" METHOD=POST>\n", cgiScriptName());
cartSaveSession(cart);

char *mafTable = outMafTableDrop(cart, conn);
char *numColumns = cartUsualString(cart, hgtaCGINumColumns, "");

printf("<BR><BR><B>Formatting options:</B><BR>\n");
jsMakeTrackingCheckBox(cart, hgtaCGIGeneExons, hgtaJSGeneExons, FALSE);
printf("Separate into exons<BR>");
jsMakeTrackingCheckBox(cart, hgtaCGIGeneNoTrans, hgtaJSGeneNoTrans, FALSE);
printf("Show nucleotides<BR>");
jsMakeTrackingCheckBox(cart, hgtaCGIGeneOutBlank, hgtaJSGeneOutBlank, FALSE);
printf("Output lines with just dashes<BR>");
jsMakeTrackingCheckBox(cart, hgtaCGIOutTable, hgtaJSOutTable, FALSE);
printf("Format output as table ");
jsMakeTrackingCheckBox(cart, hgtaCGITruncHeader, hgtaJSTruncHeader, FALSE);
printf("Truncate headers at ");
cgiMakeTextVar(hgtaCGINumColumns, numColumns, 2);
printf("characters (enter zero for no headers)<BR>");

printf("<BR>");
struct trackDb *maftdb = hTrackDbForTrack(database, mafTable);

/* get maf parent (if any) */
maftdb->parent = hCompositeTrackDbForSubtrack(database,maftdb);

wigMafSpeciesTable(cart, maftdb, mafTable, database);

addButtons();

cartSaveSession(cart);

hPrintf("</FORM>\n");

/* Hidden form - for benefit of javascript. */
    {
    static char *saveVars[32];
    int varCount = ArraySize(curVars);

    assert(varCount  < (sizeof saveVars / sizeof(char *)));
    memcpy(saveVars, curVars, varCount * sizeof(saveVars[0]));
    if (extraVar != NULL)
	{
	assert(varCount + 1 < (sizeof saveVars / sizeof(char *)));
	saveVars[varCount] = extraVar;
	varCount++;
	}
    jsCreateHiddenForm(cart, cgiScriptName(), saveVars, varCount);
    }

}
Ejemplo n.º 5
0
void doControls(struct sqlConnection *conn)
/* Put up controls pane. */
{
char *listSpec = cartUsualString(cart, hgpListSpec, "");
htmlSetBgColor(0xD0FFE0);
              // resource file link wrapped in html
char * link = webTimeStampedLinkToResourceOnFirstCall("HGStyle.css",TRUE); 
if (link)
    htmlSetStyle(link);
htmStart(stdout, "do controls");
printf("<FORM ACTION=\"%s\" NAME=\"mainForm\" target=\"_parent\" METHOD=GET>\n",
	hgVisiGeneCgiName());
cartSaveSession(cart);

printf("<TABLE WIDTH=100%%><TR>");
printf("<TD WIDTH=230 bgcolor=\"#"HG_COL_HOTLINKS"\">");
printf("&nbsp;<B><A HREF=\"../index.html\" target=\"_parent\" class=\"topbar\">UCSC</A> ");
printf("&nbsp;<A HREF=\"%s?%s=\" target=\"_parent\" class=\"topbar\">VisiGene</A></B> ",
	hgVisiGeneCgiName(), hgpListSpec);
printf("</TD>");

printf("<TD>");
printf("&nbsp");
cgiMakeTextVar(hgpListSpec, listSpec, 16);
cgiMakeButton(hgpDoSearch, "search");
printf("</TD>");

#ifdef SOON
printf("<TD>");
cgiMakeButton(hgpDoConfig, "configure");
printf("</TD>");
#endif /* SOON */

printf("<TD>");
printf("Zoom: ");
printf(
"<INPUT TYPE=SUBMIT NAME=\"hgp_zmOut\" VALUE=\" out \""
" onclick=\"parent.image.bigImg.zoomer('out');return false;\"> "
"<INPUT TYPE=SUBMIT NAME=\"hgp_zmIn\" VALUE=\" in \""
" onclick=\"parent.image.bigImg.zoomer('in');return false;\"> "
"<INPUT TYPE=SUBMIT NAME=\"hgp_zmFull\" VALUE=\" full \""
" onclick=\"parent.image.bigImg.zoomer('full');return false;\"> "
"<INPUT TYPE=SUBMIT NAME=\"hgp_zmFit\" VALUE=\" fit \""
" onclick=\"parent.image.bigImg.zoomer('fit');return false;\"> "
"\n");
printf("</TD>");

printf("<TD ALIGN=Right>");
printf("<A HREF=\"../goldenPath/help/hgTracksHelp.html#VisiGeneHelp\" target=_parent>");
printf("Help");
printf("</A>&nbsp;");
printf("</TD>");
printf("</TR></TABLE>");
printf("</FORM>\n");
htmlEnd();
}
static void showBedMergeOptions()
/* Show subtrack merge operation options for tables that are distilled
 * to BED (not wiggle/bedGraph). */
{
char *op = cartUsualString(cart, hgtaNextSubtrackMergeOp, "any");
char *setting = NULL;
hPrintf("These combinations will maintain the gene/alignment structure "
	"(if any) of %s: <P>\n", curTable);

makeOpButton("any", op);
printf("All %s records that have any overlap with any other selected subtrack<BR>\n",
       curTable);
makeOpButton("none", op);
printf("All %s records that have no overlap with any other selected subtrack<BR>\n",
       curTable);

makeOpButton("more", op);
printf("All %s records that have at least ",
       curTable);
setting = cartCgiUsualString(cart, hgtaNextSubtrackMergeMoreThreshold, "80");
cgiMakeTextVar(hgtaNextSubtrackMergeMoreThreshold, setting, 3);
printf(" %% overlap with any other selected subtrack<BR>\n");
makeOpButton("less", op);
printf("All %s records that have at most ",
       curTable);
setting = cartCgiUsualString(cart, hgtaNextSubtrackMergeLessThreshold, "80");
cgiMakeTextVar(hgtaNextSubtrackMergeLessThreshold, setting, 3);
printf(" %% overlap with any other selected subtrack<BR>\n");

makeOpButton("cat", op);
printf("All %s records, as well as all records from all other selected subtracks<P>\n",
       curTable);

printf("These combinations will discard the gene/alignment structure (if any) "
       "of %s and produce a simple list of position ranges.<P>\n",
       curTable);
makeOpButton("and", op);
printf("Base-pair-wise intersection (AND) of %s and other selected subtracks<BR>\n",
       curTable);
makeOpButton("or", op);
printf("Base-pair-wise union (OR) of %s and other selected subtracks<P>\n",
       curTable);
}
Ejemplo n.º 7
0
void getUrl(struct sqlConnection *conn)
/* Put up URL. */
{
edwMustGetUserFromEmail(conn, userEmail);
printf("Please enter a URL for a validated manifest file:<BR>");
printf("URL ");
cgiMakeTextVar("url", emptyForNull(cgiOptionalString("url")), 80);
cgiMakeButton("submitUrl", "submit");
printf("<BR>\n");
cgiMakeCheckBox("update", FALSE);
printf(" Update information associated with files that have already been uploaded.");
printf("<BR>Submission by %s", userEmail);
edwPrintLogOutButton();
}
Ejemplo n.º 8
0
void integerFilter(char *db, char *table, char *field, char *label,char *logOp)
/* Print out a filter constraint for an integer within a range. */
{
char *name;

hPrintf("<TR VALIGN=BOTTOM align='left'><TD> %s</TD><TD>is</TD><TD colspan=2>\n", label);
name = filterFieldVarName(db, table, field, filterCmpVar);
cgiMakeDropListClassWithStyle(name, cmpOpMenu, cmpOpMenuSize,
                              cartUsualString(cart, name, cmpOpMenu[0]),"normalText","width: 76px");
puts("</TD><TD>\n");
name = filterPatternVarName(db, table, field);
cgiMakeTextVar(name, cartUsualString(cart, name, "0"), 20);
if (logOp == NULL)
    logOp = "";
hPrintf("&nbsp;%s</TD></TR>\n", logOp);
}
Ejemplo n.º 9
0
void doIntersectMore(struct sqlConnection *conn)
/* Continue working in intersect page. */
{
struct trackDb *iTrack;
char *name = curTableLabel();
char *iName, *iTable;
char *onChange = onChangeEither();
char *op, *setting;
boolean wigOptions = (isWiggle(database, curTable) || isBedGraph(curTable));
// Note - bigWig is purposely left out of wigOptions.   It supports more intersection options
// than wig does.
struct hTableInfo *hti1 = maybeGetHti(database, curTable, conn), *hti2 = NULL;
htmlOpen("Intersect with %s", name);

hPrintf("<FORM ACTION=\"%s\" NAME=\"mainForm\" METHOD=GET>\n", getScriptName());
cartSaveSession(cart);
hPrintf("<TABLE BORDER=0>\n");
/* Print group and track line. */

hPrintf("Select a group, track and table to intersect with:\n");
iTrack = showGroupTrackRow(hgtaNextIntersectGroup, onChange,
	hgtaNextIntersectTrack, onChange, conn);
iName = iTrack->shortLabel;

hPrintf("<TR><TD>\n");
iTable = showTableField(iTrack, hgtaNextIntersectTable, FALSE);
hti2 = maybeGetHti(database, iTable, conn);
hPrintf("</TD></TR>\n");
hPrintf("</TABLE>\n");

if (!wigOptions)
    {
    if (hti1 && hti1->hasBlocks)
	hPrintf("<BR>Note: %s has gene/alignment structure.  "
		"Only the exons/blocks will be considered.\n", name);
    if (hti2 && hti2->hasBlocks)
	hPrintf("<BR>Note: %s has gene/alignment structure.  "
		"Only the bases covered by its exons/blocks will be "
		"considered.\n", iName);
    hPrintf("<H4>Intersect %s items with bases covered by %s:</H4>\n",
	    name, iName);
    hPrintf("These combinations will maintain the names and "
	    "gene/alignment structure (if any) of %s: <P>\n",
	    name);
    }
else
    hPrintf("<P>\n");

op = cartUsualString(cart, hgtaNextIntersectOp, "any");
jsTrackingVar("op", op);
makeOpButton("any", op);
printf("All %s records that have any overlap with %s <BR>\n",
       name, iName);
makeOpButton("none", op);
printf("All %s records that have no overlap with %s <BR>\n",
       name, iName);

if (!wigOptions)
    {
    makeOpButton("more", op);
    printf("All %s records that have at least ",
	   name);
    setting = cartCgiUsualString(cart, hgtaNextMoreThreshold, "80");
    cgiMakeTextVar(hgtaNextMoreThreshold, setting, 3);
    printf(" %% overlap with %s <BR>\n", iName);
    makeOpButton("less", op);
    printf("All %s records that have at most ",
	   name);
    setting = cartCgiUsualString(cart, hgtaNextLessThreshold, "80");
    cgiMakeTextVar(hgtaNextLessThreshold, setting, 3);
    printf(" %% overlap with %s <P>\n", iName);
    }
else
    {
    /*	keep javaScript onClick happy	*/
    hPrintf("<input TYPE=HIDDEN NAME=\"hgta_nextMoreThreshold\" VALUE=80>\n");
    hPrintf("<input TYPE=HIDDEN NAME=\"hgta_nextLessThreshold\" VALUE=80>\n");
    hPrintf(" <P>\n");
    }


if (!wigOptions)
    {
    boolean bigWig = isBigWigTable(curTable);
    hPrintf("<H4>Intersect bases covered by %s and/or %s:</H4>\n",
	    name, iName);
    if (!bigWig)
	hPrintf("These combinations will discard the names and "
		"gene/alignment structure (if any) of %s and produce a simple "
		"list of position ranges.<P>\n",
		name);
    makeOpButton("and", op);
    printf("Base-pair-wise intersection (AND) of %s and %s <BR>\n",
	name, iName);
    makeOpButton("or", op);
    printf("Base-pair-wise union (OR) of %s and %s <P>\n",
	name, iName);
    hPrintf("Check the following boxes to complement one or both tables.  "
	    "To complement a table means to include a base pair in the "
	    "intersection/union if it is <I>not</I> included in the table."
	    "<P>\n");
    if (!bigWig)
	{
	jsMakeTrackingCheckBox(cart, hgtaNextInvertTable, "invertTable", FALSE);
	printf("Complement %s before base-pair-wise intersection/union <BR>\n",
	       name);
	}
    jsMakeTrackingCheckBox(cart, hgtaNextInvertTable2, "invertTable2", FALSE);
    printf("Complement %s before base-pair-wise intersection/union <P>\n",
	   iName);
    }
else
    {
    /*	keep javaScript onClick happy	*/
    jsTrackingVar("op", op);
    hPrintf("<SCRIPT>\n");
    hPrintf("var invertTable=0;\n");
    hPrintf("var invertTable2=0;\n");
    hPrintf("</SCRIPT>\n");
    hPrintf("(data track %s is not composed of gene records.  Specialized intersection operations are not available.)<P>\n", name);
    }

cgiMakeButton(hgtaDoIntersectSubmit, "submit");
hPrintf(" ");
cgiMakeButton(hgtaDoMainPage, "cancel");
hPrintf("</FORM>\n");

/* Hidden form - for benefit of javascript. */
    {
    static char *saveVars[32];
    int varCount = ArraySize(nextVars);
    memcpy(saveVars, nextVars, varCount * sizeof(saveVars[0]));
    saveVars[varCount] = hgtaDoIntersectMore;
    jsCreateHiddenForm(cart, getScriptName(), saveVars, varCount+1);
    }

htmlClose();
}
Ejemplo n.º 10
0
Archivo: hPrint.c Proyecto: bowhan/kent
void hTextVar(char *varName, char *initialVal, int charSize)
/* Write out text entry field if not suppressed. */
{
if (!suppressHtml)
    cgiMakeTextVar(varName, initialVal, charSize);
}
Ejemplo n.º 11
0
void showMainControlTable(struct sqlConnection *conn)
/* Put up table with main controls for main page. */
{
struct grp *selGroup;
boolean isWig = FALSE, isPositional = FALSE, isMaf = FALSE, isBedGr = FALSE,
        isChromGraphCt = FALSE, isPal = FALSE, isArray = FALSE, isBam = FALSE, isVcf = FALSE, isHalSnake = FALSE, isLongTabix = FALSE;
boolean gotClade = hGotClade();
struct hTableInfo *hti = NULL;

hPrintf("<TABLE BORDER=0>\n");

/* Print clade, genome and assembly line. */
    {
    if (gotClade)
        {
        hPrintf("<TR><TD><B>clade:</B>\n");
        printCladeListHtml(hGenome(database), onChangeClade());
        nbSpaces(3);
        hPrintf("<B>genome:</B>\n");
        printGenomeListForCladeHtml(database, onChangeOrg());
        }
    else
        {
        hPrintf("<TR><TD><B>genome:</B>\n");
        printGenomeListHtml(database, onChangeOrg());
        }
    nbSpaces(3);
    hPrintf("<B>assembly:</B>\n");
    printAssemblyListHtml(database, onChangeDb());
    hPrintf("</TD></TR>\n");
    }

/* Print group and track line. */
    {
    hPrintf("<TR><TD>");
    selGroup = showGroupField(hgtaGroup, onChangeGroupOrTrack(), conn, hAllowAllTables());
    nbSpaces(3);
    curTrack = showTrackField(selGroup, hgtaTrack, onChangeGroupOrTrack(), FALSE);
    nbSpaces(3);
    boolean hasCustomTracks = FALSE;
    struct trackDb *t;
    for (t = fullTrackList;  t != NULL;  t = t->next)
        {
        if (isCustomTrack(t->table))
            {
            hasCustomTracks = TRUE;
            break;
            }
        }
    hOnClickButton("document.customTrackForm.submit();return false;",
                   hasCustomTracks ? CT_MANAGE_BUTTON_LABEL : CT_ADD_BUTTON_LABEL);

    hPrintf(" ");
    if (hubConnectTableExists())
	hOnClickButton("document.trackHubForm.submit();return false;", "track hubs");

    hPrintf("</TD></TR>\n");
    }

/* Print table line. */
    {
    hPrintf("<TR><TD>");
    curTable = showTableField(curTrack, hgtaTable, TRUE);
    if (isHubTrack(curTable) || (strchr(curTable, '.') == NULL))  /* In same database */
        {
        hti = getHti(database, curTable, conn);
        isPositional = htiIsPositional(hti);
        }
    isLongTabix = isLongTabixTable( curTable);
    isBam = isBamTable( curTable);
    isVcf = isVcfTable(curTable, NULL);
    isWig = isWiggle(database, curTable);
    if (isBigWigTable(curTable))
        {
        isPositional = TRUE;
        isWig = TRUE;
        }
    isHalSnake = isHalTable( curTable);
    isMaf = isMafTable(database, curTrack, curTable);
    isBedGr = isBedGraph(curTable);
    isArray = isMicroarray(curTrack, curTable);
    struct trackDb *tdb = findTdbForTable(database, curTrack, curTable, ctLookupName);
    isPal = isPalCompatible(conn, tdb, curTable);
    nbSpaces(1);
    if (isCustomTrack(curTable))
        {
        isChromGraphCt = isChromGraph(tdb);
        }
    cgiMakeButton(hgtaDoSchema, "describe table schema");
    hPrintf("</TD></TR>\n");
    }

if (curTrack == NULL)
    {
    struct trackDb *tdb = hTrackDbForTrack(database, curTable);
    struct trackDb *cTdb = hCompositeTrackDbForSubtrack(database, tdb);
    if (cTdb)
        curTrack = cTdb;
    else
        curTrack = tdb;
    isMaf = isMafTable(database, curTrack, curTable);
    }

/* Region line */
{
char *regionType = cartUsualString(cart, hgtaRegionType, hgtaRegionTypeGenome);
char *range = cartUsualString(cart, hgtaRange, "");
if (isPositional)
    {
    boolean doEncode = FALSE; 

    if (!trackHubDatabase(database))
	doEncode = sqlTableExists(conn, "encodeRegions");

    hPrintf("<TR><TD><B>region:</B>\n");

    /* If regionType not allowed force it to "genome". */
    if ((sameString(regionType, hgtaRegionTypeUserRegions) &&
	 userRegionsFileName() == NULL) ||
	(sameString(regionType, hgtaRegionTypeEncode) && !doEncode))
	regionType = hgtaRegionTypeGenome;
    // Is "genome" is not allowed because of tdb 'tableBrowser noGenome'?
    boolean disableGenome = ((curTrack && cartTrackDbIsNoGenome(database, curTrack->table)) ||
                             (curTable && cartTrackDbIsNoGenome(database, curTable)));
    // If "genome" is selected but not allowed, force it to "range":
    if (sameString(regionType, hgtaRegionTypeGenome) && disableGenome)
        regionType = hgtaRegionTypeRange;
    jsTrackingVar("regionType", regionType);
    if (disableGenome)
        {
        makeRegionButtonExtraHtml(hgtaRegionTypeGenome, regionType, "DISABLED");
        hPrintf("&nbsp;<span"NO_GENOME_CLASS">genome (unavailable for selected track)</span>"
                "&nbsp;");
        }
    else
        {
        makeRegionButton(hgtaRegionTypeGenome, regionType);
        hPrintf("&nbsp;genome&nbsp;");
        }
    if (doEncode)
        {
	makeRegionButton(hgtaRegionTypeEncode, regionType);
	hPrintf("&nbsp;ENCODE Pilot regions&nbsp;");
	}
    makeRegionButton(hgtaRegionTypeRange, regionType);
    hPrintf("&nbsp;position&nbsp;");
    hPrintf("<INPUT TYPE=TEXT NAME=\"%s\" SIZE=26 VALUE=\"%s\" onFocus=\"%s\">\n",
    	hgtaRange, range, jsRadioUpdate(hgtaRegionType, "regionType", "range"));
    cgiMakeButton(hgtaDoLookupPosition, "lookup");
    hPrintf("&nbsp;");
    if (userRegionsFileName() != NULL)
	{
	makeRegionButton(hgtaRegionTypeUserRegions, regionType);
	hPrintf("&nbsp;defined regions&nbsp;");
	cgiMakeButton(hgtaDoSetUserRegions, "change");
	hPrintf("&nbsp;");
	cgiMakeButton(hgtaDoClearUserRegions, "clear");
	}
    else
	cgiMakeButton(hgtaDoSetUserRegions, "define regions");
    hPrintf("</TD></TR>\n");
    }
else
    {
    /* Need to put at least stubs of cgi variables in for JavaScript to work. */
    jsTrackingVar("regionType", regionType);
    cgiMakeHiddenVar(hgtaRange, range);
    cgiMakeHiddenVar(hgtaRegionType, regionType);
    }

/* Select identifiers line (if applicable). */
if (!isWig && getIdField(database, curTrack, curTable, hti) != NULL)
    {
    hPrintf("<TR><TD><B>identifiers (names/accessions):</B>\n");
    cgiMakeButton(hgtaDoPasteIdentifiers, "paste list");
    hPrintf(" ");
    cgiMakeButton(hgtaDoUploadIdentifiers, "upload list");
    if (identifierFileName() != NULL)
        {
	hPrintf("&nbsp;");
	cgiMakeButton(hgtaDoClearIdentifiers, "clear list");
	}
    hPrintf("</TD></TR>\n");
    }
}

/* microarray options */
/*   button for option page here (median/log-ratio, etc)  */

/* Filter line. */
{
hPrintf("<TR><TD><B>filter:</B>\n");
if (anyFilter())
    {
    cgiMakeButton(hgtaDoFilterPage, "edit");
    hPrintf(" ");
    cgiMakeButton(hgtaDoClearFilter, "clear");
    if (isWig || isBedGr)
	wigShowFilter(conn);
    }
else
    {
    cgiMakeButton(hgtaDoFilterPage, "create");
    }
hPrintf("</TD></TR>\n");
}

/* Composite track subtrack merge line. */
boolean canSubtrackMerge = (curTrack && tdbIsComposite(curTrack) && !isBam && !isVcf && !isLongTabix);
if (canSubtrackMerge)
    {
    hPrintf("<TR><TD><B>subtrack merge:</B>\n");
    if (anySubtrackMerge(database, curTable))
	{
	cgiMakeButton(hgtaDoSubtrackMergePage, "edit");
	hPrintf(" ");
	cgiMakeButton(hgtaDoClearSubtrackMerge, "clear");
	}
    else
	{
	cgiMakeButton(hgtaDoSubtrackMergePage, "create");
	}
    hPrintf("</TD></TR>\n");
    }

/* Intersection line. */
if (isPositional)
    {
    if (anyIntersection())
        {
	hPrintf("<TR><TD><B>intersection with %s:</B>\n",
		cartString(cart, hgtaIntersectTable));
	cgiMakeButton(hgtaDoIntersectPage, "edit");
	hPrintf(" ");
	cgiMakeButton(hgtaDoClearIntersect, "clear");
        hPrintf("</TD></TR>\n");
	}
    else if (canIntersect(database, curTable))
        {
	hPrintf("<TR><TD><B>intersection:</B>\n");
	cgiMakeButton(hgtaDoIntersectPage, "create");
        hPrintf("</TD></TR>\n");
	}
    }

/* Correlation line. */
struct trackDb *tdb = findTdbForTable(database, curTrack, curTable, ctLookupName);
if (correlateTrackTableOK(tdb, curTable))
    {
    char *table2 = cartUsualString(cart, hgtaCorrelateTable, "none");
    hPrintf("<TR><TD><B>correlation:</B>\n");
    if (differentWord(table2, "none") && strlen(table2) && ! isNoGenomeDisabled(database, table2))
        {
        struct grp *groupList = fullGroupList;
        struct grp *selGroup = findSelectedGroup(groupList, hgtaCorrelateGroup);
        struct trackDb *tdb2 = findSelectedTrack(fullTrackList, selGroup,hgtaCorrelateTrack);
        if (tdbIsComposite(tdb2))
            {
	    struct slRef *tdbRefList = trackDbListGetRefsToDescendantLeaves(tdb2->subtracks);
	    struct slRef *tdbRef;
	    for (tdbRef = tdbRefList; tdbRef != NULL; tdbRef = tdbRef->next)
                {
		struct trackDb *subTdb = tdbRef->val;
                if (sameString(table2, subTdb->table))
                    {
                    tdb2 = subTdb;
                    break;
                    }
                }
	    slFreeList(&tdbRefList);
            }
        cgiMakeButton(hgtaDoCorrelatePage, "calculate");
        cgiMakeButton(hgtaDoClearCorrelate, "clear");
        if (tdb2 && tdb2->shortLabel)
            hPrintf("&nbsp;(with:&nbsp;&nbsp;%s)", tdb2->shortLabel);

#ifdef NOT_YET
        /* debugging 	dbg	vvvvv	*/
        if (curTrack && curTrack->type)		/*	dbg	*/
            {
            hPrintf("<BR>&nbsp;(debug:&nbsp;'%s',&nbsp;'%s(%s)')",
                    curTrack->type, tdb2->type, table2);
            }
        /* debugging 	debug	^^^^^	*/
#endif

        }
    else
        cgiMakeButton(hgtaDoCorrelatePage, "create");

    hPrintf("</TD></TR>\n");
    }

/* Print output type line. */
showOutputTypeRow(isWig, isBedGr, isPositional, isMaf, isChromGraphCt, isPal, isArray, isHalSnake);

/* Print output destination line. */
    {
    char *compressType =
	cartUsualString(cart, hgtaCompressType, textOutCompressNone);
    char *fileName = cartUsualString(cart, hgtaOutFileName, "");
    hPrintf("<TR><TD>\n");
    hPrintf("<B>output file:</B>&nbsp;");
    cgiMakeTextVar(hgtaOutFileName, fileName, 29);
    hPrintf("&nbsp;(leave blank to keep output in browser)</TD></TR>\n");
    hPrintf("<TR><TD>\n");
    hPrintf("<B>file type returned:&nbsp;</B>");
    cgiMakeRadioButton(hgtaCompressType, textOutCompressNone,
	sameWord(textOutCompressNone, compressType));
    hPrintf("&nbsp;plain text&nbsp&nbsp");
    cgiMakeRadioButton(hgtaCompressType, textOutCompressGzip,
	sameWord(textOutCompressGzip, compressType));
    hPrintf("&nbsp;gzip compressed");
    hPrintf("</TD></TR>\n");
    }

hPrintf("</TABLE>\n");


/* Submit buttons. */
    {
    hPrintf("<BR>\n");
    if (isWig || isBam || isVcf || isLongTabix)
	{
	char *name;
	extern char *maxOutMenu[];
	char *maxOutput = maxOutMenu[0];

	if (isCustomTrack(curTable))
	    name=filterFieldVarName("ct", curTable, "_", filterMaxOutputVar);
	else
	    name=filterFieldVarName(database,curTable, "_",filterMaxOutputVar);

	maxOutput = cartUsualString(cart, name, maxOutMenu[0]);

	if (isWig)
	    hPrintf(
		"<I>Note: to return more than %s lines, change the filter setting"
		" (above). The entire data set may be available for download as"
		" a very large file that contains the original data values (not"
		" compressed into the wiggle format) -- see the Downloads page."
		"</I><BR>", maxOutput);
	else if (isBam || isVcf || isLongTabix)
	    hPrintf(
		"<I>Note: to return more than %s lines, change the filter setting"
		" (above). Please consider downloading the entire data from our Download pages."
		"</I><BR>", maxOutput);
	}
    else if (anySubtrackMerge(database, curTable) || anyIntersection())
	{
	hPrintf("<I>Note: The all fields and selected fields output formats "
		"are not available when a%s has been specified.</I><BR>",
		canSubtrackMerge ? " subtrack merge or intersection" : "n intersection");
	}
    cgiMakeButton(hgtaDoTopSubmit, "get output");
    hPrintf(" ");
    if (isPositional || isWig)
	{
	cgiMakeButton(hgtaDoSummaryStats, "summary/statistics");
	hPrintf(" ");
	}

#ifdef SOMETIMES
    hPrintf(" ");
    cgiMakeButton(hgtaDoTest, "test");
#endif /* SOMETIMES */
    }
hPrintf("<P>"
	"To reset <B>all</B> user cart settings (including custom tracks), \n"
	"<A HREF=\"/cgi-bin/cartReset?destination=%s\">click here</A>.\n",
	getScriptName());

}
static void hgSeqFeatureRegionOptions(struct cart *cart, boolean canDoUTR,
                                      boolean canDoIntrons)
/* Print out HTML FORM entries for feature region options. */
{
    char *exonStr = canDoIntrons ? " Exons" : "";
    char *setting;

    puts("\n<H3> Sequence Retrieval Region Options: </H3>\n");

    if (canDoIntrons || canDoUTR)
    {
        cgiMakeCheckBox("hgSeq.promoter",
                        cartCgiUsualBoolean(cart, "hgSeq.promoter", FALSE));
        puts("Promoter/Upstream by ");
        setting = cartCgiUsualString(cart, "hgSeq.promoterSize", "1000");
        cgiMakeTextVar("hgSeq.promoterSize", setting, 5);
        puts("bases <BR>");
    }

    if (canDoUTR)
    {
        cgiMakeCheckBox("hgSeq.utrExon5",
                        cartCgiUsualBoolean(cart, "hgSeq.utrExon5", TRUE));
        printf("5' UTR%s <BR>\n", exonStr);
    }

    if (canDoIntrons)
    {
        cgiMakeCheckBox("hgSeq.cdsExon",
                        cartCgiUsualBoolean(cart, "hgSeq.cdsExon", TRUE));
        if (canDoUTR)
            printf("CDS Exons <BR>\n");
        else
            printf("Blocks <BR>\n");
    }
    else if (canDoUTR)
    {
        cgiMakeCheckBox("hgSeq.cdsExon",
                        cartCgiUsualBoolean(cart, "hgSeq.cdsExon", TRUE));
        printf("CDS <BR>\n");
    }
    else
    {
        cgiMakeHiddenVar("hgSeq.cdsExon", "1");
    }

    if (canDoUTR)
    {
        cgiMakeCheckBox("hgSeq.utrExon3",
                        cartCgiUsualBoolean(cart, "hgSeq.utrExon3", TRUE));
        printf("3' UTR%s <BR>\n", exonStr);
    }

    if (canDoIntrons)
    {
        cgiMakeCheckBox("hgSeq.intron",
                        cartCgiUsualBoolean(cart, "hgSeq.intron", TRUE));
        if (canDoUTR)
            puts("Introns <BR>");
        else
            puts("Regions between blocks <BR>");
    }

    if (canDoIntrons || canDoUTR)
    {
        cgiMakeCheckBox("hgSeq.downstream",
                        cartCgiUsualBoolean(cart, "hgSeq.downstream", FALSE));
        puts("Downstream by ");
        setting = cartCgiUsualString(cart, "hgSeq.downstreamSize", "1000");
        cgiMakeTextVar("hgSeq.downstreamSize", setting, 5);
        puts("bases <BR>");
    }

    if (canDoIntrons || canDoUTR)
    {
        setting = cartCgiUsualString(cart, "hgSeq.granularity", "gene");
        cgiMakeRadioButton("hgSeq.granularity", "gene",
                           sameString(setting, "gene"));
        if (canDoUTR)
            puts("One FASTA record per gene. <BR>");
        else
            puts("One FASTA record per item. <BR>");
        cgiMakeRadioButton("hgSeq.granularity", "feature",
                           sameString(setting, "feature"));
        if (canDoUTR)
            puts("One FASTA record per region (exon, intron, etc.) with ");
        else
            puts("One FASTA record per region (block/between blocks) with ");
    }
    else
    {
        puts("Add ");
    }
    setting = cartCgiUsualString(cart, "hgSeq.padding5", "0");
    cgiMakeTextVar("hgSeq.padding5", setting, 5);
    puts("extra bases upstream (5') and ");
    setting = cartCgiUsualString(cart, "hgSeq.padding3", "0");
    cgiMakeTextVar("hgSeq.padding3", setting, 5);
    puts("extra downstream (3') <BR>");
    if (canDoIntrons && canDoUTR)
    {
        puts("&nbsp;&nbsp;&nbsp;");
        cgiMakeCheckBox("hgSeq.splitCDSUTR",
                        cartCgiUsualBoolean(cart, "hgSeq.splitCDSUTR", FALSE));
        puts("Split UTR and CDS parts of an exon into separate FASTA records");
    }
    puts("<BR>\n");
    puts("Note: if a feature is close to the beginning or end of a chromosome \n"
         "and upstream/downstream bases are added, they may be truncated \n"
         "in order to avoid extending past the edge of the chromosome. <P>");
}
Ejemplo n.º 13
0
void doMiddle()
/* Write what goes between BODY and /BODY */
{
pushWarnHandler(localWarn);
if (!cgiServerHttpsIsOn())
     usage();
struct sqlConnection *conn = edwConnectReadWrite();
printf("<FORM ACTION=\"edwWebRegisterScript\" METHOD=POST>\n");
printf("<B>Register Script with ENCODE Data Warehouse</B><BR>\n");
#ifdef SOON
uglyf("HTTP_AUTHENTICATION: '%s'<BR>\n", getenv("HTTP_AUTHENTICATION"));
uglyf("HTTP_AUTHORIZATION: '%s'<BR>\n", getenv("HTTP_AUTHORIZATION"));
dumpEnv(mainEnv);
#endif
if (userEmail == NULL)
    {
    printf("Please sign in:");
    printf("<INPUT TYPE=BUTTON NAME=\"signIn\" VALUE=\"sign in\" id=\"signin\">");
    }
else if (cgiVarExists("description"))
    {
    struct edwUser *user = edwUserFromEmail(conn, userEmail);
    if (user == NULL)
	edwWarnUnregisteredUser(userEmail);
    else
	{
	char password[HEXED_32_SIZE];
	edwRandomHexed32(password);
	char babyName[HEXED_32_SIZE];
	edwRandomBabble(babyName, sizeof(babyName));

	edwRegisterScript(conn, user, babyName, password, cgiString("description"));
	printf("Script now registered.<BR>\n");
	printf("The script user name is %s.<BR>\n", babyName);
	printf("The script password is %s.<BR>\n", password);
	printf("Please save the script user name and password somewhere. ");
	puts("Please pass these two and the URL");
	puts(" of your validated manifest file (validated.txt) to our server to submit data.");
	puts("Construct a URL of the form:<BR>");
	printf("<PRE>https://encodedcc.sdsc.edu/cgi-bin/edwScriptSubmit"
	       "?user=%s&password=%s&url=%s\n</PRE>", 
	       babyName, password,
	       cgiEncode("http://your.host.edu/your_dir/validated.txt"));
	puts("That is pass the CGI encoded variables user, password, and url to the ");
	puts("web services CGI at");
	puts("https://encodedcc.sdsc.edu/cgi-bin/edwScriptSubmit. ");
	puts("You can use the http://encodedcc.sdsc.edu/cgi-bin/edwWebBrowse site to ");
	puts("monitor your submission interactively. Please contact your wrangler if you ");
	puts("have any questions.<BR>");
	cgiMakeButton("submit", "Register another script");
	}
    printf(" ");
    edwPrintLogOutButton();
    }
else
    {
    struct edwUser *user = edwUserFromEmail(conn, userEmail);
    edwPrintLogOutButton();
    if (user == NULL)
	edwWarnUnregisteredUser(userEmail);
    else
	{
	printf("%s is authorized to register a new script<BR>\n", userEmail);
	printf("<BR>Script description:\n");
	cgiMakeTextVar("description", NULL, 80);
	cgiMakeSubmitButton();
	}
    }
printf("</FORM>\n");
}
Ejemplo n.º 14
0
void doInitialPage()
/* Put up page with search box that explains program and
 * some good things to search on. */
{
char *listSpec = NULL;

webStartWrapperDetailedNoArgs(cart, NULL, "", "VisiGene Image Browser",
        FALSE, FALSE, FALSE, TRUE);

printf("<FORM ACTION=\"%s\" METHOD=GET>\n",
	hgVisiGeneCgiName());
puts("<P>VisiGene is a virtual microscope for viewing <em>in situ</em> images. \n"
"These images show where a gene is used in an organism, sometimes down to \n"
"cellular resolution. With VisiGene users can retrieve images that meet specific "
"search criteria, then interactively zoom and scroll across the collection.</P>\n");
printf("<CENTER>");
listSpec = cartUsualString(cart, hgpListSpec, "");
cgiMakeTextVar(hgpListSpec, listSpec, 30);
cgiMakeButton(hgpDoSearch, "search");
printf("<BR>\n");
printf("</CENTER>");
puts(
"<P>Good search terms include gene symbols, authors, years, body parts,\n"
"organisms, GenBank and UniProt accessions, Known Gene descriptive terms,\n"
"<A HREF=\"http://genex.hgu.mrc.ac.uk/Atlas/intro.html\" \n"
"TARGET=_blank>Theiler</A> stages for mice, and \n"
"<A HREF=\"http://www.xenbase.org/atlas/NF/NF-all.html\" \n"
"TARGET=_blank>Nieuwkoop/Faber</A> stages for frogs. The wildcard characters\n"
"* and ? work with gene symbols; otherwise the full word must match.</P>\n"
"<P> \n"
"<H3>Sample queries</H3> \n"
"<TABLE  border=0 CELLPADDING=0 CELLSPACING=0> \n"
"    <TR><TD VALIGN=Top NOWRAP><B>Request:</B><BR></TD> \n"
"        <TD VALIGN=Top COLSPAN=2><B>&nbsp;&nbsp; VisiGene Response:</B><BR></TD> \n"
"    </TR> \n"
// "    <TR><TD VALIGN=Top><BR></TD></TR> \n"
"    <TR><TD VALIGN=Top NOWRAP>nkx2-2</TD> \n"
"        <TD WIDTH=14></TD> \n"
"        <TD VALIGN=Top>Displays images associated with the gene nkx2-2</TD>\n"
"    </TR> \n"
"    <TR><TD VALIGN=Top NOWRAP>hoxa*</TD> \n"
"        <TD WIDTH=14></TD> \n"
"        <TD VALIGN=Top>Displays images of all genes in the Hox-A cluster (Note: * works only at the end of the word)</TD>\n"
"    </TR> \n"
"    <TR><TD VALIGN=Top NOWRAP>NM_007492</TD> \n"
"        <TD WIDTH=14></TD> \n"
"        <TD VALIGN=Top>Displays images associated with accession NM_007492</TD> \n"
"    </TR> \n"
"    <TR><TD VALIGN=Top NOWRAP>theiler 22</TD> \n"
"        <TD WIDTH=14></TD> \n"
"        <TD VALIGN=Top>Displays all images that show Theiler stage 22</TD> \n"
"    </TR> \n"
"    <TR><TD VALIGN=Top NOWRAP>vgPrb_16</TD> \n"
"        <TD WIDTH=14></TD> \n"
"        <TD VALIGN=Top>Displays images associated with VisiGene probe ID 16</TD> \n"
"    </TR> \n"
"    <TR><TD VALIGN=Top NOWRAP>allen institute</TD> \n"
"        <TD WIDTH=14></TD> \n"
"        <TD VALIGN=Top>Displays all images from the Allen Brain Atlas</TD> \n"
"    </TR> \n"
"    <TR><TD VALIGN=Top NOWRAP>mouse</TD> \n"
"        <TD WIDTH=14></TD> \n"
"        <TD VALIGN=Top>Displays all mouse images </TD> \n"
"    </TR> \n"
"    <TR><TD VALIGN=Top NOWRAP>xenopus</TD> \n"
"        <TD WIDTH=14></TD> \n"
"        <TD VALIGN=Top>Displays all images associated with frogs of genus Xenopus </TD>\n"
"    </TR> \n"
"    <TR><TD VALIGN=Top NOWRAP>mouse midbrain</TD> \n"
"        <TD WIDTH=14></TD> \n"
"        <TD VALIGN=Top>Displays mouse images that show expression in the "
"midbrain</TD> \n"
"    </TR> \n"
"    <TR><TD VALIGN=Top NOWRAP>smith jc 1994</TD> \n"
"        <TD WIDTH=14></TD> \n"
"        <TD VALIGN=Top>Displays images contributed by scientist J.C. Smith "
"in 1994</TD> \n"
"    </TR> \n"
"</TABLE> \n"
);
printf("</FORM>\n");
doHelp();
webEnd();
}
void wikiPlot()
/* wikiPlot - Quick plots of maps vs. each other. */
{
boolean gotDir = cgiVarExists("contigDir");
double step;

contigDir = cgiUsualString("contigDir", contigDir);
mapX = cgiUsualString("mapX", mapX);
mapY = cgiUsualString("mapY", mapY);
pix = cgiUsualInt("pix", pix);
xOff = cgiUsualDouble("xOff", xOff);
yOff = cgiUsualDouble("yOff", yOff);
zoom = cgiUsualDouble("zoom", zoom);
step = 0.1 * 1/zoom;

if (cgiVarExists("boxOut"))
    {
    double invZoom = 1.0/zoom;
    double xCen = xOff + invZoom*0.5;
    double yCen = yOff + invZoom*0.5;
    zoom /= 2;
    invZoom = 1.0/zoom;
    xOff = xCen - invZoom*0.5;
    yOff = yCen - invZoom*0.5;
    }
else if (cgiVarExists("boxUp"))
    yOff -= step;
else if (cgiVarExists("boxDown"))
    yOff += step;
else if (cgiVarExists("boxLeft"))
    xOff -= step;
else if (cgiVarExists("boxRight"))
    xOff += step;
else if (cgiVarExists("boxUpLeft"))
    {
    yOff -= step;
    xOff -= step;
    }
else if (cgiVarExists("boxUpRight"))
    {
    yOff -= step;
    xOff += step;
    }
else if (cgiVarExists("boxDownLeft"))
    {
    yOff += step;
    xOff -= step;
    }
else if (cgiVarExists("boxDownRight"))
    {
    yOff += step;
    xOff += step;
    }
else if (cgiVarExists("unzoom"))
    {
    xOff = yOff = -0.05;
    zoom = 0.9;
    }

printf("<FORM ACTION=\"../cgi-bin/wikiPlot\" METHOD=\"GET\">\n");
printf("<TABLE BORDER=0 WIDTH=\"100%%\">\n");
printf("<TR>\n");
printf("<TD WIDTH=\"78%%\">\n");
printf("<B>Wiki Plotter</B><BR>\n");
printf("<B>Contig: </B>");
cgiMakeTextVar("contigDir", contigDir, 0);
if (gotDir)
    {
    cgiMakeButton("refresh", "refresh");
    }
else
    cgiMakeButton("submit", "submit");
printf("<BR>\n");
printf("<B>Map X: </B>");
cgiMakeTextVar("mapX", mapX, 12);
printf("<B>Map Y: </B>");
cgiMakeTextVar("mapY", mapY, 12);
printf("<B>Pixels: </B>");
cgiMakeIntVar("pix", pix, 4);
printf("</TD>\n");
printf("<TD WIDTH=\"22%%\">\n");
if (gotDir)
    printBox();
printf("</TD>\n");
printf("</TR>\n");
printf("</TABLE>\n");

if (gotDir)
    {
    char xFile[512], yFile[512];
    struct hash *xHash = NULL, *yHash = NULL;
    struct clonePos *xList = NULL, *yList = NULL;
    sprintf(xFile, "%s/%s", contigDir, mapX);
    sprintf(yFile, "%s/%s", contigDir, mapY);
    loadMaps(xFile, yFile, &xList, &yList, &xHash, &yHash);
    makePlot(xList, yList, yHash);
    }

/* Save hidden vars. */
    {
    char buf[256];
    sprintf(buf, "%f", zoom);
    cgiMakeHiddenVar("zoom", buf);
    sprintf(buf, "%f", xOff);
    cgiMakeHiddenVar("xOff", buf);
    sprintf(buf, "%f", yOff);
    cgiMakeHiddenVar("yOff", buf);
    }
printf("</FORM>\n");
}
Ejemplo n.º 16
0
void doBedOrCtOptions(char *table, struct sqlConnection *conn,
                      boolean doCt)
/* Put up form to get options on BED or custom track output. */
/* (Taken from hgText.c/doBedCtOptions) */
{
char *table2 = NULL;	/* For now... */
struct hTableInfo *hti = getHti(database, table, conn);
char buf[256];
char *setting;
htmlOpen("Output %s as %s", table, (doCt ? "Custom Track" : "BED"));
if (doGalaxy())
    startGalaxyForm();
else if (doGreat())
    {
    verifyGreatAssemblies();
    startGreatForm();
    }
else
    hPrintf("<FORM ACTION=\"%s\" METHOD=GET>\n", getScriptName());
cartSaveSession(cart);
if (!doGreat())
{
    hPrintf("%s\n", "<TABLE><TR><TD>");
    if (doCt)
        {
        hPrintf("%s\n", "</TD><TD>"
                "<A HREF=\"../goldenPath/help/customTrack.html\" TARGET=_blank>"
                "Custom track</A> header: </B>");
        }
    else
        {
        cgiMakeCheckBox(hgtaPrintCustomTrackHeaders,
                        cartCgiUsualBoolean(cart, hgtaPrintCustomTrackHeaders, FALSE));
        hPrintf("%s\n", "</TD><TD> <B> Include "
                        "<A HREF=\"../goldenPath/help/customTrack.html\" TARGET=_blank>"
                        "custom track</A> header: </B>");
        }
    hPrintf("%s\n", "</TD></TR><TR><TD></TD><TD>name=");
    safef(buf, sizeof(buf), "tb_%s", hti->rootName);
    setting = cgiUsualString(hgtaCtName, buf);
    cgiMakeTextVar(hgtaCtName, setting, 16);
    hPrintf("%s\n", "</TD></TR><TR><TD></TD><TD>description=");
    safef(buf, sizeof(buf), "table browser query on %s%s%s",
          table, (table2 ? ", " : ""), (table2 ? table2 : ""));
    setting = cgiUsualString(hgtaCtDesc, buf);
    cgiMakeTextVar(hgtaCtDesc, setting, 50);
    hPrintf("%s\n", "</TD></TR><TR><TD></TD><TD>visibility=");
    if (isWiggle(database, table) || isBigWigTable(table))
        {
        setting = cartCgiUsualString(cart, hgtaCtVis, ctVisWigMenu[2]);
        cgiMakeDropList(hgtaCtVis, ctVisWigMenu, ctVisWigMenuSize, setting);
        }
    else
        {
        setting = cartCgiUsualString(cart, hgtaCtVis, ctVisMenu[3]);
        cgiMakeDropList(hgtaCtVis, ctVisMenu, ctVisMenuSize, setting);
        }
    hPrintf("%s\n", "</TD></TR><TR><TD></TD><TD>url=");
    setting = cartCgiUsualString(cart, hgtaCtUrl, "");
    cgiMakeTextVar(hgtaCtUrl, setting, 50);
    hPrintf("%s\n", "</TD></TR><TR><TD></TD><TD>");
    hPrintf("%s\n", "</TD></TR></TABLE>");
}
if (isWiggle(database, table) || isBedGraph(table) || isBigWigTable(table) )
    {
    char *setting = NULL;
    hPrintf("<P> <B> Select type of data output: </B> <BR>\n");
    setting = cartCgiUsualString(cart, hgtaCtWigOutType, outWigData);
    cgiMakeRadioButton(hgtaCtWigOutType, outWigBed, sameString(setting, outWigBed));
    hPrintf("BED format (no data value information, only position)<BR>\n");
    cgiMakeRadioButton(hgtaCtWigOutType, outWigData, sameString(setting, outWigData));
    hPrintf("DATA VALUE format (position and real valued data)</P>\n");
    }
else
    {
    cgiDown(0.9);
    hPrintf("<B> Create one BED record per: </B>\n");
    if ((anyIntersection() && intersectionIsBpWise()) ||
	(anySubtrackMerge(database, table) && subtrackMergeIsBpWise()))
	{
        /* The original table may have blocks/CDS, described in hti, but
         * that info will be lost after base pair-wise operations.  So make
         * a temporary copy of hti with its flags tweaked: */
	struct hTableInfo simplifiedHti;
	memcpy(&simplifiedHti, hti, sizeof(simplifiedHti));
	simplifiedHti.hasBlocks = FALSE;
	simplifiedHti.hasCDS = FALSE;
	fbOptionsHtiCart(&simplifiedHti, cart);
	}
    else
	fbOptionsHtiCart(hti, cart);
    }
if (doCt)
    {
    if (doGalaxy())
        {
        /* send the action parameter with the form as well */
        cgiMakeHiddenVar(hgtaDoGetCustomTrackFile, "get custom track in file");
        printGalaxySubmitButtons();
        }
    else
        {
        cgiMakeButton(hgtaDoGetCustomTrackTb, "get custom track in table browser");
        hPrintf(" ");
        cgiMakeButton(hgtaDoGetCustomTrackFile, "get custom track in file");
        hPrintf("<BR>\n");
        cgiMakeButton(hgtaDoGetCustomTrackGb, "get custom track in genome browser");
        }
    }
else
    {
    if (doGalaxy())
        {
        cgiMakeHiddenVar(hgtaDoGetBed, "get BED");
        printGalaxySubmitButtons();
        }
    else if (doGreat())
        {
        cgiMakeHiddenVar(hgtaDoGetBed, "get BED");
        printGreatSubmitButtons();
        }
    else
        cgiMakeButton(hgtaDoGetBed, "get BED");
    }
if (!doGalaxy() && !doGreat())
    {
    hPrintf(" ");
    cgiMakeButton(hgtaDoMainPage, "cancel");
    hPrintf("</FORM>\n");
    }
cgiDown(0.9);
htmlClose();
}
Ejemplo n.º 17
0
static void filterControlsForTableDb(char *db, char *rootTable)
/* Put up filter controls for a single database table. */
{
struct sqlConnection *conn =  NULL;
if (!trackHubDatabase(db))
    conn = hAllocConn(db);
char *table = chromTable(conn, rootTable);
struct trackDb *tdb = findTdbForTable(db, curTrack, rootTable, ctLookupName);
boolean isSmallWig = isWiggle(db, table);
boolean isBigWig = tdb ? tdbIsBigWig(tdb) : isBigWigTable(table);
boolean isWig = isSmallWig || isBigWig;
boolean isBedGr = tdb ? tdbIsBedGraph(tdb) : isBedGraph(rootTable);
boolean isBb = tdb ? tdbIsBigBed(tdb) : isBigBed(database, table, curTrack, ctLookupName);
boolean isBam = tdb ? tdbIsBam(tdb) : isBamTable(rootTable);
boolean isVcf = tdb ? tdbIsVcf(tdb) : isVcfTable(rootTable, NULL);
int bedGraphColumn = 5;		/*	default score column	*/

if (isBedGr)
    {
    int wordCount;
    char *words[8];
    char *typeLine = cloneString(tdb->type);

    wordCount = chopLine(typeLine,words);
    if (wordCount > 1)
        bedGraphColumn = sqlUnsigned(words[1]);
    freez(&typeLine);
    }

if (isWig)
    {
    hPrintf("<TABLE BORDER=0>\n");
    if ((tdb != NULL) && (tdb->type != NULL))
        {
        double min, max;
        wiggleMinMax(tdb,&min,&max);
        numericFilterWithLimits(db, rootTable, filterDataValueVar,filterDataValueVar,min,max,"");

        hPrintf("<TR><TD COLSPAN=3 ALIGN=RIGHT> (dataValue range: [%g:%g]) "
                "</TD></TR></TABLE>\n", min, max);
        }
    else
        {
        numericFilter(db, rootTable, filterDataValueVar,filterDataValueVar, "");
        hPrintf("</TABLE>\n");
        }
    }
else
    {
    struct sqlFieldType *ftList;
    if (isBb)
        ftList = bigBedListFieldsAndTypes(tdb, conn);
    else if (isBam)
	ftList = bamListFieldsAndTypes();
    else if (isVcf)
	ftList = vcfListFieldsAndTypes();
    else
        ftList = sqlListFieldsAndTypes(conn, table);
    printSqlFieldListAsControlTable(ftList, db, rootTable, tdb, isBedGr);
    }

/* Printf free-form query row. */
if (!(isWig||isBedGr||isBam||isVcf))
    {
    char *name;
    hPrintf("<TABLE BORDER=0><TR><TD>\n");
    name = filterFieldVarName(db, rootTable, "", filterRawLogicVar);
    cgiMakeDropList(name, logOpMenu, logOpMenuSize,
		cartUsualString(cart, name, logOpMenu[0]));
    hPrintf(" Free-form query: ");
    name = filterFieldVarName(db, rootTable, "", filterRawQueryVar);
    char *val = cartUsualString(cart, name, "");
    // escape double quotes to avoid HTML parse trouble in the text input.
    val = htmlEncodeText(val, FALSE);
    cgiMakeTextVar(name, val, 50);
    hPrintf("</TD></TR></TABLE>\n");
    }

if (isWig||isBedGr||isBam||isVcf)
    {
    char *name;
    hPrintf("<TABLE BORDER=0><TR><TD> Limit data output to:&nbsp\n");
    name = filterFieldVarName(db, rootTable, "_", filterMaxOutputVar);
    cgiMakeDropList(name, maxOutMenu, maxOutMenuSize,
		cartUsualString(cart, name, maxOutMenu[0]));
    hPrintf("&nbsp;lines</TD></TR></TABLE>\n");
    }

freez(&table);
hFreeConn(&conn);
hPrintf("<BR>\n");
cgiMakeButton(hgtaDoFilterSubmit, "submit");
hPrintf(" ");
cgiMakeButton(hgtaDoMainPage, "cancel");
}
Ejemplo n.º 18
0
void doGetPrimers(char *db, char *organism, struct pcrServer *serverList,
                  char *fPrimer, char *rPrimer, int maxSize, int minPerfect, int minGood,
                  boolean flipReverse)
/* Put up form to get primers. */
{
    redoDbAndOrgIfNoServer(serverList, &db, &organism);
    struct sqlConnection *conn = hConnectCentral();
    boolean gotTargetDb = sqlTableExists(conn, "targetDb");
    hDisconnectCentral(&conn);

    printf("<FORM ACTION=\"../cgi-bin/hgPcr\" METHOD=\"GET\" NAME=\"mainForm\">\n");
    cartSaveSession(cart);

    printf("<TABLE BORDER=0 WIDTH=\"96%%\" COLS=7><TR>\n");

    printf("%s", "<TD><CENTER>\n");
    printf("Genome:<BR>");
    showGenomes(organism, serverList);
    printf("%s", "</TD>\n");

    printf("%s", "<TD><CENTER>\n");
    printf("Assembly:<BR>");
    showAssemblies(organism, db, serverList, gotTargetDb);
    printf("%s", "</TD>\n");

    if (gotTargetDb)
    {
        struct targetPcrServer *targetServerList = getTargetServerList(db, NULL);
        if (targetServerList != NULL)
        {
            char *target = cartUsualString(cart, "wp_target", "genome");
            printf("%s", "<TD><CENTER>\n");
            printf("Target:<BR>");
            showTargets(target, targetServerList);
            printf("%s", "</TD>\n");
        }
        else
            cgiMakeHiddenVar("wp_target", "genome");
    }
    else
        cgiMakeHiddenVar("wp_target", "genome");

    printf("%s", "<TD COLWIDTH=2><CENTER>\n");
    printf("Forward Primer:<BR>");
    cgiMakeTextVar("wp_f", fPrimer, 22);
    printf("%s", "</TD>\n");

    printf("%s", "<TD><CENTER COLWIDTH=2>\n");
    printf(" Reverse Primer:<BR>");
    cgiMakeTextVar("wp_r", rPrimer, 22);
    printf("%s", "</TD>\n");

    printf("%s", "<TD><CENTER>\n");
    printf("&nbsp;<BR>");
    cgiMakeButton("Submit", "submit");
    printf("%s", "</TD>\n");

    printf("</TR></TABLE><BR>");

    printf("<TABLE BORDER=0 WIDTH=\"96%%\" COLS=4><TR>\n");
    printf("%s", "<TD><CENTER>\n");
    printf("Max Product Size: ");
    cgiMakeIntVar("wp_size", maxSize, 5);
    printf("%s", "</TD>\n");

    printf("%s", "<TD><CENTER>\n");
    printf(" Min Perfect Match: ");
    cgiMakeIntVar("wp_perfect", minPerfect, 2);
    printf("%s", "</TD>\n");

    printf("%s", "<TD><CENTER>\n");
    printf(" Min Good Match: ");
    cgiMakeIntVar("wp_good", minGood, 2);
    printf("%s", "</TD>\n");

    printf("%s", "<TD><CENTER>\n");
    printf(" Flip Reverse Primer: ");
    cgiMakeCheckBox("wp_flipReverse", flipReverse);
    printf("%s", "</TD>\n");
    printf("</TR></TABLE><BR>");

    printf("</FORM>\n");

    /* Put up a second form who's sole purpose is to preserve state
     * when the user flips the genome button. */
    printf("<FORM ACTION=\"../cgi-bin/hgPcr\" METHOD=\"GET\" NAME=\"orgForm\">"
           "<input type=\"hidden\" name=\"wp_target\" value=\"\">\n"
           "<input type=\"hidden\" name=\"db\" value=\"\">\n"
           "<input type=\"hidden\" name=\"org\" value=\"\">\n"
           "<input type=\"hidden\" name=\"wp_f\" value=\"\">\n"
           "<input type=\"hidden\" name=\"wp_r\" value=\"\">\n"
           "<input type=\"hidden\" name=\"wp_size\" value=\"\">\n"
           "<input type=\"hidden\" name=\"wp_perfect\" value=\"\">\n"
           "<input type=\"hidden\" name=\"wp_good\" value=\"\">\n"
           "<input type=\"hidden\" name=\"wp_showPage\" value=\"true\">\n");
    cartSaveSession(cart);
    printf("</FORM>\n");
    webNewSection("About In-Silico PCR");
    doHelp();
    printf("%s", "<P><H3>Author</H3>\n");
    printf("%s", "<P>In-Silico PCR was written by "
           "<A HREF=\"mailto:[email protected]\">Jim Kent</A>.\n"
           "Interactive use on this web server is free to all.\n"
           "Sources and executables to run batch jobs on your own server are available free\n"
           "for academic, personal, and non-profit purposes.  Non-exclusive commercial\n"
           "licenses are also available.  Contact Jim for details.</P>\n");
}