예제 #1
0
static void showSnpWidthCfg(struct cart *cart, struct trackDb *tdb,
				char *name, boolean parentLevel)
{
unsigned showSnpWidth = cartOrTdbInt(cart, tdb, 
    SNAKE_SHOW_SNP_WIDTH, SNAKE_DEFAULT_SHOW_SNP_WIDTH);

printf("<B>Maximum window size in which to show mismatches: </B>\n");

char varName[1024];
safef(varName, sizeof(varName), "%s." SNAKE_SHOW_SNP_WIDTH, name);
cgiMakeIntVar(varName, showSnpWidth, 10);
puts("<BR>");
}
예제 #2
0
static void showTablePaging(struct fieldedTable *table, struct cart *cart, char *varPrefix,
    struct fieldedTableSegment *largerContext, int pageSize)
/* If larger context exists and is bigger than current display, then draw paging controls. */
{
/* Handle paging if any */
if (largerContext != NULL)  // Need to page?
     {
     if (pageSize < largerContext->tableSize)
	{
	int curPage = largerContext->tableOffset/pageSize;
	int totalPages = (largerContext->tableSize + pageSize - 1)/pageSize;

	printf("Displaying page ");

	char pageVar[64];
	safef(pageVar, sizeof(pageVar), "%s_page", varPrefix);
	cgiMakeIntVar(pageVar, curPage+1, 3);

	printf(" of %d", totalPages);
	}
     }
}
void configurePage()
/* Put up configuration page. */
{
cartWebStart(cart, database, "Configure Genome Graphs");
hPrintf("<FORM ACTION=\"../cgi-bin/hgGenome\" METHOD=GET>\n");
cartSaveSession(cart);
hPrintf("<TABLE>\n");
hPrintf("<TR>\n");
hPrintf("<TD>\n");
hPrintf("image width: ");
cgiMakeIntVar(hggImageWidth, cartUsualInt(cart, hggImageWidth, hgDefaultPixWidth), 4);
hPrintf("</TD>\n");
hPrintf("<TD>\n");
hPrintf("graph height: ");
cgiMakeIntVar(hggGraphHeight, graphHeight(), 3);
hPrintf("</TD>\n");
hPrintf("<TD>\n");
hPrintf(" graphs per line: ");
makeNumMenu(hggGraphsPerLine, minGraphsPerLine, maxGraphsPerLine, 
	graphsPerLine());
hPrintf("</TD>\n");
hPrintf("<TD>\n");
hPrintf(" lines of graphs: ");
makeNumMenu(hggLinesOfGraphs, minLinesOfGraphs, maxLinesOfGraphs, 
	linesOfGraphs());
hPrintf("</TD>\n");
hPrintf("</TR>\n");
hPrintf("</TABLE>\n");
hPrintf("<TABLE><TR><TD>\n");
hPrintf("chromosome layout: ");
cgiMakeDropList(hggChromLayout, chromLayouts, ArraySize(chromLayouts), 
        chromLayout());
hPrintf("</TD></TR></TABLE>\n");
hPrintf("<TABLE><TR><TD>\n");
hPrintf("numerical labels: ");
cartMakeCheckBox(cart, hggLabels, TRUE);
hPrintf(" <I>Label axis on left for first graph and on right for last graph</I>");
hPrintf("</TD></TR></TABLE>\n");
hPrintf("<TABLE><TR><TD>\n");
hPrintf("highlight missing: ");
cartMakeCheckBox(cart, hggYellowMissing, FALSE);
hPrintf(" <I>Highlight background in yellow/gray if there is missing data in first graph</I>");
hPrintf("</TD></TR></TABLE>\n");
hPrintf("<TABLE><TR><TD>\n");
hPrintf("region padding: ");
cgiMakeIntVar(hggRegionPad, regionPad(), 6);
hPrintf(" <I>Number of bases to add to either side of regions over threshold</I>");
hPrintf("</TD></TR></TABLE>\n");
hPrintf("<TABLE><TR><TD>\n");
cgiMakeButton("submit", "submit");
hPrintf("</TD></TR></TABLE>\n");
hPrintf("</TD>\n");
hPrintf("</FORM>\n");

webNewSection("Configure Graphs");
hPrintf("Click on the hyperlink by the graph name to configure it.");
hTableStart();
hPrintf("<TR><TH>name</TH>");
hPrintf("<TH>description</TH></TR>");
struct slRef *ref;
for (ref = ggList; ref != NULL; ref = ref->next)
    {
    struct genoGraph *gg = ref->val;
    /* Only show custom graphs, stand-alone DB graphs, and composite */
    /* graphs.  Don't show subGraphs part of a composite. */
    if (gg->isSubGraph == FALSE)
	{
	char *tmp = cgiEncode(gg->name);
	hPrintf("<TR><TD><A HREF=\"../cgi-bin/hgGenome?%s&%s=on&g=%s\">",
		cartSidUrlString(cart), hggConfigureOne, tmp);
	freeMem(tmp);
	hPrintf("%s</A></TD>", gg->shortLabel);
	hPrintf("<TD>%s</TD></TR>\n", gg->longLabel);
	}
    }
hTableEnd();
cartWebEnd();
}
void webMain(struct liftOverChain *chain, char *dataFormat, boolean multiple)
/* set up page for entering data */
{
struct dbDb *dbList;
char *fromOrg = hArchiveOrganism(chain->fromDb), *toOrg = hArchiveOrganism(chain->toDb);
cgiParagraph(
    "This tool converts genome coordinates and genome annotation files "
    "between assemblies.&nbsp;&nbsp;"
    "The input data can be pasted into the text box, or uploaded from a file.&nbsp;&nbsp;"
    "If a pair of assemblies cannot be selected from the pull-down menus,"
    " a direct lift between them is unavailable.&nbsp;&nbsp;"
    "However, a sequential lift may be possible.&nbsp;&nbsp;"
    "Example: lift from Mouse, May 2004, to Mouse, Feb. 2006, and then from Mouse, "
    "Feb. 2006 to Mouse, July 2007 to achieve a lift from mm5 to mm9.&nbsp;&nbsp;"
    "");

/* create HMTL form */
puts("<FORM ACTION=\"../cgi-bin/hgLiftOver\" METHOD=\"POST\" "
       " ENCTYPE=\"multipart/form-data\" NAME=\"mainForm\">\n");
cartSaveSession(cart);

/* create HTML table for layout purposes */
puts("\n<TABLE WIDTH=\"100%%\">\n");

/* top two rows -- genome and assembly menus */
cgiSimpleTableRowStart();
cgiTableField("Original Genome: ");
cgiTableField("Original Assembly: ");
cgiTableField("New Genome: ");
cgiTableField("New Assembly: ");
cgiTableRowEnd();

cgiSimpleTableRowStart();

/* genome */
cgiSimpleTableFieldStart();
dbList = hGetLiftOverFromDatabases();
printSomeGenomeListHtmlNamed(HGLFT_FROMORG_VAR, chain->fromDb, dbList, onChange);
cgiTableFieldEnd();

/* from assembly */
cgiSimpleTableFieldStart();
printAllAssemblyListHtmlParm(chain->fromDb, dbList, HGLFT_FROMDB_VAR, 
			     TRUE, onChange);
cgiTableFieldEnd();

/* to assembly */

cgiSimpleTableFieldStart();
dbDbFreeList(&dbList);
dbList = hGetLiftOverToDatabases(chain->fromDb);
printLiftOverGenomeList(HGLFT_TOORG_VAR, chain->toDb, dbList, onChange);
cgiTableFieldEnd();

cgiSimpleTableFieldStart();
printAllAssemblyListHtmlParm(chain->toDb, dbList, HGLFT_TODB_VAR, TRUE, "");
cgiTableFieldEnd();

cgiTableRowEnd();
cgiTableEnd();

cgiParagraph("&nbsp;");
cgiSimpleTableStart();
cgiSimpleTableRowStart();
cgiSimpleTableFieldStart();
cgiTableField("Minimum ratio of bases that must remap:");
cgiTableFieldEnd();
cgiSimpleTableFieldStart();
cgiMakeDoubleVar(HGLFT_MINMATCH,chain->minMatch,6);
cgiTableFieldEnd();
cgiTableRowEnd();
cgiSimpleTableRowStart();
cgiSimpleTableFieldStart();
cgiTableField("Minimum chain size in target:");
cgiTableFieldEnd();
cgiSimpleTableFieldStart();
cgiMakeIntVar(HGLFT_MINSIZET,chain->minSizeT,4);
cgiTableFieldEnd();
cgiTableRowEnd();
cgiSimpleTableRowStart();
cgiSimpleTableFieldStart();
cgiTableField("Minimum hit size in query:");
cgiTableFieldEnd();
cgiSimpleTableFieldStart();
cgiMakeIntVar(HGLFT_MINSIZEQ,chain->minSizeQ,4);
cgiTableFieldEnd();
cgiTableRowEnd();
cgiSimpleTableRowStart();
cgiSimpleTableFieldStart();
cgiTableField("Allow multiple output regions:");
cgiTableFieldEnd();
cgiSimpleTableFieldStart();
cgiMakeCheckBox(HGLFT_MULTIPLE,multiple);
cgiTableFieldEnd();
cgiTableRowEnd();
cgiSimpleTableRowStart();
cgiSimpleTableFieldStart();
cgiTableField("Min ratio of alignment blocks/exons that must map:");
cgiTableFieldEnd();
cgiSimpleTableFieldStart();
cgiMakeDoubleVar(HGLFT_MINBLOCKS,chain->minBlocks,6);
cgiTableFieldEnd();
cgiTableRowEnd();
cgiSimpleTableRowStart();
cgiSimpleTableFieldStart();
cgiTableField("If thickStart/thickEnd is not mapped, use the closest mapped base:");
cgiTableFieldEnd();
cgiSimpleTableFieldStart();
cgiMakeCheckBox(HGLFT_FUDGETHICK,(chain->fudgeThick[0]=='Y') ? TRUE : FALSE);
cgiTableFieldEnd();
cgiTableRowEnd();
cgiTableEnd();

/* next row -- file format menu */
cgiParagraph(
         "&nbsp;For descriptions of the supported data formats, see the bottom of this page.");
cgiSimpleTableStart();
cgiSimpleTableRowStart();
cgiTableField("Data Format: ");
cgiSimpleTableFieldStart();
cgiMakeDropList(HGLFT_DATAFORMAT_VAR, 
                formatList, sizeof(formatList)/sizeof (char*) - 1, dataFormat);
cgiTableFieldEnd();
cgiTableRowEnd();
cgiTableEnd();

/* text box and two buttons (submit, reset) */
cgiParagraph("&nbsp;Paste in data:\n");
cgiSimpleTableStart();
cgiSimpleTableRowStart();

cgiSimpleTableFieldStart();
cgiMakeTextArea(HGLFT_USERDATA_VAR, cartCgiUsualString(cart, HGLFT_USERDATA_VAR, NULL), 10, 80);
cgiTableFieldEnd();

/* right element of table is a nested table
 * with two buttons stacked on top of each other */
cgiSimpleTableFieldStart();
cgiSimpleTableStart();

cgiSimpleTableRowStart();
cgiSimpleTableFieldStart();
cgiMakeSubmitButton();
cgiTableFieldEnd();
cgiTableRowEnd();

cgiSimpleTableRowStart();
cgiSimpleTableFieldStart();
cgiMakeClearButton("mainForm", HGLFT_USERDATA_VAR);
cgiTableFieldEnd();
cgiTableRowEnd();

cgiTableEnd();
cgiTableFieldEnd();

cgiTableRowEnd();
cgiTableEnd();

/* next  row -- file upload controls */
cgiParagraph("&nbsp;Or upload data from a file:");
cgiSimpleTableStart();
cgiSimpleTableRowStart();
printf("<TD><INPUT TYPE=FILE NAME=\"%s\"></TD>\n", HGLFT_DATAFILE_VAR);
puts("<TD><INPUT TYPE=SUBMIT NAME=SubmitFile VALUE=\"Submit File\"></TD>\n");
cgiTableRowEnd();
cgiTableEnd();
printf("<input type=\"hidden\" name=\"%s\" value=\"0\">\n",
                        HGLFT_REFRESHONLY_VAR);
puts("</FORM>\n");

cartSaveSession(cart);
puts("</FORM>");
freeMem(fromOrg);
freeMem(toOrg);
}
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");
}
예제 #6
0
파일: hPrint.c 프로젝트: bowhan/kent
void hIntVar(char *varName, int initialVal, int maxDigits)
/* Write out numerical entry field if not supressed. */
{
if (!suppressHtml)
    cgiMakeIntVar(varName, initialVal, maxDigits);
}
예제 #7
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");
}